magellan-cli 0.2.15 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +8 -0
- data/bin/magellan-cli +4 -1
- data/lib/magellan/cli/http.rb +7 -4
- data/lib/magellan/cli/resources/base.rb +1 -1
- data/lib/magellan/cli/resources/team.rb +1 -1
- data/lib/magellan/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8144d5811aa9f01b91f6287eab3c849d4893dc9a
|
4
|
+
data.tar.gz: 8e5f176af5447629a9d0438e46b57cdbe0d90282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7065244060033b8c5d3413b143ee34e1f1ff87a3f3c250f09d4e1057123f0f00efcd719485866305565ecd433b66ca3f4e4db949fc05212ccbac2d4dbdc85b28
|
7
|
+
data.tar.gz: 4e10f24bb6a016bccacea6ae4af4c8f754efb4b40fe5f600b1c48f586579443f86db614d40381f9300bbf3fd6e6238111df02376e577a8e96a5fb50e3f1ea0fb
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/bin/magellan-cli
CHANGED
@@ -8,6 +8,9 @@ rescue Magellan::Cli::Error => e
|
|
8
8
|
$stderr.puts("\e[31m#{e.message}\e[0m")
|
9
9
|
exit(1)
|
10
10
|
rescue => e
|
11
|
-
|
11
|
+
verbose = ARGV.include?("-V") || ARGV.include?("--verbose")
|
12
|
+
msg = "\e[31m[#{e.class}] #{e.message}\e[0m"
|
13
|
+
msg << "\n " << e.backtrace.join("\n ") if verbose
|
14
|
+
$stderr.puts(msg)
|
12
15
|
exit(1)
|
13
16
|
end
|
data/lib/magellan/cli/http.rb
CHANGED
@@ -33,7 +33,9 @@ module Magellan
|
|
33
33
|
if obj and obj.is_a?(Hash) and obj["message"]
|
34
34
|
fatal(obj["message"])
|
35
35
|
else
|
36
|
-
|
36
|
+
msg = "HTTP Error: status=#{res.status}"
|
37
|
+
msg << "\n#{res.body}" if verbose?
|
38
|
+
error(msg)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -49,15 +51,16 @@ module Magellan
|
|
49
51
|
if params && !params.empty?
|
50
52
|
url << '?' << params.map{|k,v| "%s=%s" % [CGI.escape(k.to_s), CGI.escape(v.to_s)] }.join("&")
|
51
53
|
end
|
52
|
-
verbose("
|
54
|
+
verbose("GET #{url}")
|
53
55
|
# "Unknown key: max-age = 0" というメッセージを表示させないために$stderrを一時的に上書き
|
54
56
|
$stderr, bak = StringIO.new, $stderr
|
57
|
+
res = nil
|
55
58
|
begin
|
56
59
|
res = api.httpclient.get(url)
|
57
|
-
check_response(res)
|
58
60
|
ensure
|
59
61
|
$stderr = bak
|
60
62
|
end
|
63
|
+
check_response(res)
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
@@ -117,7 +120,7 @@ module Magellan
|
|
117
120
|
|
118
121
|
def process_res(api, http_method, rel_path, *args)
|
119
122
|
url = "#{api.base_url}#{rel_path}"
|
120
|
-
verbose("%s %s\n%s" % [http_method, url, args])
|
123
|
+
verbose("%s %s\n%s" % [http_method.to_s.upcase, url, args])
|
121
124
|
res = api.httpclient.send(http_method, url, *args)
|
122
125
|
check_response(res)
|
123
126
|
end
|
@@ -163,7 +163,7 @@ module Magellan
|
|
163
163
|
def self.inherited(klass)
|
164
164
|
base_name = klass.name.split(/::/).last
|
165
165
|
res_name = base_name.underscore
|
166
|
-
klass.module_eval
|
166
|
+
klass.module_eval(<<-EOM, __FILE__, __LINE__ + 1)
|
167
167
|
no_commands do
|
168
168
|
cattr_accessor :resource_name
|
169
169
|
cattr_accessor :resource_dependency
|
@@ -7,7 +7,7 @@ module Magellan
|
|
7
7
|
|
8
8
|
class Team < Base
|
9
9
|
self.resource_name = "magellan~auth~team"
|
10
|
-
self.resource_dependency = {
|
10
|
+
self.resource_dependency = { "organization" => Organization.parameter_name }
|
11
11
|
self.field_associations = {"organization_id" => {name: "organization", class: "Organization"} }
|
12
12
|
|
13
13
|
desc "create NAME ROLE", "create Team with NAME ROLE"
|
data/lib/magellan/cli/version.rb
CHANGED