simple_deploy 0.4.2 → 0.4.3

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/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.4.3:
2
+
3
+ * Gracefully exit if no notification settings
4
+ * Send info level notification starting message
5
+ * Set verify SSL to false
6
+
1
7
  ## v0.4.2:
2
8
 
3
9
  * Upgrade to stackster v0.2.9
@@ -16,16 +16,18 @@ module SimpleDeploy
16
16
  @logger.debug "Campfire subdomain '#{@subdomain}'."
17
17
  @logger.debug "Campfire room ids '#{@room_ids}'."
18
18
  @token = @config.notifications['campfire']['token']
19
- @campfire = Tinder::Campfire.new @subdomain, :token => @token
19
+ @campfire = Tinder::Campfire.new @subdomain, :token => @token,
20
+ :verify => true
20
21
  end
21
22
 
22
23
  def send(message)
24
+ @logger.info "Sending Campfire notifications."
23
25
  @room_ids.split(',').each do |room_id|
24
26
  @logger.debug "Sending notification to Campfire room #{room_id}."
25
27
  room = @campfire.find_room_by_id room_id.to_i
26
28
  room.speak message
27
29
  end
28
- @logger.debug "Campfire notifications complete."
30
+ @logger.info "Campfire notifications complete."
29
31
  end
30
32
 
31
33
  private
@@ -7,7 +7,7 @@ module SimpleDeploy
7
7
  @environment = args[:environment]
8
8
  @config = Config.new :logger => args[:logger]
9
9
  @logger = @config.logger
10
- @notifications = @config.notifications
10
+ @notifications = @config.notifications || {}
11
11
  end
12
12
 
13
13
  def send_deployment_complete_message
@@ -1,3 +1,3 @@
1
1
  module SimpleDeploy
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -21,7 +21,7 @@ describe SimpleDeploy do
21
21
  and_return @stack_mock
22
22
 
23
23
  Tinder::Campfire.should_receive(:new).
24
- with('subdom', :token => 'tkn').and_return @tinder_mock
24
+ with('subdom', :token => 'tkn', :verify=>true).and_return @tinder_mock
25
25
  @stack_mock.should_receive(:attributes).
26
26
  and_return( 'campfire_room_ids' => '1,2',
27
27
  'campfire_subdomain' => 'subdom' )
@@ -46,7 +46,9 @@ describe SimpleDeploy do
46
46
  with "Sending notification to Campfire room 1."
47
47
  @logger_mock.should_receive(:debug).
48
48
  with "Sending notification to Campfire room 2."
49
- @logger_mock.should_receive(:debug).
49
+ @logger_mock.should_receive(:info).
50
+ with "Sending Campfire notifications."
51
+ @logger_mock.should_receive(:info).
50
52
  with "Campfire notifications complete."
51
53
  room1_mock.should_receive(:speak).with :message => "heh you guys!"
52
54
  room2_mock.should_receive(:speak).with :message => "heh you guys!"
@@ -73,14 +75,16 @@ describe SimpleDeploy do
73
75
  and_return @stack_mock
74
76
 
75
77
  Tinder::Campfire.should_receive(:new).
76
- with(nil, :token => 'tkn').and_return @tinder_mock
78
+ with(nil, :token => 'tkn', :verify=>true).and_return @tinder_mock
77
79
  @stack_mock.should_receive(:attributes).
78
80
  and_return({})
79
81
  @logger_mock.should_receive(:debug).
80
82
  with "Campfire subdomain ''."
81
83
  @logger_mock.should_receive(:debug).
82
84
  with "Campfire room ids ''."
83
- @logger_mock.should_receive(:debug).
85
+ @logger_mock.should_receive(:info).
86
+ with "Sending Campfire notifications."
87
+ @logger_mock.should_receive(:info).
84
88
  with "Campfire notifications complete."
85
89
  @campfire = SimpleDeploy::Notifier::Campfire.new :stack_name => 'stack_name',
86
90
  :environment => 'test',
@@ -2,7 +2,63 @@ require 'spec_helper'
2
2
 
3
3
  describe SimpleDeploy do
4
4
 
5
- before do
5
+ describe "with valid settings" do
6
+ before do
7
+ @config_mock = mock 'config mock'
8
+ @logger_mock = mock 'logger mock'
9
+ SimpleDeploy::Config.should_receive(:new).
10
+ with(:logger => @logger_mock).
11
+ and_return @config_mock
12
+
13
+ @config_mock.should_receive(:notifications).
14
+ exactly(1).times.
15
+ and_return({ 'campfire' => 'settings' })
16
+ @config_mock.should_receive(:logger).
17
+ and_return @logger_mock
18
+ @notifier = SimpleDeploy::Notifier.new :stack_name => 'stack_name',
19
+ :environment => 'test',
20
+ :logger => @logger_mock
21
+ end
22
+
23
+ it "should include the github app & chef links if attributes present" do
24
+ stack_mock = mock 'stack'
25
+ campfire_mock = mock 'campfire mock'
26
+ environment_mock = mock 'environment mock'
27
+ @config_mock.should_receive(:environment).
28
+ with('test').
29
+ and_return environment_mock
30
+ Stackster::Stack.should_receive(:new).
31
+ with(:environment => 'test',
32
+ :name => 'stack_name',
33
+ :config => environment_mock,
34
+ :logger => @logger_mock).
35
+ and_return stack_mock
36
+ stack_mock.should_receive(:attributes).
37
+ and_return({ 'app_github_url' => 'http://github.com/user/app',
38
+ 'chef_repo_github_url' => 'http://github.com/user/chef_repo',
39
+ 'app' => 'appsha',
40
+ 'chef_repo' => 'chefsha' })
41
+ SimpleDeploy::Notifier::Campfire.should_receive(:new).
42
+ and_return campfire_mock
43
+ campfire_mock.should_receive(:send).
44
+ with "Deployment to stack_name complete. App: http://github.com/user/app/commit/appsha Chef: http://github.com/user/chef_repo/commit/chefsha"
45
+ @notifier.send_deployment_complete_message
46
+ end
47
+
48
+ it "should send a message to each listed notification endpoint" do
49
+ campfire_mock = mock 'campfire mock'
50
+ SimpleDeploy::Notifier::Campfire.should_receive(:new).
51
+ with(:environment => 'test',
52
+ :stack_name => 'stack_name',
53
+ :config => @config_mock).
54
+ and_return campfire_mock
55
+ campfire_mock.should_receive(:send).with 'heh you guys!'
56
+ @notifier.send 'heh you guys!'
57
+ end
58
+
59
+ end
60
+
61
+ it "should not blow up if the notification section is missing" do
6
62
  @config_mock = mock 'config mock'
7
63
  @logger_mock = mock 'logger mock'
8
64
  SimpleDeploy::Config.should_receive(:new).
@@ -10,47 +66,12 @@ describe SimpleDeploy do
10
66
  and_return @config_mock
11
67
 
12
68
  @config_mock.should_receive(:notifications).
13
- and_return({ 'campfire' => 'settings' })
69
+ and_return nil
14
70
  @config_mock.should_receive(:logger).
15
71
  and_return @logger_mock
16
72
  @notifier = SimpleDeploy::Notifier.new :stack_name => 'stack_name',
17
73
  :environment => 'test',
18
74
  :logger => @logger_mock
19
- end
20
-
21
- it "should include the github app & chef links if attributes present" do
22
- stack_mock = mock 'stack'
23
- campfire_mock = mock 'campfire mock'
24
- environment_mock = mock 'environment mock'
25
- @config_mock.should_receive(:environment).
26
- with('test').
27
- and_return environment_mock
28
- Stackster::Stack.should_receive(:new).
29
- with(:environment => 'test',
30
- :name => 'stack_name',
31
- :config => environment_mock,
32
- :logger => @logger_mock).
33
- and_return stack_mock
34
- stack_mock.should_receive(:attributes).
35
- and_return({ 'app_github_url' => 'http://github.com/user/app',
36
- 'chef_repo_github_url' => 'http://github.com/user/chef_repo',
37
- 'app' => 'appsha',
38
- 'chef_repo' => 'chefsha' })
39
- SimpleDeploy::Notifier::Campfire.should_receive(:new).
40
- and_return campfire_mock
41
- campfire_mock.should_receive(:send).
42
- with "Deployment to stack_name complete. App: http://github.com/user/app/commit/appsha Chef: http://github.com/user/chef_repo/commit/chefsha"
43
- @notifier.send_deployment_complete_message
44
- end
45
-
46
- it "should send a message to each listed notification endpoint" do
47
- campfire_mock = mock 'campfire mock'
48
- SimpleDeploy::Notifier::Campfire.should_receive(:new).
49
- with(:environment => 'test',
50
- :stack_name => 'stack_name',
51
- :config => @config_mock).
52
- and_return campfire_mock
53
- campfire_mock.should_receive(:send).with 'heh you guys!'
54
75
  @notifier.send 'heh you guys!'
55
76
  end
56
77
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70198996834040 !ruby/object:Gem::Requirement
16
+ requirement: &70228650698420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70198996834040
24
+ version_requirements: *70228650698420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano
27
- requirement: &70198996833380 !ruby/object:Gem::Requirement
27
+ requirement: &70228650695520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70198996833380
35
+ version_requirements: *70228650695520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: stackster
38
- requirement: &70198996832500 !ruby/object:Gem::Requirement
38
+ requirement: &70228650691060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.9
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70198996832500
46
+ version_requirements: *70228650691060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: tinder
49
- requirement: &70198996831580 !ruby/object:Gem::Requirement
49
+ requirement: &70228650690380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70198996831580
57
+ version_requirements: *70228650690380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: trollop
60
- requirement: &70198996830800 !ruby/object:Gem::Requirement
60
+ requirement: &70228650689780 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70198996830800
68
+ version_requirements: *70228650689780
69
69
  description: I am designed to deploy artifacts uploaded by Heirloom
70
70
  email:
71
71
  - brett@weav.net
@@ -130,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: 251250221653602721
133
+ hash: -675662084006794223
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  none: false
136
136
  requirements:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: 251250221653602721
142
+ hash: -675662084006794223
143
143
  requirements: []
144
144
  rubyforge_project: simple_deploy
145
145
  rubygems_version: 1.8.16