Class: Appfront::Command::Deploys
- Defined in:
- lib/appfront/command/deploys.rb
Class Method Summary collapse
- .add(args, opts) ⇒ Object
- .attach(args, opts) ⇒ Object
- .info(opts) ⇒ Object
- .ls ⇒ Object
- .rm(args, opts) ⇒ Object
- .test(args, opts) ⇒ Object
- .update(args, opts) ⇒ Object
- .yaml(opts) ⇒ Object
Class Method Details
.add(args, opts) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/appfront/command/deploys.rb', line 21 def self.add(args, opts) spinner "Uploading Deploy YAML configuration to Jarvis..." do api.post "/flow.yaml", file: args[0] end puts "\n" end |
.attach(args, opts) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/appfront/command/deploys.rb', line 13 def self.attach(args, opts) find_deploy! opts spinner "Attaching deploy to cluster..." do api.post "/cluster/#{args[0]}/attach", deploy: @deploy end puts "\n" end |
.info(opts) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/appfront/command/deploys.rb', line 51 def self.info(opts) find_deploy! opts h = api.get "/flow/#{@deploy}" puts "=== Deploy: #{h['name']}" puts puts "\t Deploy uuid: #{h['uuid']}" puts "\t Status: #{h['status']} " puts "\t Running deploys: #{h['deploys']}" if h['domains'] puts puts "=== Domains:" h['domains'].each do |domain| puts "\t #{domain['name']}" end end if h['cluster'] puts puts "=== Cluster: " puts "\t name: #{h['cluster_name']}" puts "\t uuid: #{h['cluster']}" puts "\t dns address:\t#{h['cluster_dns']}" end if h['boxes'] h['boxes'].each do |box| puts "\t box address:\t#{box['box']}" end end if h['routes'] and h['routes'] != '' puts "\n" puts "=== Internal Addressing:" h['routes'].each do |r| puts "\t Route: #{r['route'].split('-')[0]} -> #{r['route'].split('-')[1]}" end end puts "\n" end |
.ls ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/appfront/command/deploys.rb', line 98 def self.ls deploys = api.get "/flows" unless deploys.count == 0 puts '=== Batches:' puts deploys.each do |deploy| next if deploy['execution'] == 'persistent' chars = 30 - deploy['name'].chars.count output = "#{deploy['name']}" for i in 0..chars output = output + ' ' end output = output + "---> status: #{deploy['status']}" output = output + "\t Changed Status: ~ #{deploy['last_change']}h ago" puts output end puts puts '=== Services:' puts deploys.each do |deploy| next if deploy['execution'] == 'volatile' chars = 30 - deploy['name'].chars.count output = "#{deploy['name']}" for i in 0..chars output = output + ' ' end output = output + "---> status: #{deploy['status']}" output = output + "\t Changed Status: ~ #{deploy['last_change']}h ago" puts output end else puts '=== You have no deploys.' end puts "\n" end |
.rm(args, opts) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/appfront/command/deploys.rb', line 43 def self.rm(args, opts) find_deploy! opts spinner "Removing Deploy..." do api.delete "/flow/#{@deploy}" end puts "\n" end |
.test(args, opts) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/appfront/command/deploys.rb', line 28 def self.test(args, opts) spinner "Uploading Deploy YAML configuration to Jarvis..." do api.post "/flow2.yaml", file: args[0] end puts "\n" end |
.update(args, opts) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/appfront/command/deploys.rb', line 36 def self.update(args, opts) spinner "Updating Deploy YAML configuration to Jarvis..." do api.put "/flow.yaml", file: args[0] end puts "\n" end |
.yaml(opts) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/appfront/command/deploys.rb', line 3 def self.yaml(opts) find_deploy! opts spinner "Retrieving YAML configuration from Jarvis..." do @file = api.get "/flow/#{@deploy}/yaml" end puts "\nYAML file starts from here: \n\n" puts @file print "\n" end |