class PipeFitter::Cli

Public Instance Methods

activate() click to toggle source
# File lib/pipe_fitter/cli.rb, line 46
def activate
  t = options[:start_timestamp] ? Time.parse(options[:start_timestamp]) : nil
  puts client.activate(options[:pipeline_id], options[:parameter_file], t)
end
diff(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 31
def diff(definition_file)
  puts client.diff(options[:pipeline_id], definition_file, options[:format])
end
diff_deploy_files(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 88
def diff_deploy_files(definition_file)
  client.diff_deploy_files(definition_file, options[:format]).each do |d|
    puts d
  end
end
export() click to toggle source
# File lib/pipe_fitter/cli.rb, line 10
def export
  puts client.definition(options[:pipeline_id]).to_yaml
end
find(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 58
def find(definition_file)
  puts client.find_registered(definition_file).to_h.to_json
end
find_diff(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 64
def find_diff(definition_file)
  p = client.find_registered(definition_file)
  abort("Pipeline is not registered") if p.nil?
  puts client.diff(p.id, definition_file, options[:format])
  puts p.to_h.to_json
end
find_update(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 73
def find_update(definition_file)
  p = client.find_registered(definition_file)
  abort("Pipeline is not registered") if p.nil?
  unless options[:force_update]
    puts client.diff(p.id, definition_file)
    print "\nReally update pipeline definition? [y/N] : "
    abort("Update was canceled") if $stdin.gets.chomp !~ /^y$/i
  end
  res = client.update(p.id, definition_file)
  puts JSON.pretty_generate(res)
  puts p.to_h.to_json
end
register(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 15
def register(definition_file)
  id, res = client.register(definition_file)
  puts id, JSON.pretty_generate(res)

  diff = client.diff_deploy_files(definition_file)
  unless diff.empty?
    puts diff.join("\n")
    print "\nReally upload deploy_files? [y/N] : "
    abort("Upload deploy_files were canceled") if $stdin.gets.chomp !~ /^y$/i
    client.upload_deploy_files(definition_file)
  end
end
show(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 53
def show(definition_file)
  puts Pipeline.load_yaml(definition_file).to_yaml
end
update(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 37
def update(definition_file)
  res = client.update(options[:pipeline_id], definition_file)
  puts JSON.pretty_generate(res)
end
upload_deploy_files(definition_file) click to toggle source
# File lib/pipe_fitter/cli.rb, line 95
def upload_deploy_files(definition_file)
  client.upload_deploy_files(definition_file)
end

Private Instance Methods

client() click to toggle source
# File lib/pipe_fitter/cli.rb, line 101
def client
  @client ||= DataPipelineClient.new(options)
end