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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3402fbc5e7cc849553603e4e8dbd35e9eb090031
4
- data.tar.gz: 9cad7dd3f7e0b175b4e50655c7b65d9a4dbe5fc6
3
+ metadata.gz: 8144d5811aa9f01b91f6287eab3c849d4893dc9a
4
+ data.tar.gz: 8e5f176af5447629a9d0438e46b57cdbe0d90282
5
5
  SHA512:
6
- metadata.gz: f876cd2026ca3f75c00c54266a73ad0b5dae1dd583146edd6e117dffb6a0304e1431254bcb62518c102231178e0e80366a51fb734dd9d4c04846903dea0ccca3
7
- data.tar.gz: 14c6b7fe1145a865486f7be38ee09846c20423a9351e1bdbea82c434c4e256d6d8ff2934886c78fc7bd09649dc406231784bd6528eed9f0a3d138d1b4bfa11ff
6
+ metadata.gz: 7065244060033b8c5d3413b143ee34e1f1ff87a3f3c250f09d4e1057123f0f00efcd719485866305565ecd433b66ca3f4e4db949fc05212ccbac2d4dbdc85b28
7
+ data.tar.gz: 4e10f24bb6a016bccacea6ae4af4c8f754efb4b40fe5f600b1c48f586579443f86db614d40381f9300bbf3fd6e6238111df02376e577a8e96a5fb50e3f1ea0fb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- magellan-cli (0.2.15)
4
+ magellan-cli (0.2.16)
5
5
  activesupport (~> 4.1.4)
6
6
  httpclient (~> 2.5)
7
7
  nokogiri
data/Rakefile CHANGED
@@ -5,3 +5,11 @@ RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
7
 
8
+ module Bundler
9
+ class GemHelper
10
+ def version_tag
11
+ d = File.basename(File.dirname(__FILE__))
12
+ "#{d}/#{version}"
13
+ end
14
+ end
15
+ end
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
- $stderr.puts("\e[31m[#{e.class}] #{e.message}\e[0m\n " << e.backtrace.join("\n "))
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
@@ -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
- error("HTTP Error: status=#{res.status}: #{res.body}")
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("url: #{url}")
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 <<-EOM
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 = { Organization.parameter_name => Organization.parameter_name }
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"
@@ -1,5 +1,5 @@
1
1
  module Magellan
2
2
  module Cli
3
- VERSION = "0.2.15"
3
+ VERSION = "0.2.16"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magellan-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm2000