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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8569d071a7d622c8c77e09c37a2004c1b2dda7f3
4
- data.tar.gz: fc09af141ae0face70f402820bfde64239922b86
3
+ metadata.gz: 7af830bd829413e7e61665a095eaa27523fd445a
4
+ data.tar.gz: e5bd5aae82e6a19fdf64c63223667b73bed5a107
5
5
  SHA512:
6
- metadata.gz: ea945561cd5903e6873f09f674c791655ede9a14ec5605d93aee0076639c95806962b5c10e9bffef6d3cf15198364af5b7b652d2b306f0de36961b0bde7082cf
7
- data.tar.gz: 1b1a5981d4a29bb94adf3825e6d1a68c26f03fbcc3ad3264496f1b656b8298d5439f9c1646da7671b45c99f9dc1a79ec4d13c194468787181c197c2f175f4381
6
+ metadata.gz: aff19be736c3ce0728dee1188527e47ba0e8d2d2917e1148983fe67dd7391fdba4a27627869e9748d292f29b6e8c1924d5fc403d37bdaa558447ae7abcd8e070
7
+ data.tar.gz: f32b823bcbb84862dafbb45e5d0eb6140d68271353cee33ff680286ad6d94cd6b854a36baef14adf0a954f6f40e42a0080c8c87de9ede390ed7d7a225363dcbf
@@ -7,7 +7,7 @@ module Capistrano
7
7
  @content = content
8
8
  end
9
9
 
10
- def edit
10
+ def compose
11
11
  create_temp_file
12
12
  open
13
13
  read
@@ -5,6 +5,7 @@ module Capistrano
5
5
 
6
6
  def self.warn(message)
7
7
  @logs << "[FIESTA] #{message}"
8
+ nil
8
9
  end
9
10
 
10
11
  def self.logs
@@ -13,32 +13,20 @@ module Capistrano
13
13
  attr_accessor :chat_client
14
14
  end
15
15
 
16
- attr_reader :announcement
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
- end
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
- return Logger.warn 'Announcement blank, nothing posted to Slack' unless announcement?
38
- options[:payload] = { channel: channel, username: 'New Releases', icon_emoji: ':tada:', text: announcement }
39
- chat.post(options)
40
- rescue NameError
41
- Logger.warn "Install Slackistrano to announce releases on Slack"
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,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Fiesta
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
@@ -1,27 +1,38 @@
1
1
  namespace :fiesta do
2
- desc 'Generate a release report and post it on Slack'
3
- task :report do
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 :set_last_release do
9
- on roles(:web).first do
10
- last_release_path = capture("readlink #{current_path}")
11
- last_release = last_release_path.split('/').last
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 :generate do
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(fetch(:release_name)) if fetch(:branch) == 'master'
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:set_last_release'
37
- after 'deploy:finished', 'fiesta:generate'
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.0
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: 2015-11-13 00:00:00.000000000 Z
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: