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 +4 -4
- data/.rspec +1 -1
- data/Gemfile +8 -0
- data/lib/milc/base.rb +8 -11
- data/lib/milc/gcloud/compute/firewall_rules.rb +3 -1
- data/lib/milc/gcloud/resource.rb +6 -4
- data/lib/milc/gcloud.rb +0 -2
- data/lib/milc/version.rb +1 -1
- data/milc.gemspec +1 -1
- metadata +3 -4
- data/lib/milc/gcloud/errors.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff4faf628b2a56f8e278b8f7f2dcc266e2e08c1
|
4
|
+
data.tar.gz: 19d633cb4a2c227a13c2def2df6f28368be4de3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab520669b91c498fd4ac6c24a0431bfa0a0e26f08708a4d774b33b525afadfc016f46adde48f46e358d6e4bf831778d8b52b0df7e713bd7cb82f4e066b53a54
|
7
|
+
data.tar.gz: 40296952ad7c1d003b3b1b3a01a1c63aae1d80c639d36ce717195be1c47c030cdcd62071db448f5a5f3012d8f2d7a98e041f8181960a2a09b248b2220a305676
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format
|
1
|
+
--format Fuubar
|
2
2
|
--color
|
data/Gemfile
CHANGED
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
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
data/lib/milc/gcloud/resource.rb
CHANGED
@@ -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 #{
|
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
data/lib/milc/version.rb
CHANGED
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.
|
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.
|
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.
|
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.
|
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
|