capistrano-fiesta 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/fiesta/editor.rb +1 -1
- data/lib/capistrano/fiesta/logger.rb +1 -0
- data/lib/capistrano/fiesta/report.rb +8 -24
- data/lib/capistrano/fiesta/version.rb +1 -1
- data/lib/capistrano/tasks/fiesta.rake +24 -13
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af830bd829413e7e61665a095eaa27523fd445a
|
4
|
+
data.tar.gz: e5bd5aae82e6a19fdf64c63223667b73bed5a107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff19be736c3ce0728dee1188527e47ba0e8d2d2917e1148983fe67dd7391fdba4a27627869e9748d292f29b6e8c1924d5fc403d37bdaa558447ae7abcd8e070
|
7
|
+
data.tar.gz: f32b823bcbb84862dafbb45e5d0eb6140d68271353cee33ff680286ad6d94cd6b854a36baef14adf0a954f6f40e42a0080c8c87de9ede390ed7d7a225363dcbf
|
@@ -13,32 +13,20 @@ module Capistrano
|
|
13
13
|
attr_accessor :chat_client
|
14
14
|
end
|
15
15
|
|
16
|
-
attr_reader :
|
17
|
-
|
18
|
-
def self.create(*args)
|
19
|
-
report = new(*args)
|
20
|
-
report.save
|
21
|
-
report
|
22
|
-
end
|
16
|
+
attr_reader :stories
|
23
17
|
|
24
18
|
def initialize(github_url, last_release: nil, comment: nil)
|
25
19
|
@github_url, @last_release, @comment = github_url, last_release, comment
|
26
|
-
|
27
|
-
|
28
|
-
def save
|
29
|
-
@announcement = editor.edit if stories.any?
|
30
|
-
end
|
31
|
-
|
32
|
-
def stories
|
33
|
-
@stories ||= merged_pull_requests.map { |pr| Story.new(pr) }
|
20
|
+
@stories = merged_pull_requests.map { |pr| Story.new(pr) }
|
34
21
|
end
|
35
22
|
|
36
23
|
def announce(channel: 'releases', **options)
|
37
|
-
|
38
|
-
|
39
|
-
chat.post(
|
40
|
-
|
41
|
-
|
24
|
+
text = editor.compose if stories.any?
|
25
|
+
return Logger.warn('Announcement blank, nothing posted to Slack') if text.nil? || text.empty?
|
26
|
+
chat.post options.merge(payload: { channel: channel, username: 'New Releases', icon_emoji: ':tada:', text: text })
|
27
|
+
text
|
28
|
+
rescue NameError => e
|
29
|
+
Logger.warn "Install Slackistrano to announce releases on Slack (#{e.message})"
|
42
30
|
end
|
43
31
|
|
44
32
|
def create_release(name = nil)
|
@@ -57,10 +45,6 @@ module Capistrano
|
|
57
45
|
Draft.new(comment: @comment, stories: stories)
|
58
46
|
end
|
59
47
|
|
60
|
-
def announcement?
|
61
|
-
announcement && !announcement.empty?
|
62
|
-
end
|
63
|
-
|
64
48
|
def merged_pull_requests
|
65
49
|
github.search_issues("base:master repo:#{repo} merged:>#{last_released_at}").items
|
66
50
|
rescue Octokit::UnprocessableEntity => e
|
@@ -1,27 +1,38 @@
|
|
1
1
|
namespace :fiesta do
|
2
|
-
desc '
|
3
|
-
task :
|
4
|
-
invoke 'fiesta:set_last_release'
|
2
|
+
desc 'Run a fiesta report'
|
3
|
+
task :run do
|
5
4
|
invoke 'fiesta:generate'
|
5
|
+
invoke 'fiesta:announce'
|
6
6
|
end
|
7
7
|
|
8
|
-
task :
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
set(:last_release, last_release)
|
8
|
+
task :generate do
|
9
|
+
run_locally do
|
10
|
+
set :fiesta_report, Capistrano::Fiesta::Report.new(repo_url, last_release: last_release, comment: fetch(:fiesta_comment))
|
11
|
+
info "Deploying #{report.stories.size} new story(ies)"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
|
-
task :
|
15
|
+
task :announce do
|
17
16
|
run_locally do
|
18
|
-
report = Capistrano::Fiesta::Report.create(repo_url, last_release: fetch(:last_release), comment: fetch(:fiesta_comment))
|
19
17
|
report.announce(slack)
|
20
|
-
report.create_release
|
18
|
+
report.create_release fetch(:release_timestamp) if fetch(:branch) == 'master'
|
21
19
|
Capistrano::Fiesta::Logger.logs.each { |log| warn log }
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
23
|
+
def report
|
24
|
+
fetch(:fiesta_report)
|
25
|
+
end
|
26
|
+
|
27
|
+
def last_release
|
28
|
+
last_release = nil
|
29
|
+
on roles(:web).first do
|
30
|
+
last_release_path = capture("readlink #{current_path}")
|
31
|
+
last_release = last_release_path.split('/').last
|
32
|
+
end
|
33
|
+
last_release
|
34
|
+
end
|
35
|
+
|
25
36
|
def slack
|
26
37
|
{
|
27
38
|
team: fetch(:slack_team),
|
@@ -33,5 +44,5 @@ namespace :fiesta do
|
|
33
44
|
end
|
34
45
|
end
|
35
46
|
|
36
|
-
before 'deploy:starting', 'fiesta:
|
37
|
-
after 'deploy:finished', 'fiesta:
|
47
|
+
before 'deploy:starting', 'fiesta:generate'
|
48
|
+
after 'deploy:finished', 'fiesta:announce'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-fiesta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -203,3 +203,4 @@ signing_key:
|
|
203
203
|
specification_version: 4
|
204
204
|
summary: Celebrate your releases!
|
205
205
|
test_files: []
|
206
|
+
has_rdoc:
|