magellan-cli 0.7.5 → 0.7.6
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/lib/magellan/cli/base.rb +6 -0
- data/lib/magellan/cli/http.rb +1 -4
- data/lib/magellan/cli/resources/base.rb +15 -0
- data/lib/magellan/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a2518f311bac8449c9a2deb205ace8b022ab89
|
4
|
+
data.tar.gz: ddb7b05fa8d5e68601e5aa36d3646a29fbc2727f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f7923f9c7810cd2a759b360ba34e0766c5a20cbced5ca1398f6f0a8ceff4d46dc3453e64d547da0ea78f2bca622c04112d75513f42e0f3d33ddc8748eb64e6
|
7
|
+
data.tar.gz: 931bac737533317d2278d247a085257e6c8a6c13b9a09732569932c7978ae6980b9827917b77d139dcfd31f04d472f3de3e5d347b8ebd0c119794ac51e6e93e9
|
data/Gemfile.lock
CHANGED
data/lib/magellan/cli/base.rb
CHANGED
data/lib/magellan/cli/http.rb
CHANGED
@@ -194,6 +194,18 @@ module Magellan
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
+
def process_error_response(res)
|
198
|
+
obj = JSON.parse(res.body) rescue nil
|
199
|
+
if obj and obj.is_a?(Hash) and msg = obj["message"]
|
200
|
+
res_name = self.class.name.split(/::/).last.underscore
|
201
|
+
msg.gsub!(/#{Regexp.escape(self.class.model_class_name)}/, res_name)
|
202
|
+
if msg =~ /\A#{Regexp.escape(res_name)}/
|
203
|
+
msg = "The #{msg}"
|
204
|
+
end
|
205
|
+
fatal(msg)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
197
209
|
def self.inherited(klass)
|
198
210
|
base_name = klass.name.split(/::/).last
|
199
211
|
res_name = Magellan::Cli::Resources::MAPPING[base_name] or raise "resource not found for #{base_name}"
|
@@ -219,6 +231,9 @@ module Magellan
|
|
219
231
|
def parameter_name
|
220
232
|
self.class.parameter_name
|
221
233
|
end
|
234
|
+
def self.model_class_name
|
235
|
+
resource_key.split(/~/).map(&:camelize).join('::')
|
236
|
+
end
|
222
237
|
end
|
223
238
|
|
224
239
|
desc "list", "#{I18n.t(:list, scope: [:resources, :common, :cmd], res_names: res_name.pluralize)}"
|
data/lib/magellan/cli/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm2000
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|