flowdock 0.1.1 → 0.1.2
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/.gitignore +1 -0
- data/Gemfile +2 -0
- data/lib/flowdock/capistrano.rb +11 -5
- data/lib/flowdock/version.rb +1 -1
- data/spec/flowdock_spec.rb +5 -3
- metadata +5 -6
- data/Gemfile.lock +0 -33
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/lib/flowdock/capistrano.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
require 'flowdock'
|
2
2
|
require 'grit'
|
3
|
+
require 'digest/md5'
|
4
|
+
require 'cgi'
|
3
5
|
|
4
6
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
7
|
set :flowdock_send_notification, false
|
8
|
+
|
9
|
+
set(:current_branch) do
|
10
|
+
capture("cat #{current_path}/BRANCH").chomp rescue "master"
|
11
|
+
end
|
6
12
|
|
7
13
|
namespace :flowdock do
|
8
14
|
task :set_flowdock_api do
|
15
|
+
set :rails_env, (!stage.nil?) ? stage : ENV['RAILS_ENV']
|
9
16
|
set :repo, Grit::Repo.new(".")
|
10
17
|
config = Grit::Config.new(repo)
|
11
18
|
set :flowdock_api, Flowdock::Flow.new(:api_token => flowdock_api_token,
|
@@ -27,14 +34,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
27
34
|
|
28
35
|
def notification_message
|
29
36
|
if branch == current_branch || stage == :production
|
30
|
-
message = "<p>The following changes were just deployed to #{
|
31
|
-
commits = repo.commits_between(
|
37
|
+
message = "<p>The following changes were just deployed to #{rails_env}:</p>"
|
38
|
+
commits = repo.commits_between(previous_revision, current_revision).reverse
|
32
39
|
|
33
40
|
unless commits.empty?
|
34
41
|
commits.each do |c|
|
35
42
|
short, long = c.message.split(/\n+/, 2)
|
36
|
-
|
37
|
-
message << "\n<div style=\"margin-bottom: 10px\"><div style=\"height:30px;width:30px;float:left;margin-right:5px;\"><img src=\"http://gravatar.com/avatar/#{MD5::md5(c.author.email.downcase)}?s=30\" /></div>"
|
43
|
+
message << "\n<div style=\"margin-bottom: 10px\"><div style=\"height:30px;width:30px;float:left;margin-right:5px;\"><img src=\"https://secure.gravatar.com/avatar/#{Digest::MD5::hexdigest(c.author.email.downcase)}?s=30\" /></div>"
|
38
44
|
message << "<div style=\"padding-left: 35px;\">#{CGI.escapeHTML(short)}<br/>"
|
39
45
|
if long
|
40
46
|
long.gsub!(/\n/, '<br />')
|
@@ -44,7 +50,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
44
50
|
end
|
45
51
|
end
|
46
52
|
else
|
47
|
-
message = "Branch #{source.head} was deployed to #{
|
53
|
+
message = "Branch #{source.head} was deployed to #{rails_env}. Previously deployed branch was #{current_branch}."
|
48
54
|
end
|
49
55
|
message
|
50
56
|
end
|
data/lib/flowdock/version.rb
CHANGED
data/spec/flowdock_spec.rb
CHANGED
@@ -85,11 +85,13 @@ describe Flowdock do
|
|
85
85
|
:from_address => "eric@example.com",
|
86
86
|
:subject => "Hello World",
|
87
87
|
:content => @example_content,
|
88
|
-
:tags => "cool,stuff"
|
88
|
+
:tags => "cool,stuff",
|
89
|
+
:link => "http://www.flowdock.com/"
|
89
90
|
}).
|
90
91
|
to_return(:body => "", :status => 200)
|
91
92
|
|
92
|
-
@flow.send_message(:subject => "Hello World", :content => @example_content,
|
93
|
+
@flow.send_message(:subject => "Hello World", :content => @example_content,
|
94
|
+
:tags => ["cool", "stuff"], :link => "http://www.flowdock.com/").should be_true
|
93
95
|
}.should_not raise_error
|
94
96
|
end
|
95
97
|
|
@@ -104,7 +106,7 @@ describe Flowdock do
|
|
104
106
|
:from_address => "invalid@nodeta.fi",
|
105
107
|
:subject => "Hello World",
|
106
108
|
:content => @example_content,
|
107
|
-
:tags => "cool,stuff"
|
109
|
+
:tags => "cool,stuff",
|
108
110
|
}).
|
109
111
|
to_return(:body => "", :status => 200)
|
110
112
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowdock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- anttipitkanen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|
@@ -76,7 +76,6 @@ files:
|
|
76
76
|
- .gitignore
|
77
77
|
- .rspec
|
78
78
|
- Gemfile
|
79
|
-
- Gemfile.lock
|
80
79
|
- MIT-LICENSE
|
81
80
|
- README
|
82
81
|
- Rakefile
|
@@ -115,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
114
|
requirements: []
|
116
115
|
|
117
116
|
rubyforge_project: flowdock
|
118
|
-
rubygems_version: 1.8.
|
117
|
+
rubygems_version: 1.8.10
|
119
118
|
signing_key:
|
120
119
|
specification_version: 3
|
121
120
|
summary: Ruby Gem for using Flowdock's API.
|
data/Gemfile.lock
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
flowdock (0.1.0)
|
5
|
-
httparty (~> 0.7.8)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.2.4)
|
11
|
-
crack (0.1.8)
|
12
|
-
diff-lcs (1.1.2)
|
13
|
-
httparty (0.7.8)
|
14
|
-
crack (= 0.1.8)
|
15
|
-
rspec (2.6.0)
|
16
|
-
rspec-core (~> 2.6.0)
|
17
|
-
rspec-expectations (~> 2.6.0)
|
18
|
-
rspec-mocks (~> 2.6.0)
|
19
|
-
rspec-core (2.6.4)
|
20
|
-
rspec-expectations (2.6.0)
|
21
|
-
diff-lcs (~> 1.1.2)
|
22
|
-
rspec-mocks (2.6.0)
|
23
|
-
webmock (1.6.2)
|
24
|
-
addressable (>= 2.2.2)
|
25
|
-
crack (>= 0.1.7)
|
26
|
-
|
27
|
-
PLATFORMS
|
28
|
-
ruby
|
29
|
-
|
30
|
-
DEPENDENCIES
|
31
|
-
flowdock!
|
32
|
-
rspec
|
33
|
-
webmock (~> 1.6.0)
|