simnos 0.1.0.beta1 → 0.1.0.beta2

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: 6c2ee190f061194db5326da7059b8a52b77e1a8c
4
- data.tar.gz: a28cb166a667a8aa6261577ec575446fe8142746
3
+ metadata.gz: 986bd0f7efbfb4dc0715210db758c6b4bdf2fe92
4
+ data.tar.gz: 5057aeb529648974b0117e1991ef5df5f67add66
5
5
  SHA512:
6
- metadata.gz: a9a4042a549f22438ca66fa6c7bd5a13d9ac3f5b68a453865115b4ec72d531176cfa9d0e0e8f0695f8a4efc3804b9a461f80eb067ef4decc334570eda156a6f8
7
- data.tar.gz: aa3f79e4d68983a057e0f40de5df2c5368d016dd51daf9f9c71344e6c579b66c7c8d240851775811789e3c89a97187e862dec519d3f2094ed711211620f2bd63
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|
@@ -40,6 +40,10 @@ module Simnos
40
40
  results
41
41
  end
42
42
 
43
+ def region
44
+ @client.config.region
45
+ end
46
+
43
47
  private
44
48
 
45
49
  def topic_name(topic)
@@ -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
@@ -1,4 +1,4 @@
1
- sns do
1
+ sns <%= region.inspect %> do
2
2
  <%- topics_by_name.each do |name, topic| -%>
3
3
  topic <%= name.inspect %> do
4
4
  display_name <%= topic[:attrs].attributes['DisplayName'].inspect %>
@@ -1,3 +1,3 @@
1
1
  module Simnos
2
- VERSION = "0.1.0.beta1"
2
+ VERSION = "0.1.0.beta2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simnos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta1
4
+ version: 0.1.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - wata