bukelatta 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/exe/bukelatta +45 -6
- data/lib/bukelatta/client.rb +1 -2
- data/lib/bukelatta/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c40b0ab6b5d26689801b483afa0d4c081c3b5f10
|
4
|
+
data.tar.gz: 5142c2e26e330691b9fb993df048cb3aac57b03d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc1214d98450bd85b67c84a787f4c39ae5741a5e264a3b30ae7e0085f551804fff9c6e2c8e373577e6b944a6a93a8deb9e163e464d9e18dcb3c5a18c0cd74bfe
|
7
|
+
data.tar.gz: 5c9fd3cbce80be309c4ab8656d17a061f5d445caae57e0dbf83f925546fe13607614460315857cb87c657046ae09e43dd2ce946e5f8c5c77f5dea7a76a4be65b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/exe/bukelatta
CHANGED
@@ -43,6 +43,7 @@ def parse_options(argv)
|
|
43
43
|
opt.on('' , '--dry-run') { options[:dry_run] = true }
|
44
44
|
opt.on('-e', '--export') { options[:mode] = :export }
|
45
45
|
opt.on('-o', '--output FILE') {|v| options[:output] = v }
|
46
|
+
opt.on('' , '--split') { options[:split] = :true }
|
46
47
|
opt.on('' , '--target REGEXP') {|v| options[:target] = Regexp.new(v) }
|
47
48
|
opt.on('' , '--no-color') { options[:color] = false }
|
48
49
|
opt.on('' , '--debug') { options[:debug] = true }
|
@@ -90,14 +91,52 @@ def main(argv)
|
|
90
91
|
exported = client.export
|
91
92
|
output = options[:output]
|
92
93
|
|
93
|
-
if
|
94
|
-
logger.info('
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
if options[:split]
|
95
|
+
logger.info('Export Bucket Policy')
|
96
|
+
|
97
|
+
output = DEFAULT_FILENAME if output == '-'
|
98
|
+
dir = File.dirname(output)
|
99
|
+
FileUtils.mkdir_p(dir)
|
100
|
+
requires = []
|
101
|
+
|
102
|
+
exported.each do |bucket_name, policy|
|
103
|
+
next unless policy
|
104
|
+
|
105
|
+
filename = "#{bucket_name}.policy"
|
106
|
+
requires << filename
|
107
|
+
policy_file = File.join(dir, filename)
|
108
|
+
|
109
|
+
logger.info(" write `#{policy_file}`")
|
110
|
+
|
111
|
+
dsl = Bukelatta::DSL.convert({bucket_name => policy}, options)
|
112
|
+
|
113
|
+
open(policy_file, 'wb') do |f|
|
114
|
+
f.puts MAGIC_COMMENT
|
115
|
+
f.puts dsl
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
logger.info(" write `#{output}`")
|
120
|
+
|
98
121
|
open(output, 'wb') do |f|
|
99
122
|
f.puts MAGIC_COMMENT
|
100
|
-
|
123
|
+
|
124
|
+
requires.each do |policy_file|
|
125
|
+
f.puts "require '#{policy_file}'"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
else
|
129
|
+
dsl = Bukelatta::DSL.convert(exported, options)
|
130
|
+
|
131
|
+
if output == '-'
|
132
|
+
logger.info('# Export Bucket Policy')
|
133
|
+
puts dsl
|
134
|
+
else
|
135
|
+
logger.info("Export Bucket Policy to `#{output}`")
|
136
|
+
open(output, 'wb') do |f|
|
137
|
+
f.puts MAGIC_COMMENT
|
138
|
+
f.puts dsl
|
139
|
+
end
|
101
140
|
end
|
102
141
|
end
|
103
142
|
when :apply
|
data/lib/bukelatta/client.rb
CHANGED
data/lib/bukelatta/version.rb
CHANGED