capistrano-flowdock 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/capistrano-flowdock.gemspec +2 -2
- data/lib/capistrano/flowdock.rb +19 -0
- data/lib/capistrano/flowdock/version.rb +1 -1
- data/lib/capistrano/tasks/flowdock.cap +13 -13
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3671e13d25179f5eae4e319b55c2aed74ca239e
|
4
|
+
data.tar.gz: 0dbb414ba178ac0eefc6fbeb211318e1c26b8308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc98cffa9eaae2a57ef624e463107380fd3458e51b71a552162d630b157e2b6c20096b7e8bcefdd6ec4d9cfaf0f45b48241ceefdc247ce996555359c4e7879f4
|
7
|
+
data.tar.gz: 63323508afaa1bbe30f0a6cd11cd60ba4ee4aac388a13d79d79c99bb1c0bef61f81d411eb3c1f792fa9543ac14cd47e81b64d27f917cf31630ab532cc8b17f8e
|
data/capistrano-flowdock.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "flowdock", "~> 0.
|
21
|
+
spec.add_runtime_dependency "flowdock", "~> 0.5.0"
|
22
22
|
spec.add_runtime_dependency "capistrano", "~> 3.0"
|
23
|
-
spec.add_runtime_dependency "
|
23
|
+
spec.add_runtime_dependency "rugged", "~> 0.19.0"
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
end
|
data/lib/capistrano/flowdock.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
require 'flowdock'
|
2
2
|
require 'digest/md5'
|
3
3
|
require 'cgi'
|
4
|
+
require 'rugged'
|
5
|
+
|
6
|
+
module Capistrano
|
7
|
+
module Flowdock
|
8
|
+
class << self
|
9
|
+
def commits_between(repository, before, after)
|
10
|
+
walker = Rugged::Walker.new(repository)
|
11
|
+
walker.push(after)
|
12
|
+
walker.hide(before)
|
13
|
+
walker.sorting Rugged::SORT_TOPO
|
14
|
+
walker.walk.to_a
|
15
|
+
end
|
16
|
+
|
17
|
+
def id_abbrev(id)
|
18
|
+
id[0...7]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
4
23
|
|
5
24
|
load File.expand_path('../tasks/flowdock.cap', __FILE__)
|
@@ -14,7 +14,7 @@ namespace :flowdock do
|
|
14
14
|
task :save_deployed_branch do
|
15
15
|
on roles(:all) do
|
16
16
|
begin
|
17
|
-
execute("echo '#{fetch(:
|
17
|
+
execute("echo '#{fetch(:flowdock_deploy_head_name)}' > #{current_path}/BRANCH")
|
18
18
|
rescue => e
|
19
19
|
puts "Flowdock: error in saving deployed branch information: #{e.to_s}"
|
20
20
|
end
|
@@ -24,10 +24,8 @@ namespace :flowdock do
|
|
24
24
|
task :set_flowdock_api do
|
25
25
|
set :flowdock_deploy_env, fetch(:stage, fetch(:rails_env, ENV["RAILS_ENV"] || "production"))
|
26
26
|
begin
|
27
|
-
|
28
|
-
|
29
|
-
set :repo, repo
|
30
|
-
config = Grit::Config.new(repo)
|
27
|
+
set :repo, Rugged::Repository.new(".")
|
28
|
+
set :flowdock_deploy_head_name, fetch(:repo).head.name.split("/", 3).last.chomp
|
31
29
|
rescue LoadError => e
|
32
30
|
puts "Flowdock: you need to have Grit gem installed: #{e.to_s}"
|
33
31
|
rescue => e
|
@@ -38,7 +36,7 @@ namespace :flowdock do
|
|
38
36
|
flows = Array(fetch(:flowdock_api_token)).map do |api_token|
|
39
37
|
Flowdock::Flow.new(:api_token => api_token,
|
40
38
|
:source => "Capistrano deployment", :project => fetch(:flowdock_project_name),
|
41
|
-
:from => {:name => config["user.name"], :address => config["user.email"]})
|
39
|
+
:from => {:name => fetch(:repo).config["user.name"], :address => fetch(:repo).config["user.email"]})
|
42
40
|
end
|
43
41
|
set :flowdock_api, flows
|
44
42
|
rescue => e
|
@@ -53,7 +51,7 @@ namespace :flowdock do
|
|
53
51
|
flow.push_to_team_inbox(:format => "html",
|
54
52
|
:subject => "#{fetch(:flowdock_project_name)} deployed with branch #{fetch(:branch)} on ##{fetch(:flowdock_deploy_env)}",
|
55
53
|
:content => notification_message,
|
56
|
-
:tags => ["deploy", "#{fetch(:flowdock_deploy_env)}"]
|
54
|
+
:tags => fetch(:flowdock_deploy_tags, ["deploy", "#{fetch(:flowdock_deploy_env)}"]))
|
57
55
|
end unless fetch('dry_run')
|
58
56
|
rescue => e
|
59
57
|
puts "Flowdock: error in sending notification to your flow: #{e.to_s}"
|
@@ -63,24 +61,26 @@ namespace :flowdock do
|
|
63
61
|
def notification_message
|
64
62
|
if fetch(:branch) == fetch(:current_branch)
|
65
63
|
message = "<p>The following changes were just deployed to #{fetch(:flowdock_deploy_env)}:</p>"
|
66
|
-
commits = fetch(:
|
67
|
-
fetch(:previous_revision), fetch(:current_revision)
|
68
|
-
|
64
|
+
commits = if fetch(:previous_revision)
|
65
|
+
Capistrano::Flowdock.commits_between(fetch(:repo), fetch(:previous_revision), fetch(:current_revision))
|
66
|
+
else
|
67
|
+
[]
|
68
|
+
end
|
69
69
|
|
70
70
|
unless commits.empty?
|
71
71
|
commits.each do |c|
|
72
72
|
short, long = c.message.split(/\n+/, 2)
|
73
|
-
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
|
73
|
+
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].to_s.downcase)}?s=30\" /></div>"
|
74
74
|
message << "<div style=\"padding-left: 35px;\">#{CGI.escapeHTML(short)}<br/>"
|
75
75
|
if long
|
76
76
|
long.gsub!(/\n/, '<br />')
|
77
77
|
message << '<p style="margin:5px 0px; padding: 0 5px; border-left: 3px solid #ccc">' + long + '</p>'
|
78
78
|
end
|
79
|
-
message << "<span style=\"font-size: 90%; color: #333\"><code>#{c.
|
79
|
+
message << "<span style=\"font-size: 90%; color: #333\"><code>#{Capistrano::Flowdock.id_abbrev(c.oid)}</code> <a href=\"mailto:#{CGI.escapeHTML(c.author[:email].to_s)}\">#{CGI.escapeHTML(c.author[:name].to_s)}</a> on #{c.time.strftime("%b %d, %H:%M")}</span></div></div>"
|
80
80
|
end
|
81
81
|
end
|
82
82
|
else
|
83
|
-
message = "Branch #{fetch(:
|
83
|
+
message = "Branch #{fetch(:flowdock_deploy_head_name)} was deployed to #{fetch(:flowdock_deploy_env)}. Previously deployed branch was #{fetch(:current_branch)}."
|
84
84
|
end
|
85
85
|
message
|
86
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-flowdock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ville Lautanala
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flowdock
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rugged
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.19.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.19.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.4.5
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Flowdock notifier for Capistrano
|