capistrano-fiesta 1.0.1 → 1.1.0

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: 206b3d96f5d723a65054af6140203b71e9ed0f1a
4
- data.tar.gz: c833355aeb16cb88ecf619bea67cc610fe2f2c53
3
+ metadata.gz: ecec845a7285bc41b134999cceb95090623f2fe1
4
+ data.tar.gz: a24782784115a94194d7861543d959c50a06f3f3
5
5
  SHA512:
6
- metadata.gz: 7b3f88316dd55c209298b7fa38531e8f323756fdee6da88053a169072a780187cb44d545c559a966ea7f7deced6eef89bbe54345a5d16322843626b5a0e194c4
7
- data.tar.gz: 777207fcedb594c669fd69c58a96f8438b2b96b9c4a9658503ba99ac5427678a98665a9f037e9c5fae2c31a7f2d3127f12b5f2193e3becc90ca3a9b5105040e8
6
+ metadata.gz: 590a48205a81acf42956d2eba5cec3c414226633fe54be96319b30eae9d2f88615a165d6416d1c04b5926c0d884223bd99677a5ae9e59bada455d6d79209cbaa
7
+ data.tar.gz: daa8a49e565a56308f68b1e75e33ac2a1954f631f74e848bb061a1c5a27028877454778ea3f96987317818269bee76261c680cab315a7b6d6cf4382192e031dd
data/README.md CHANGED
@@ -24,7 +24,7 @@ The edited content will be posted to Slack:
24
24
  3. Require in the capfile or appropriate stage and configure the Slack channel:
25
25
 
26
26
  ```ruby
27
- require 'capybara-fiesta'
27
+ require 'capistrano-fiesta'
28
28
  set :fiesta_slack_channel, '#release'
29
29
  ```
30
30
  4. If you're using [hub](https://github.com/github/hub) or [pt-flow](https://github.com/balvig/pt-flow), your GitHub credentials should already be configured. Otherwise you can use the [ENV vars in Octokit](https://github.com/octokit/octokit.rb/blob/a98979107a4bf9741a05a1f751405f8a29f29b38/lib/octokit/default.rb#L42-L156) to configure GitHub access.
@@ -25,6 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 1.10"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "minitest"
28
+ spec.add_development_dependency "minitest-line"
29
+ spec.add_development_dependency "minitest-reporters"
28
30
  spec.add_development_dependency "multi_json"
29
31
  spec.add_development_dependency "pry"
30
32
  spec.add_development_dependency "webmock"
@@ -0,0 +1,40 @@
1
+ require "tempfile"
2
+
3
+ module Capistrano
4
+ module Fiesta
5
+ class Editor
6
+ def initialize(content)
7
+ @content = content
8
+ end
9
+
10
+ def open
11
+ create_temp_file
12
+ edit
13
+ read
14
+ end
15
+
16
+ private
17
+
18
+ def create_temp_file
19
+ file << @content
20
+ file.close
21
+ end
22
+
23
+ def edit
24
+ Kernel.system(ENV["EDITOR"] || "vi", file.path)
25
+ end
26
+
27
+ def read
28
+ file.open
29
+ file.unlink
30
+ file.read.each_line.map do |line|
31
+ line unless line.start_with?("\n") || line.start_with?("#")
32
+ end.compact.join
33
+ end
34
+
35
+ def file
36
+ @file ||= Tempfile.new(['fiesta', '.md'])
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,21 +1,23 @@
1
+ Encoding.default_internal = Encoding.default_external = 'utf-8'
2
+
1
3
  require "capistrano/fiesta/story"
4
+ require "capistrano/fiesta/editor"
2
5
  require "erb"
3
- require "tempfile"
4
6
  require "octokit"
5
7
  require "yaml"
6
8
 
7
9
  module Capistrano
8
10
  module Fiesta
9
11
  class Report
10
- attr_accessor :logs
12
+ attr_accessor :logs, :comment
11
13
 
12
- def initialize(github_url, last_release: Time.now)
13
- @github_url, @last_release = github_url, last_release
14
+ def initialize(github_url, last_release: nil, comment: nil)
15
+ @github_url, @last_release, @comment = github_url, last_release, comment
14
16
  @logs = []
15
17
  end
16
18
 
17
19
  def write
18
- open_in_editor if stories.any?
20
+ editor.open if stories.any?
19
21
  end
20
22
 
21
23
  def stories
@@ -24,17 +26,8 @@ module Capistrano
24
26
 
25
27
  private
26
28
 
27
- def open_in_editor
28
- file << draft
29
- file.close
30
- Kernel.system(ENV["EDITOR"] || "vi", file.path)
31
- file.open
32
- file.unlink
33
- file.read.force_encoding("utf-8")
34
- end
35
-
36
- def file
37
- @file ||= Tempfile.new(['fiesta', '.md'])
29
+ def editor
30
+ Editor.new(draft)
38
31
  end
39
32
 
40
33
  def draft
@@ -57,7 +50,7 @@ module Capistrano
57
50
  end
58
51
 
59
52
  def last_released_at
60
- Time.parse(@last_release + 'Z00:00').iso8601
53
+ Time.parse(@last_release + 'Z00:00').iso8601 if @last_release
61
54
  end
62
55
 
63
56
  def github
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Fiesta
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ namespace :fiesta do
17
17
  task :generate do
18
18
  run_locally do
19
19
  next warn 'Install Slackistrano to post Fiesta reports to Slack' unless defined?(Slackistrano)
20
- report = Capistrano::Fiesta::Report.new(repo_url, last_release: fetch(:last_release))
20
+ report = Capistrano::Fiesta::Report.new(repo_url, last_release: fetch(:last_release), comment: fetch(:fiesta_comment))
21
21
  result = report.write
22
22
 
23
23
  if result && !result.empty?
@@ -1,3 +1,7 @@
1
+ <% if comment -%>
2
+ # <%= comment %>
3
+
4
+ <% end -%>
1
5
  <% stories.sort_by(&:title).each do |story| -%>
2
6
  • <%= story.title %>
3
7
  <% story.images.each do |image| -%>
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.0.1
4
+ version: 1.1.0
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-10-23 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest-line
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-reporters
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: multi_json
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -141,6 +169,7 @@ files:
141
169
  - capistrano-fiesta.gemspec
142
170
  - lib/capistrano-fiesta.rb
143
171
  - lib/capistrano/fiesta.rb
172
+ - lib/capistrano/fiesta/editor.rb
144
173
  - lib/capistrano/fiesta/report.rb
145
174
  - lib/capistrano/fiesta/story.rb
146
175
  - lib/capistrano/fiesta/version.rb