magellan-cli 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d829f5340c9e4797b529be715f0ffd9bc62b44f
4
- data.tar.gz: 8ebfa269282db8303e14a8c9f2ee39e00f28f225
3
+ metadata.gz: 81d4181816437b398636b67acff42a17e42c7612
4
+ data.tar.gz: 3cb4698e4a1d55bcdeb0559514e6e26c24b073e3
5
5
  SHA512:
6
- metadata.gz: 5666f010b538f0c87573b7a40f0cbc7995d6a6671d21e3470e4c269ed1c04961a38d01d8b250fa6bdde5f6fb4e98b8a1ff6330ae863bf795fdbad65b288c6cb6
7
- data.tar.gz: 7c19bbe98bab15456a866c1e72c25e5adad073771ac878903255bca39435370071f8c2412b8b98a24ce14387c74e9b5eaa90d3022c647354fcebbc6ddd4fa287
6
+ metadata.gz: 19759caaf922e87d3a05f047c5ab79fa51a007d64091ab499c763f15b10f08f9fa32b9db3e41b684b12579bbaa57a966a18e01c32f5a27cb47155a3e017a93a7
7
+ data.tar.gz: 293f9e67ef749634533897c7562aef3a2f3fb3a439ad0627d232ff588256a41ddd8408cc3a1f5f868a3f14d2a5d492a4f7347ecc516e95830baa17450a466d07
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- magellan-cli (0.2.11)
4
+ magellan-cli (0.2.12)
5
5
  activesupport (~> 4.1.4)
6
6
  httpclient
7
7
  nokogiri
@@ -38,8 +38,11 @@ module Magellan
38
38
  def success(msg)
39
39
  $stderr.puts("\e[32m#{msg}\e[0m")
40
40
  end
41
-
42
41
  def error(msg)
42
+ $stderr.puts("\e[31m#{msg}\e[0m")
43
+ end
44
+
45
+ def fatal(msg)
43
46
  verbose(caller.join("\n "))
44
47
  raise Cli::Error, msg
45
48
  end
@@ -6,7 +6,6 @@ require 'active_support/core_ext/string/inflections'
6
6
  module Magellan
7
7
  module Cli
8
8
  class Command < Base
9
-
10
9
  {
11
10
  "organization" => "Organization",
12
11
  "team" => "Team",
@@ -36,6 +35,11 @@ module Magellan
36
35
 
37
36
  Magellan::Cli::Http.new.login!(email, password)
38
37
  end
38
+
39
+ desc "version", "show version"
40
+ def version
41
+ $stdout.puts Magellan::Cli::VERSION
42
+ end
39
43
  end
40
44
  end
41
45
  end
@@ -31,7 +31,7 @@ module Magellan
31
31
  else
32
32
  obj = JSON.parse(res.body) rescue nil
33
33
  if obj and obj.is_a?(Hash) and obj["message"]
34
- error(obj["message"])
34
+ fatal(obj["message"])
35
35
  else
36
36
  error("HTTP Error: status=#{res.status}: #{res.body}")
37
37
  end
@@ -31,7 +31,7 @@ module Magellan
31
31
  # @param [Hash] options オプション
32
32
  # @option options [String] :api_version APIのバージョン。デフォルトは "1.0.0"
33
33
  def initialize(base_url_or_host = nil, options = {})
34
- base_url_or_host ||= (ENV["MAGELLAN_SITE"] || "http://localhost:3000/")
34
+ base_url_or_host ||= (ENV["MAGELLAN_SITE"] || "https://api-asia.magellanic-clouds.com")
35
35
  if base_url_or_host =~ URI.regexp
36
36
  @base_url = base_url_or_host.sub(/\/\Z/, '')
37
37
  uri = URI.parse(@base_url)
@@ -24,6 +24,7 @@ module Magellan
24
24
  }
25
25
  }
26
26
  post_json("/admin/#{resource_name}/new.json", params)
27
+ select(version)
27
28
  end
28
29
  end
29
30
 
@@ -20,6 +20,7 @@ module Magellan
20
20
  }
21
21
  }
22
22
  post_json("/admin/#{resource_name}/new.json", params)
23
+ select(name)
23
24
  end
24
25
 
25
26
  desc "delete ID", "delete CloudSQL Database"
@@ -17,6 +17,7 @@ module Magellan
17
17
  }
18
18
  }
19
19
  post_json("/admin/#{self.resource_name}/new.json", params)
20
+ select(name)
20
21
  end
21
22
  end
22
23
 
@@ -28,6 +28,7 @@ module Magellan
28
28
  }
29
29
  }
30
30
  post_json("/admin/#{resource_name}/new.json", params)
31
+ select(name)
31
32
  end
32
33
  end
33
34
 
@@ -28,6 +28,7 @@ module Magellan
28
28
  }
29
29
  }
30
30
  post_json("/admin/#{resource_name}/new.json", params)
31
+ select(name)
31
32
  end
32
33
 
33
34
  desc "select NAME", "select Stage named by NAME"
@@ -106,8 +107,8 @@ module Magellan
106
107
  def release_now
107
108
  spacer = "\r" << (" " * 20)
108
109
  print "\rrelease starting"
109
- s = load_selection("stage")
110
- id = s["id"]
110
+ stage = load_selection("stage")
111
+ id = stage["id"]
111
112
  res0 = post_json("/admin/stage~title/#{id}/simple_method_call.json", {method_name: "release_now"})
112
113
  res1 = res0["result"]
113
114
  if res1
@@ -140,6 +141,7 @@ module Magellan
140
141
  when "completed"
141
142
  print spacer
142
143
  puts "\r#{st}"
144
+ reload
143
145
  return
144
146
  when "aborted" then
145
147
  print spacer
@@ -173,6 +175,19 @@ module Magellan
173
175
  i = load_selection("container_image")
174
176
  post_json("/admin/stage~version/#{v["id"]}/set_container_num.json", { container_num: num, container_image_id: i["id"] })
175
177
  end
178
+
179
+ desc "reload", "reload last selections"
180
+ def reload
181
+ s = load_selection("stage")
182
+ select(s["name"])
183
+ [Worker, Image, Container].each do |klass|
184
+ s = (load_selections || {})[klass.parameter_name]
185
+ next unless s
186
+ name = s["name"]
187
+ next unless name
188
+ klass.new.select(name)
189
+ end
190
+ end
176
191
  end
177
192
 
178
193
  end
@@ -24,6 +24,7 @@ module Magellan
24
24
  }
25
25
  }
26
26
  post_json("/admin/#{self.resource_name}/new.json", params)
27
+ select(name)
27
28
  end
28
29
 
29
30
  =begin
@@ -20,6 +20,7 @@ module Magellan
20
20
  }
21
21
  }
22
22
  post_json("/admin/#{self.resource_name}/new.json", params)
23
+ select(name)
23
24
  end
24
25
 
25
26
  end
@@ -31,6 +31,7 @@ module Magellan
31
31
  }.update(attrs)
32
32
  }
33
33
  post_json("/admin/#{self.resource_name}/new.json", params)
34
+ select(name)
34
35
  end
35
36
 
36
37
  desc "update ATTRIBUTE", "update selected worker with ATTRIBUTE(filename or JSON)"
@@ -1,5 +1,5 @@
1
1
  module Magellan
2
2
  module Cli
3
- VERSION = "0.2.11"
3
+ VERSION = "0.2.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magellan-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm2000
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient