milc 0.1.0 → 0.1.1

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: 7c239037f0df6a192cac2c900393eb454f12fc73
4
- data.tar.gz: 82cb6fc05b307fcb1e84fc503262ffdae6762a01
3
+ metadata.gz: 5ff4faf628b2a56f8e278b8f7f2dcc266e2e08c1
4
+ data.tar.gz: 19d633cb4a2c227a13c2def2df6f28368be4de3f
5
5
  SHA512:
6
- metadata.gz: 2fe22d49727f450be4370099bc0756627e931e6475862d88e2faa0d0c7c90bffe930966c23d3f7083ae104c34fd846ece2da91ebc81e7a787fef37fbe9ec7fe2
7
- data.tar.gz: 10d7b3a2ba518e4dfd195de41101d546cd14988d4a06e273acf5b8036eee8bc30d7545571ea8fca10079f9f052148097eb8a285213804673b4d9b85ac474215b
6
+ metadata.gz: 3ab520669b91c498fd4ac6c24a0431bfa0a0e26f08708a4d774b33b525afadfc016f46adde48f46e358d6e4bf831778d8b52b0df7e713bd7cb82f4e066b53a54
7
+ data.tar.gz: 40296952ad7c1d003b3b1b3a01a1c63aae1d80c639d36ce717195be1c47c030cdcd62071db448f5a5f3012d8f2d7a98e041f8181960a2a09b248b2220a305676
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
1
+ --format Fuubar
2
2
  --color
data/Gemfile CHANGED
@@ -2,3 +2,11 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in milc.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem "pry"
8
+ gem "pry-byebug"
9
+ gem "pry-stack_explorer"
10
+ gem "simplecov"
11
+ gem "fuubar"
12
+ end
data/lib/milc/base.rb CHANGED
@@ -41,8 +41,7 @@ module Milc
41
41
  end
42
42
 
43
43
  attr_reader :config
44
- attr_reader :project, :nebula
45
- attr_reader :network_base, :region, :new_relic_license_key
44
+ attr_reader :project
46
45
 
47
46
  def dry_run
48
47
  Milc.dry_run
@@ -50,10 +49,6 @@ module Milc
50
49
 
51
50
  def load_config
52
51
  @project = config['PROJECT'] || ENV['PROJECT']
53
- @nebula = config['NEBULA'] || ENV['NEBULA']
54
- @network_base = config['NETWORK_BASE'] || ENV['NETWORK_BASE']
55
- @region =config['REGION'] || ENV['REGION']
56
- @new_relic_license_key = config['NEW_RELIC_LICENSE_KEY'] || ENV['NEW_RELIC_LICENSE_KEY']
57
52
  end
58
53
 
59
54
  def show_help_and_exit1
@@ -87,16 +82,18 @@ module Milc
87
82
  Milc.dry_run = !!options["n"]
88
83
  Milc.verbose = !!options["V"]
89
84
 
90
- show_help_and_exit1 unless options["c"]
91
-
92
- load_from_yaml(options["c"])
93
- load_options(options)
85
+ if options["c"]
86
+ load_from_yaml(options["c"])
87
+ load_options(options)
88
+ else
89
+ show_help_and_exit1
90
+ end
94
91
  end
95
92
 
96
93
  def run(args)
97
94
  setup(args)
98
95
  process
99
- exit 0
96
+ # exit 0
100
97
  end
101
98
 
102
99
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "milc/gcloud/compute"
4
4
 
5
+ require 'active_support/core_ext/array/wrap'
6
+
5
7
  module Milc
6
8
  module Gcloud
7
9
  module Compute
@@ -25,7 +27,7 @@ module Milc
25
27
  :sourceRanges => :source_ranges,
26
28
  :targetTags => :target_tags,
27
29
  }.each do |k1, k2|
28
- res[k2] = res[k1] ? res[k1].sort : nil
30
+ res[k2] = res[k1] ? Array.wrap(res[k1]).sort : nil
29
31
  end
30
32
  super(attrs, res)
31
33
  end
@@ -3,6 +3,7 @@
3
3
  require "milc/gcloud"
4
4
 
5
5
  require "yaml"
6
+ require "json"
6
7
 
7
8
  require 'active_support/core_ext/string/inflections'
8
9
 
@@ -16,14 +17,15 @@ module Milc
16
17
 
17
18
  def command_def_for(service, resource)
18
19
  c = command_defs
19
- s = c[service] or raise "service #{service.inspect} not found in #{commands.keys.join(', ')}"
20
- s[resource] or raise "resource #{resource.inspect} not found in #{s.keys.join(' ')} of #{service.inspect}"
20
+ s = c[service.to_s] or raise "service #{service.inspect} not found in #{c.keys.join(', ')}"
21
+ s[resource.to_s] or raise "resource #{resource.inspect} not found in #{s.keys.join(' ')} of #{service.inspect}"
21
22
  end
22
23
 
23
24
  def lookup(project, service, resource)
24
25
  Milc.logger.debug("=" * 100)
25
26
  Milc.logger.debug("project: #{project}, service: #{service}, resource: #{resource}")
26
-
27
+ service = service.to_s
28
+ resource = resource.to_s
27
29
  command_def = command_def_for(service, resource)
28
30
  result = new(project, service, resource, command_def['commands'])
29
31
  service_module = Milc::Gcloud.const_get(service.classify)
@@ -132,7 +134,7 @@ module Milc
132
134
  call_update(cmd_args, attrs, &block)
133
135
  end
134
136
 
135
- def delete(cmd_args, attrs, &block)
137
+ def delete(cmd_args, attrs = {}, &block)
136
138
  raise_if_invalid(:delete)
137
139
  name, args = *cmd_args.split(/\s+/, 2)
138
140
  r = find(name)
data/lib/milc/gcloud.rb CHANGED
@@ -13,8 +13,6 @@ module Milc
13
13
  autoload :Sql , 'milc/gcloud/sql'
14
14
  autoload :Dns , 'milc/gcloud/dns'
15
15
 
16
- autoload :UnsupportedCommandError, 'milc/gcloud/errors'
17
-
18
16
  class << self
19
17
  def backend
20
18
  @backend ||= Milc::Gcloud::Backend::GcloudCommand.new
data/lib/milc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Milc
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/milc.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
 
26
26
  spec.add_runtime_dependency "logger_pipe", "~> 0.2.0"
27
- spec.add_runtime_dependency "activesupport", "~> 4.2.0"
27
+ spec.add_runtime_dependency "activesupport", "~> 4.1.0"
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.8"
30
30
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.0
33
+ version: 4.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.0
40
+ version: 4.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +113,6 @@ files:
113
113
  - lib/milc/gcloud/compute/firewall_rules.rb
114
114
  - lib/milc/gcloud/compute/instances.rb
115
115
  - lib/milc/gcloud/compute/target_pools.rb
116
- - lib/milc/gcloud/errors.rb
117
116
  - lib/milc/gcloud/resource.rb
118
117
  - lib/milc/version.rb
119
118
  - milc.gemspec
@@ -1,10 +0,0 @@
1
- require "milc"
2
-
3
- module Milc
4
- module Gcloud
5
-
6
- class UnsupportedCommandError < StandardError
7
- end
8
-
9
- end
10
- end