Class: PipeFitter::Cli
- Inherits:
-
Thor
- Object
- Thor
- PipeFitter::Cli
- Defined in:
- lib/pipe_fitter/cli.rb
Instance Method Summary collapse
- #activate ⇒ Object
- #diff(definition_file) ⇒ Object
- #diff_deploy_files(definition_file) ⇒ Object
- #export ⇒ Object
- #find(definition_file) ⇒ Object
- #find_diff(definition_file) ⇒ Object
- #find_update(definition_file) ⇒ Object
- #register(definition_file) ⇒ Object
- #show(definition_file) ⇒ Object
- #update(definition_file) ⇒ Object
- #upload_deploy_files(definition_file) ⇒ Object
Instance Method Details
#activate ⇒ Object
38 39 40 41 |
# File 'lib/pipe_fitter/cli.rb', line 38 def activate t = [:start_timestamp] ? Time.parse([:start_timestamp]) : nil puts client.activate([:pipeline_id], [:parameter_file], t) end |
#diff(definition_file) ⇒ Object
23 24 25 |
# File 'lib/pipe_fitter/cli.rb', line 23 def diff(definition_file) puts client.diff([:pipeline_id], definition_file, [:format]) end |
#diff_deploy_files(definition_file) ⇒ Object
80 81 82 83 84 |
# File 'lib/pipe_fitter/cli.rb', line 80 def diff_deploy_files(definition_file) client.diff_deploy_files(definition_file, [:format]).each do |d| puts d end end |
#export ⇒ Object
10 11 12 |
# File 'lib/pipe_fitter/cli.rb', line 10 def export puts client.definition([:pipeline_id]).to_yaml end |
#find(definition_file) ⇒ Object
50 51 52 |
# File 'lib/pipe_fitter/cli.rb', line 50 def find(definition_file) puts client.find_registered(definition_file).to_h.to_json end |
#find_diff(definition_file) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/pipe_fitter/cli.rb', line 56 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, [:format]) puts p.to_h.to_json end |
#find_update(definition_file) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/pipe_fitter/cli.rb', line 65 def find_update(definition_file) p = client.find_registered(definition_file) abort("Pipeline is not registered") if p.nil? unless [: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) ⇒ Object
15 16 17 18 |
# File 'lib/pipe_fitter/cli.rb', line 15 def register(definition_file) id, res = client.register(definition_file) puts id, JSON.pretty_generate(res) end |
#show(definition_file) ⇒ Object
45 46 47 |
# File 'lib/pipe_fitter/cli.rb', line 45 def show(definition_file) puts Pipeline.load_yaml(definition_file).to_yaml end |
#update(definition_file) ⇒ Object
29 30 31 32 |
# File 'lib/pipe_fitter/cli.rb', line 29 def update(definition_file) res = client.update([:pipeline_id], definition_file) puts JSON.pretty_generate(res) end |
#upload_deploy_files(definition_file) ⇒ Object
87 88 89 |
# File 'lib/pipe_fitter/cli.rb', line 87 def upload_deploy_files(definition_file) client.upload_deploy_files(definition_file) end |