slackistrano 0.0.9 → 0.0.10

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: f993b8e5fe8e067e6d10f0d44fc94c32da707c77
4
- data.tar.gz: fed2b59b5986b97e48813b5d15fb1ee974ab06db
3
+ metadata.gz: 77fb030d4c17bdbfeb3e78e56599a8b215051fb8
4
+ data.tar.gz: d018c24f3f57e5ea93238b521365ffa8dae4335e
5
5
  SHA512:
6
- metadata.gz: 909d367d8eb80514eb142e8d399513cdc0bb08a8e5451744d2b36b652d7963f2c118fa60a9e12857ec7760e2b13cade478ee919b55bcf34b77e489b4626e1bc4
7
- data.tar.gz: 7d461350212eb53435d455fc85d444bdb6cea56362d7ef988f61f8ef157240e055941c53d715faa7b82f02a5417e3da4924194c30e56a66689576362701632aa
6
+ metadata.gz: da0ed821356e1652997534cb478996c77b29941fcc4cc423254d896df0cfd0ba6d187ab04f1be0735907554ddba1e6a41a28bfe6811b5b6e89f426ae42d3544d
7
+ data.tar.gz: 4238ef5dfe93dfcb9b3ce83e1221b8f6943a93fc0334be74971aebf5b603d8ca8a51ca9cb60be635a9e28b796624023eee7fbb1a5fb3aed4dcc12f7b3689cab9
data/README.md CHANGED
@@ -67,7 +67,6 @@ you specified.
67
67
 
68
68
  ## TODO
69
69
 
70
- - Add tests.
71
70
  - Notify about incorrect configuration settings.
72
71
  - Notify about unsuccessfull HTTP POSTs.
73
72
 
data/Rakefile CHANGED
@@ -1,11 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- require 'rake/testtask'
4
- Rake::TestTask.new(:test) do |test|
5
- test.libs << 'lib'
6
- test.libs << 'test'
7
- test.pattern = 'test/**/test_*.rb'
8
- test.verbose = true
9
- end
10
-
11
- task :default => :test
3
+ task :default => :spec
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new
@@ -74,8 +74,8 @@ namespace :load do
74
74
  set :slack_run_starting, ->{ true } # Set to false to disable starting message.
75
75
  set :slack_run_finished, ->{ true } # Set to false to disable finished message.
76
76
  set :slack_run_failed, ->{ true } # Set to false to disable failure message.
77
- set :slack_msg_starting, ->{ "#{ENV['USER'] || ENV['USERNAME']} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}." }
78
- set :slack_msg_finished, ->{ "#{ENV['USER'] || ENV['USERNAME']} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}." }
79
- set :slack_msg_failed, ->{ "*ERROR!* #{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}." }
77
+ set :slack_msg_starting, ->{ "#{ENV['USER'] || ENV['USERNAME']} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
78
+ set :slack_msg_finished, ->{ "#{ENV['USER'] || ENV['USERNAME']} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
79
+ set :slack_msg_failed, ->{ "*ERROR!* #{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
80
80
  end
81
81
  end
@@ -1,3 +1,3 @@
1
1
  module Slackistrano
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
data/slackistrano.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
+ gem.add_dependency 'capistrano'
21
22
  gem.add_dependency 'json'
22
23
  gem.add_development_dependency 'rake'
24
+ gem.add_development_dependency 'rspec'
23
25
  end
@@ -0,0 +1,8 @@
1
+ namespace :deploy do
2
+ task :starting do
3
+ end
4
+ task :finished do
5
+ end
6
+ task :failed do
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'capistrano/all'
4
+ require 'capistrano/setup'
5
+ load 'capistrano_deploy_stubs.rake'
6
+ require 'slackistrano'
7
+ require 'rspec'
8
+
9
+ # Requires supporting files with custom matchers and macros, etc,
10
+ # in ./support/ and its subdirectories.
11
+ Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
12
+
13
+ RSpec.configure do |config|
14
+ config.treat_symbols_as_metadata_keys_with_true_values = true
15
+ config.order = 'random'
16
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Slackistrano do
4
+ before(:each) do
5
+ Rake::Task['load:defaults'].invoke
6
+ end
7
+
8
+ it "invokes slack:deploy:starting before deploy:starting" do
9
+ expect(Rake::Task['deploy:starting'].prerequisites).to include 'slack:deploy:starting'
10
+ end
11
+
12
+ it "invokes slack:deploy:finished after deploy:finished" do
13
+ set :slack_run_finished, ->{ true }
14
+ expect(Slackistrano).to receive :post
15
+ Rake::Task['deploy:finished'].execute
16
+ end
17
+
18
+ it "invokes slack:deploy:failed after deploy:failed" do
19
+ set :slack_run_failed, ->{ true }
20
+ expect(Slackistrano).to receive :post
21
+ Rake::Task['deploy:failed'].execute
22
+ end
23
+
24
+ %w[starting finished failed].each do |stage|
25
+
26
+ it "posts to slack on slack:deploy:#{stage}" do
27
+ set "slack_run_#{stage}".to_sym, ->{ true }
28
+ expect(Slackistrano).to receive :post
29
+ Rake::Task["slack:deploy:#{stage}"].execute
30
+ end
31
+
32
+ it "does not post to slack on slack:deploy:#{stage} when disabled" do
33
+ set "slack_run_#{stage}".to_sym, ->{ false }
34
+ expect(Slackistrano).not_to receive :post
35
+ Rake::Task["slack:deploy:#{stage}"].execute
36
+ end
37
+
38
+ it "calls Slackistrano.post with all the right arguments on slack:deploy:#{stage}" do
39
+ set "slack_run_#{stage}".to_sym, ->{ true }
40
+ set :slack_team, ->{ 'team' }
41
+ set :slack_token, ->{ 'token' }
42
+ set :slack_channel, ->{ 'channel' }
43
+ set :slack_icon_url, ->{ 'http://icon.url' }
44
+ set :slack_icon_emoji, ->{ ':emoji:' }
45
+ set "slack_msg_#{stage}".to_sym, ->{ 'text message' }
46
+ expect(Slackistrano).to receive(:post).with(
47
+ team: 'team',
48
+ token: 'token',
49
+ payload: {
50
+ channel: 'channel',
51
+ username: 'Slackistrano',
52
+ icon_url: 'http://icon.url',
53
+ icon_emoji: ':emoji:',
54
+ text: 'text message'
55
+ }
56
+ )
57
+ Rake::Task["slack:deploy:#{stage}"].execute
58
+ end
59
+ end # of stage loop
60
+
61
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hallstrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: json
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,20 @@ dependencies:
38
52
  - - '>='
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: ''
42
70
  email:
43
71
  - philip@supremegolf.com
@@ -55,6 +83,9 @@ files:
55
83
  - lib/slackistrano/tasks/slack.rake
56
84
  - lib/slackistrano/version.rb
57
85
  - slackistrano.gemspec
86
+ - spec/capistrano_deploy_stubs.rake
87
+ - spec/spec_helper.rb
88
+ - spec/tasks_spec.rb
58
89
  homepage: https://github.com/supremegolf/slackistrano
59
90
  licenses:
60
91
  - MIT
@@ -79,4 +110,7 @@ rubygems_version: 2.2.2
79
110
  signing_key:
80
111
  specification_version: 4
81
112
  summary: ''
82
- test_files: []
113
+ test_files:
114
+ - spec/capistrano_deploy_stubs.rake
115
+ - spec/spec_helper.rb
116
+ - spec/tasks_spec.rb