simnos 0.1.0.beta1 → 0.1.0.beta2
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/lib/simnos/client.rb +3 -3
- data/lib/simnos/client_wrapper.rb +4 -0
- data/lib/simnos/converter.rb +4 -3
- data/lib/simnos/output_topic.erb +1 -1
- data/lib/simnos/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: 986bd0f7efbfb4dc0715210db758c6b4bdf2fe92
|
4
|
+
data.tar.gz: 5057aeb529648974b0117e1991ef5df5f67add66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce5fcea79fadc949daec896b80a79b746341bcbb1c68951ab0aa4189eb258a6e5338c348051654156b0a3ebcfcb2004c2c76b2444cd6747a65d55982344241e
|
7
|
+
data.tar.gz: f8d8a5a25ad03e9c972c634152a10ff49959790233278ce0bf29b6181f243d49ef642da09c4100f48b02915340725addc0dea54f48f8ae6aba33b1235fa61aef
|
data/lib/simnos/client.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'pp'
|
2
|
-
require 'awesome_print'
|
3
2
|
require 'simnos/client_wrapper'
|
4
3
|
require 'simnos/converter'
|
5
4
|
require 'simnos/dsl'
|
@@ -34,13 +33,14 @@ module Simnos
|
|
34
33
|
Simnos.logger.info("Exporting...#{@options[:dry_run] ? ' [dry-run]' : ''}")
|
35
34
|
|
36
35
|
topics_by_name = client.topics
|
36
|
+
region = client.region
|
37
37
|
|
38
38
|
path = Pathname.new(@filepath)
|
39
39
|
base_dir = path.parent
|
40
40
|
if @options[:split]
|
41
41
|
FileUtils.mkdir_p(base_dir)
|
42
42
|
topics_by_name.each do |name, aws|
|
43
|
-
Converter.new({name => aws}).convert do |dsl|
|
43
|
+
Converter.new({name => aws}, region).convert do |dsl|
|
44
44
|
sns_file = base_dir.join("#{name}.sns")
|
45
45
|
Simnos.logger.info("Export #{sns_file}")
|
46
46
|
open(sns_file, 'wb') do |f|
|
@@ -50,7 +50,7 @@ module Simnos
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
else
|
53
|
-
Converter.new(topics_by_name).convert do |dsl|
|
53
|
+
Converter.new(topics_by_name, region).convert do |dsl|
|
54
54
|
FileUtils.mkdir_p(base_dir)
|
55
55
|
Simnos.logger.info("Export #{path}")
|
56
56
|
open(path, 'wb') do |f|
|
data/lib/simnos/converter.rb
CHANGED
@@ -2,17 +2,18 @@ require 'erb'
|
|
2
2
|
|
3
3
|
module Simnos
|
4
4
|
class Converter
|
5
|
-
def initialize(topics_by_name)
|
5
|
+
def initialize(topics_by_name, region)
|
6
6
|
@topics_by_name = topics_by_name
|
7
|
+
@region = region
|
7
8
|
end
|
8
9
|
|
9
10
|
def convert
|
10
|
-
yield output_topic(@topics_by_name)
|
11
|
+
yield output_topic(@topics_by_name, @region)
|
11
12
|
end
|
12
13
|
|
13
14
|
private
|
14
15
|
|
15
|
-
def output_topic(topics_by_name)
|
16
|
+
def output_topic(topics_by_name, region)
|
16
17
|
path = Pathname.new(File.expand_path('../', __FILE__)).join('output_topic.erb')
|
17
18
|
ERB.new(path.read, nil, '-').result(binding)
|
18
19
|
end
|
data/lib/simnos/output_topic.erb
CHANGED
data/lib/simnos/version.rb
CHANGED