automan 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +1,43 @@
1
1
  require 'automan/mixins/utils'
2
2
 
3
3
  describe Automan::Mixins::Utils do
4
- let(:s) { (Class.new { include Automan::Mixins::Utils }).new }
4
+ subject() { (Class.new { include Automan::Mixins::Utils }).new }
5
5
 
6
6
  it "adds String#underscore" do
7
- s = String.new
8
- s.should respond_to :underscore
7
+ expect(String.new).to respond_to :underscore
9
8
  end
10
9
 
11
10
  describe "String#underscore" do
12
11
  it "underscore's like a boss" do
13
- "Namespace".underscore.should eq "namespace"
14
- "OptionName".underscore.should eq "option_name"
15
- "Value".underscore.should eq "value"
12
+ expect("Namespace".underscore).to eq "namespace"
13
+ expect("OptionName".underscore).to eq "option_name"
14
+ expect("Value".underscore).to eq "value"
16
15
  end
17
16
  end
18
17
 
19
- it { s.should respond_to :region_from_az }
18
+ it { is_expected.to respond_to :region_from_az }
20
19
 
21
20
  it "returns az properly" do
22
- s.region_from_az("us-east-1a").should eq 'us-east-1'
23
- s.region_from_az("us-east-1b").should eq 'us-east-1'
24
- s.region_from_az("us-east-1c").should eq 'us-east-1'
25
- s.region_from_az("us-east-1d").should eq 'us-east-1'
26
- s.region_from_az("ap-northeast-1a").should eq 'ap-northeast-1'
27
- s.region_from_az("ap-northeast-1b").should eq 'ap-northeast-1'
28
- s.region_from_az("ap-northeast-1c").should eq 'ap-northeast-1'
29
- s.region_from_az("sa-east-1a").should eq 'sa-east-1'
30
- s.region_from_az("sa-east-1b").should eq 'sa-east-1'
31
- s.region_from_az("ap-southeast-1a").should eq 'ap-southeast-1'
32
- s.region_from_az("ap-southeast-1b").should eq 'ap-southeast-1'
33
- s.region_from_az("ap-southeast-2a").should eq 'ap-southeast-2'
34
- s.region_from_az("ap-southeast-2b").should eq 'ap-southeast-2'
35
- s.region_from_az("us-west-2a").should eq 'us-west-2'
36
- s.region_from_az("us-west-2b").should eq 'us-west-2'
37
- s.region_from_az("us-west-2c").should eq 'us-west-2'
38
- s.region_from_az("us-west-1a").should eq 'us-west-1'
39
- s.region_from_az("us-west-1c").should eq 'us-west-1'
40
- s.region_from_az("eu-west-1a").should eq 'eu-west-1'
41
- s.region_from_az("eu-west-1b").should eq 'eu-west-1'
42
- s.region_from_az("eu-west-1c").should eq 'eu-west-1'
21
+ expect(subject.region_from_az("us-east-1a")).to eq 'us-east-1'
22
+ expect(subject.region_from_az("us-east-1b")).to eq 'us-east-1'
23
+ expect(subject.region_from_az("us-east-1c")).to eq 'us-east-1'
24
+ expect(subject.region_from_az("us-east-1d")).to eq 'us-east-1'
25
+ expect(subject.region_from_az("ap-northeast-1a")).to eq 'ap-northeast-1'
26
+ expect(subject.region_from_az("ap-northeast-1b")).to eq 'ap-northeast-1'
27
+ expect(subject.region_from_az("ap-northeast-1c")).to eq 'ap-northeast-1'
28
+ expect(subject.region_from_az("sa-east-1a")).to eq 'sa-east-1'
29
+ expect(subject.region_from_az("sa-east-1b")).to eq 'sa-east-1'
30
+ expect(subject.region_from_az("ap-southeast-1a")).to eq 'ap-southeast-1'
31
+ expect(subject.region_from_az("ap-southeast-1b")).to eq 'ap-southeast-1'
32
+ expect(subject.region_from_az("ap-southeast-2a")).to eq 'ap-southeast-2'
33
+ expect(subject.region_from_az("ap-southeast-2b")).to eq 'ap-southeast-2'
34
+ expect(subject.region_from_az("us-west-2a")).to eq 'us-west-2'
35
+ expect(subject.region_from_az("us-west-2b")).to eq 'us-west-2'
36
+ expect(subject.region_from_az("us-west-2c")).to eq 'us-west-2'
37
+ expect(subject.region_from_az("us-west-1a")).to eq 'us-west-1'
38
+ expect(subject.region_from_az("us-west-1c")).to eq 'us-west-1'
39
+ expect(subject.region_from_az("eu-west-1a")).to eq 'eu-west-1'
40
+ expect(subject.region_from_az("eu-west-1b")).to eq 'eu-west-1'
41
+ expect(subject.region_from_az("eu-west-1c")).to eq 'eu-west-1'
43
42
  end
44
43
  end
@@ -4,35 +4,35 @@ require 'logger'
4
4
  ENV['MAX_SNAPSHOTS'] = "50"
5
5
 
6
6
  describe Automan::RDS::Snapshot do
7
- it { should respond_to :rds }
8
- it { should respond_to :create }
9
- it { should respond_to :delete }
10
- it { should respond_to :prune }
11
- it { should respond_to :latest }
12
- it { should respond_to :default_snapshot_name }
7
+ it { is_expected.to respond_to :rds }
8
+ it { is_expected.to respond_to :create }
9
+ it { is_expected.to respond_to :delete }
10
+ it { is_expected.to respond_to :prune }
11
+ it { is_expected.to respond_to :latest }
12
+ it { is_expected.to respond_to :default_snapshot_name }
13
13
 
14
14
  describe '#default_snapshot_name' do
15
- subject(:s) do
15
+ subject() do
16
16
  AWS.stub!
17
17
  s = Automan::RDS::Snapshot.new
18
18
  s.logger = Logger.new('/dev/null')
19
- s.stub(:db_environment).and_return('dev1')
19
+ allow(s).to receive(:db_environment).and_return('dev1')
20
20
  s
21
21
  end
22
22
 
23
23
  it "never returns nil" do
24
- s.default_snapshot_name('somedb').should_not be_nil
24
+ expect(subject.default_snapshot_name('somedb')).to_not be_nil
25
25
  end
26
26
 
27
27
  it "returns environment dash time string" do
28
- name = s.default_snapshot_name('somedb')
29
- name.should match /^dev1-(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})/
28
+ name = subject.default_snapshot_name('somedb')
29
+ expect(name).to match /^dev1-(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})/
30
30
  end
31
31
 
32
32
  end
33
33
 
34
34
  describe '#create' do
35
- subject(:s) do
35
+ subject() do
36
36
  AWS.stub!
37
37
  s = Automan::RDS::Snapshot.new
38
38
  s.logger = Logger.new('/dev/null')
@@ -40,56 +40,56 @@ describe Automan::RDS::Snapshot do
40
40
  end
41
41
 
42
42
  it "raises error if could not find database" do
43
- s.stub(:find_db).and_return(nil)
43
+ allow(subject).to receive(:find_db).and_return(nil)
44
44
  expect {
45
- s.create
45
+ subject.create
46
46
  }.to raise_error Automan::RDS::DatabaseDoesNotExistError
47
47
  end
48
48
 
49
49
  it "raises error if RDS says database does not exist" do
50
50
  db = double(:db)
51
- db.stub(:exists?).and_return(false)
52
- s.stub(:find_db).and_return(db)
51
+ allow(db).to receive(:exists?).and_return(false)
52
+ allow(subject).to receive(:find_db).and_return(db)
53
53
 
54
54
  expect {
55
- s.create
55
+ subject.create
56
56
  }.to raise_error Automan::RDS::DatabaseDoesNotExistError
57
57
  end
58
58
 
59
59
  end
60
60
 
61
61
  describe '#tagged_can_prune?' do
62
- subject(:s) do
62
+ subject() do
63
63
  AWS.stub!
64
64
  s = Automan::RDS::Snapshot.new
65
65
  s.logger = Logger.new('/dev/null')
66
- s.stub(:snapshot_arn)
66
+ allow(s).to receive(:snapshot_arn)
67
67
  s
68
68
  end
69
69
 
70
70
  it 'returns true if snapshot is tagged with CanPrune=yes' do
71
- s.stub(:tags).and_return( {'CanPrune' => 'yes'} )
72
- s.tagged_can_prune?( double() ).should be_true
71
+ allow(subject).to receive(:tags).and_return( {'CanPrune' => 'yes'} )
72
+ expect(subject.tagged_can_prune?( double() )).to be_truthy
73
73
  end
74
74
 
75
75
  it 'returns false if snapshot is missing CanPrune tag' do
76
- s.stub(:tags).and_return( {} )
77
- s.tagged_can_prune?( double() ).should be_false
76
+ allow(subject).to receive(:tags).and_return( {} )
77
+ expect(subject.tagged_can_prune?( double() )).to be_falsey
78
78
  end
79
79
 
80
80
  it 'returns false if snapshot is tagged with CanPrune=nil' do
81
- s.stub(:tags).and_return( {'CanPrune' => nil} )
82
- s.tagged_can_prune?( double() ).should be_false
81
+ allow(subject).to receive(:tags).and_return( {'CanPrune' => nil} )
82
+ expect(subject.tagged_can_prune?( double() )).to be_falsey
83
83
  end
84
84
 
85
85
  it 'returns false if snapshot is tagged with CanPrune=foo' do
86
- s.stub(:tags).and_return( {'CanPrune' => 'foo'} )
87
- s.tagged_can_prune?( double() ).should be_false
86
+ allow(subject).to receive(:tags).and_return( {'CanPrune' => 'foo'} )
87
+ expect(subject.tagged_can_prune?( double() )).to be_falsey
88
88
  end
89
89
  end
90
90
 
91
91
  describe '#available?' do
92
- subject(:s) do
92
+ subject() do
93
93
  AWS.stub!
94
94
  s = Automan::RDS::Snapshot.new
95
95
  s.logger = Logger.new('/dev/null')
@@ -97,21 +97,19 @@ describe Automan::RDS::Snapshot do
97
97
  end
98
98
 
99
99
  it 'returns true if status is "available"' do
100
- snap = double(:snap)
101
- snap.stub(:status).and_return('available')
102
- s.available?(snap).should be_true
100
+ snap = double(status: 'available')
101
+ expect(subject.available?(snap)).to be_truthy
103
102
  end
104
103
 
105
104
  it 'returns false if status is foo' do
106
- snap = double(:snap)
107
- snap.stub(:status).and_return('foo')
108
- s.available?(snap).should be_false
105
+ snap = double(status: 'foo')
106
+ expect(subject.available?(snap)).to be_falsey
109
107
  end
110
108
  end
111
109
 
112
110
  describe '#manual?' do
113
111
  let(:snap) { double }
114
- subject(:s) do
112
+ subject() do
115
113
  AWS.stub!
116
114
  s = Automan::RDS::Snapshot.new
117
115
  s.logger = Logger.new('/dev/null')
@@ -119,34 +117,34 @@ describe Automan::RDS::Snapshot do
119
117
  end
120
118
 
121
119
  it 'returns true if type is "manual"' do
122
- snap.stub(:snapshot_type).and_return('manual')
123
- s.manual?(snap).should be_true
120
+ allow(snap).to receive(:snapshot_type).and_return('manual')
121
+ expect(subject.manual?(snap)).to be_truthy
124
122
  end
125
123
 
126
124
  it 'returns false if type is foo' do
127
- snap.stub(:snapshot_type).and_return('foo')
128
- s.manual?(snap).should be_false
125
+ allow(snap).to receive(:snapshot_type).and_return('foo')
126
+ expect(subject.manual?(snap)).to be_falsey
129
127
  end
130
128
  end
131
129
 
132
130
  describe '#prunable_snapshots' do
133
131
  let(:snap) { double }
134
- subject(:s) do
132
+ subject() do
135
133
  AWS.stub!
136
134
  s = Automan::RDS::Snapshot.new
137
135
  s.logger = Logger.new('/dev/null')
138
- s.stub(:get_all_snapshots).and_return( [ snap ] )
136
+ allow(s).to receive(:get_all_snapshots).and_return( [ snap ] )
139
137
  s
140
138
  end
141
139
 
142
140
  it 'includes snapshots which can be pruned' do
143
- s.stub(:can_prune?).and_return(true)
144
- s.prunable_snapshots.should include(snap)
141
+ allow(subject).to receive(:can_prune?).and_return(true)
142
+ expect(subject.prunable_snapshots).to include(snap)
145
143
  end
146
144
 
147
145
  it 'excludes snapshots which should not be pruned' do
148
- s.stub(:can_prune?).and_return(false)
149
- s.prunable_snapshots.should_not include(snap)
146
+ allow(subject).to receive(:can_prune?).and_return(false)
147
+ expect(subject.prunable_snapshots).to_not include(snap)
150
148
  end
151
149
  end
152
150
  end
@@ -0,0 +1 @@
1
+ 2.2.2
@@ -2,11 +2,11 @@
2
2
  # To set template parameters, add the -p options
3
3
  # to the end of the stacker command:
4
4
  #
5
- # stacker launch -n <%= app_name %> -t <%= app_name %>.json --disable-rollback \
5
+ # stacker launch -n <%= @app_name %> -t <%= @app_name %>.json --disable-rollback \
6
6
  # -p VpcId:$VPC_ID \
7
7
  # SubnetId:$SUBNET_ID \
8
8
  # RemoteAccessSG:$REMOTE_ACCESS_SG \
9
9
  # KeyPairName:$KEYPAIR_NAME \
10
10
  # InstanceType:$INSTANCE_TYPE \
11
11
  # ImageId:$IMAGE_ID
12
- stacker launch -n <%= app_name %> -t <%= app_name %>.json --disable-rollback
12
+ stacker launch -n <%= @app_name %> -t <%= @app_name %>.json --disable-rollback
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automan
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Chalfant
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-10 00:00:00.000000000 Z
12
+ date: 2015-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -45,42 +45,42 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.12.2
48
+ version: '3'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.12.2
55
+ version: '3'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec-mocks
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.12.2
62
+ version: '3'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 2.12.2
69
+ version: '3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec-expectations
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 2.12.1
76
+ version: '3'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 2.12.1
83
+ version: '3'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: aws-sdk
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +166,8 @@ extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
168
  - ".gitignore"
169
- - ".rvmrc"
169
+ - ".ruby-gemset"
170
+ - ".ruby-version"
170
171
  - ".travis.yml"
171
172
  - Gemfile
172
173
  - LICENSE.txt
@@ -236,9 +237,10 @@ files:
236
237
  - templates/stacker/.env.example
237
238
  - templates/stacker/.gitignore
238
239
  - templates/stacker/.ruby-gemset.tt
240
+ - templates/stacker/.ruby-version
239
241
  - templates/stacker/Gemfile
240
242
  - templates/stacker/bin/%app_name%.tt
241
- - templates/stacker/bin/launch_%app_name%.sh
243
+ - templates/stacker/bin/launch_%app_name%.sh.tt
242
244
  homepage: ''
243
245
  licenses: []
244
246
  metadata: {}
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create use ruby-2.1.2@automan