piculet 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -27,10 +27,10 @@ export AWS_ACCESS_KEY_ID='...'
27
27
  export AWS_SECRET_ACCESS_KEY='...'
28
28
  export AWS_REGION='ap-northeast-1'
29
29
  #export AWS_OWNER_ID='123456789012'
30
- piculet -e -o Groupfile
30
+ piculet -e -o Groupfile # export EC2 SecurityGroup
31
31
  vi Groupfile
32
32
  piculet -a --dry-run
33
- piculet -a
33
+ piculet -a # apply `Groupfile` to EC2 SecurityGroup
34
34
  ```
35
35
 
36
36
  ## Groupfile example
@@ -1,5 +1,5 @@
1
1
  module Piculet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
4
4
 
5
5
  Version = Piculet::VERSION
@@ -24,8 +24,8 @@ module Piculet
24
24
  end
25
25
  end
26
26
 
27
- def authorize(protocol, ports, *sources)
28
- log(:info, " authorize #{format_sources(sources)}", :green)
27
+ def authorize(protocol, ports, sources, opts = {})
28
+ log(:info, " authorize #{format_sources(sources)}", opts.fetch(:log_color, :green))
29
29
 
30
30
  unless @options.dry_run
31
31
  sources = normalize_sources(sources)
@@ -42,8 +42,8 @@ module Piculet
42
42
  end
43
43
  end
44
44
 
45
- def revoke(protocol, ports, *sources)
46
- log(:info, " revoke #{format_sources(sources)}", :green)
45
+ def revoke(protocol, ports, sources, opts = {})
46
+ log(:info, " revoke #{format_sources(sources)}", opts.fetch(:log_color, :green))
47
47
 
48
48
  unless @options.dry_run
49
49
  sources = normalize_sources(sources)
@@ -70,7 +70,7 @@ module Piculet
70
70
 
71
71
  unless sources.empty?
72
72
  log(:info, 'Create Permission', :cyan, "#{log_id} > #{protocol} #{port_range}")
73
- authorize(protocol, port_range, *sources)
73
+ authorize(protocol, port_range, sources, :log_color => :cyan)
74
74
  end
75
75
  end
76
76
 
@@ -31,11 +31,11 @@ module Piculet
31
31
  plus_ip_ranges, minus_ip_ranges, plus_groups, minus_groups = diff(dsl)
32
32
 
33
33
  unless (plus_ip_ranges + plus_groups).empty?
34
- @collection.authorize(protocol, port_range, *(plus_ip_ranges + plus_groups))
34
+ @collection.authorize(protocol, port_range, (plus_ip_ranges + plus_groups), :log_color => :green)
35
35
  end
36
36
 
37
37
  unless (minus_ip_ranges + minus_groups).empty?
38
- @collection.revoke(protocol, port_range, *(minus_ip_ranges + minus_groups))
38
+ @collection.revoke(protocol, port_range, (minus_ip_ranges + minus_groups), :log_color => :green)
39
39
  end
40
40
  end
41
41
 
@@ -45,7 +45,7 @@ module Piculet
45
45
  self_ip_ranges, self_groups = normalize_self_attrs
46
46
 
47
47
  unless (self_ip_ranges + self_groups).empty?
48
- @collection.revoke(protocol, port_range, *(self_ip_ranges + self_groups))
48
+ @collection.revoke(protocol, port_range, (self_ip_ranges + self_groups), :log_color => :red)
49
49
  end
50
50
  end
51
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piculet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-30 00:00:00.000000000 Z
12
+ date: 2013-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  segments:
138
138
  - 0
139
- hash: 998644499
139
+ hash: 1002261455
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: 998644499
148
+ hash: 1002261455
149
149
  requirements: []
150
150
  rubyforge_project:
151
151
  rubygems_version: 1.8.23