release-notes 1.2.1 → 1.3.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
  SHA256:
3
- metadata.gz: 927c3987045d64e0a0bd179376ed415844bdc1b3d1ab6947a962b5cb2e5acc1f
4
- data.tar.gz: db8477ceb4025f41d6bb75419ecedc7fe895fc81e0b358698d324c0ecd2c97e4
3
+ metadata.gz: 11a25ad25c53aea05501c671b7d7e6b56be58408733ffda7537f727682bc4997
4
+ data.tar.gz: 64cf10fe71b5486a1f8084c1b735cfa539cf709d1f75c98d6dca55bf88181f05
5
5
  SHA512:
6
- metadata.gz: a39fdcd2f66ed6adbc6cd70b9ad40c3d06eef3a7599ad17f70e8e12a75258d015e52023a2c74eef26e65eb906b7f9d11f9c0f922367e85de4cc35a334638978a
7
- data.tar.gz: e85e34eacab4a9ef925080a1d78e69cb37f393e522af2b58a22362d4400d46f537a1de68f5d6014eb53c56edb4377cebc6d88a5fe2d81ef2d4e088fe5e0ec672
6
+ metadata.gz: 07046b845aad862743042afda74fc749a22e97904f86c87ca9717b471e6ef2402e5e4145ad5a469405957fabf6cfda7da3362be22ca647be51ce7de7dafcb0cb
7
+ data.tar.gz: 56dd24a83704f5a108f2b0730fdf8e7a8155aa57ee0ad1dd20f677571fe3273a15a2b6ca07e57ec06ec9473478a98bd3a96ef3a3a7f97a96c03e3f6ab7deb28b
data/.rubocop.yml CHANGED
@@ -11,11 +11,18 @@ AllCops:
11
11
  Metrics/LineLength:
12
12
  Max: 120
13
13
 
14
+ Metrics/MethodLength:
15
+ Max: 21
16
+
14
17
  Metrics/BlockLength:
15
- Max: 35
18
+ Max: 40
16
19
  Exclude:
17
20
  - "./**/spec/**/*"
18
21
 
22
+ Metrics/AbcSize:
23
+ Exclude:
24
+ - "lib/release/notes/configuration.rb"
25
+
19
26
  Style/StringLiterals:
20
27
  EnforcedStyle: double_quotes
21
28
  Exclude:
data/.travis.yml CHANGED
@@ -5,13 +5,13 @@ rvm:
5
5
  - 2.4.5
6
6
  - 2.5.3
7
7
  cache: bundler
8
- before_install: gem install bundler -v 1.12.5
8
+ before_install: gem install bundler -v 1.17.1
9
9
  env:
10
10
  global:
11
11
  secure: ovawk+NnGZGW+hOeC3iPMZ9jKY5FvaxfHLj6XX4Vfe12cq0cdGYirW6pk2uKdJZdE0pC5q4sFv1ZTgcNSTySuNpQ9Gkp4xjcGEVr5JSdmVse8DuxttwkeSPt94DemyMK3f0A3dWN8OJF7/NQbacPeUuXryxmusCqJMlWccVYGeSQQNJ21mFfl2pCf6Z9qls4Q3rzXc4hsVQ5G1B/j9YcMjax0EwXI4cEq/6JadK4OmXrGkCw6M/wvBEqNyhLz+R/gcYiJZqYUETdncRuNiH8N6JKiaCnZUFkGY4bggpOvz29lj3JEQV9jY+3UBeqxuYj3glT7buEuf6//ARedY7IDlupkiDNuSpIKJhzIKAgitc/g+cnUflQV8PiImAEseO0OpoAJ7Bsa688EgyvMgo/kYwjHqZetvlUksQI+XyZ+o7/88LF2Qz4pbuBtdFC4DaKaeqQN5afIHSPtxhYwFA/n+GmY4jymj5ZWod9zZasVdlDgCQzgH5M1W7nEGun8mRW93wf8+3wAx+fXVbB67aDbqJFBJfH6zm/aBCN16kGkHUibRxUyb0F52woBQLUcOIr9Kbujp02D7IK3Z7PFz+DtHfA8aYRXxRDIHxx0tw91UxQzBinsq27kH8EWDmEKMHJeZlMRR4X4ijd6+KFoKUobXFblCeVeO0HCIBxpfTc39w=
12
12
  script:
13
- - bundle exec rubocop
14
13
  - bundle exec rspec
14
+ - bundle exec rubocop
15
15
 
16
16
  after_success:
17
17
  - bundle exec codeclimate-test-reporter
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Imgur](https://i.imgur.com/vTgHEyJ.png)
2
+
1
3
  # Release::Notes
2
4
 
3
5
  [![Build Status](https://travis-ci.org/dvmonroe/release-notes.svg?branch=master)](https://travis-ci.org/dvmonroe/release-notes)
@@ -5,7 +7,7 @@
5
7
  [![Test Coverage](https://codeclimate.com/github/dvmonroe/release-notes/badges/coverage.svg)](https://codeclimate.com/github/dvmonroe/release-notes/coverage)
6
8
  [![Inline docs](http://inch-ci.org/github/dvmonroe/release-notes.svg?branch=master)](http://inch-ci.org/github/dvmonroe/release-notes)
7
9
 
8
- Release notes for the stakeholders.
10
+ ## Automated release notes based on your project's git log.
9
11
 
10
12
  Release::Notes is a small wrapper around your project's git log. The gem is
11
13
  intended to help increase visability to all team members and/or stakeholders with
@@ -17,7 +19,7 @@ meant for situations where other team members in your organization need to know
17
19
  to the production software. These key changes are determined by the labeling you set forth
18
20
  in the configuration for features, bugs and misc commits.
19
21
  If you're looking for a comprehnsive changelog that reflects resolved github issues and uses the
20
- github api, I'd suggest you look at something else like
22
+ github api, I'd suggest you look at something else like
21
23
  [github-changelog-generator](https://github.com/skywinder/github-changelog-generator).
22
24
 
23
25
  Not looking for a tested gem or prefer the rawness of a bash script? Checkout the similar
@@ -65,6 +67,7 @@ Release::Notes.configure do |config|
65
67
  config.ignore_case = true
66
68
  config.log_format = '- %s'
67
69
  config.extended_regex = true
70
+ config.header_title = "tag"
68
71
  config.bug_labels = %w(Fix Update)
69
72
  config.feature_labels = %w(Add Create)
70
73
  config.misc_labels = %w(Refactor)
@@ -136,7 +139,7 @@ namespace :deploy do
136
139
  task :update_release_notes do
137
140
  # use the binstub
138
141
  sh 'bin/release-notes"'
139
-
142
+
140
143
  # Then check in your release notes with a commit
141
144
  sh "git commit -am 'Release to production #{Time.zone.now}'"
142
145
  sh "git push origin master"
@@ -156,6 +159,7 @@ Useful information can be found here regarding the
156
159
  - Linking is opinionated and will link to a URI structure of `#{site-url}/#{issue_number}`. It
157
160
  will ouput something like: `[HONEYBADGER #33150353](https://app.honeybadger.io/projects/9999/faults/33150353)`.
158
161
  This also means that your link_to_labels have to be something like `['HB #']` (PR's to make this more flexible are welcome)
162
+ - We grep the entire commit message when generating the release notes file. If you include keywords in your commit subject and message that match multiple configured labels, that commit will be listed under all relevant label headers, which could lead to commits being listed under more than one label.
159
163
 
160
164
  ## Development
161
165
 
@@ -5,7 +5,7 @@ Next step:
5
5
  1. Configure release and tag options :
6
6
 
7
7
  # config/initializers/release_notes.rb
8
- config.by_tag_date = false
8
+ config.header_title = "tag"
9
9
 
10
10
 
11
- *******************************************************************************
11
+ *******************************************************************************
@@ -37,6 +37,12 @@ Release::Notes.configure do |config|
37
37
  # @return [Boolean]
38
38
  # config.extended_regex = true
39
39
 
40
+ # Controls the header used in your generated log for all tags.
41
+ # "tag" and "date" are the two valid options
42
+ # Defaults to `tag`.
43
+ # @return [String]
44
+ # config.header_title = "tag"
45
+
40
46
  # Allows you to specify what information you want to print from your git log
41
47
  # Defaults to `%s` for subject. For more, see
42
48
  # [Git Log Docs](https://git-scm.com/docs/git-log)
@@ -39,6 +39,11 @@ module Release
39
39
  # @return [String]
40
40
  attr_accessor :log_format
41
41
 
42
+ # Controls the headers that will be used for your tags
43
+ # Defaults to `tag`.
44
+ # @return [String]
45
+ attr_accessor :header_title
46
+
42
47
  # Controls the labels grepped for in your commit subjects that will
43
48
  # be add under you bug title
44
49
  # Defaults to `%w(Fix Update)`.
@@ -120,13 +125,14 @@ module Release
120
125
  # @return [Boolean]
121
126
  attr_accessor :force_rewrite
122
127
 
123
- def initialize # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
128
+ def initialize
124
129
  @output_file = "./RELEASE_NOTES.md"
125
130
  @temp_file = "./release-notes.tmp.md"
126
131
  @include_merges = false
127
132
  @ignore_case = true
128
133
  @extended_regex = true
129
134
  @log_format = "- %s"
135
+ @header_title = "tag"
130
136
  @bug_labels = %w(Fix Update)
131
137
  @feature_labels = %w(Add Create)
132
138
  @misc_labels = %w(Refactor)
@@ -143,6 +149,11 @@ module Release
143
149
  @force_rewrite = false
144
150
  end
145
151
 
152
+ # @return [String]
153
+ def header_title_type
154
+ @header_title.match?(/^[tag|date]+$/) ? @header_title : "tag"
155
+ end
156
+
146
157
  # @return [String]
147
158
  def include_merges?
148
159
  @include_merges ? "" : "--no-merges"
@@ -17,10 +17,6 @@ module Release
17
17
  " #{regex_type} #{grep_insensitive?}" \
18
18
  " #{include_merges?} --format='#{log_format}'"
19
19
  end
20
-
21
- def invert_log(**opts)
22
- log(opts) + " --invert-grep"
23
- end
24
20
  end
25
21
 
26
22
  def last_tag
@@ -5,7 +5,7 @@ module Release
5
5
  module Link
6
6
  extend ActiveSupport::Concern
7
7
 
8
- included do # rubocop:disable Metrics/BlockLength
8
+ included do
9
9
  delegate :link_to_labels, :link_to_sites, :link_to_humanize, to: :"Release::Notes.configuration"
10
10
 
11
11
  def link_lines(lines:)
@@ -8,13 +8,13 @@ module Release
8
8
  attr_reader :writer, :date_formatter
9
9
  attr_reader :all_tags
10
10
 
11
- delegate :force_rewrite, :all_labels, :log_all, :features,
12
- :bugs, :misc, :feature_title,
11
+ delegate :force_rewrite, :all_labels, :log_all, :header_title,
12
+ :header_title_type, :features, :bugs, :misc, :feature_title,
13
13
  :bug_title, :misc_title, :log_all_title,
14
14
  :release_notes_exist?, to: :"Release::Notes.configuration"
15
15
 
16
16
  delegate :date_humanized, :format_tag_date, to: :date_formatter
17
- delegate :digest_date, :digest_title, to: :writer
17
+ delegate :digest_header, :digest_title, to: :writer
18
18
 
19
19
  def initialize
20
20
  @writer = Release::Notes::Write.new
@@ -37,13 +37,13 @@ module Release
37
37
  # :nocov:
38
38
  private
39
39
 
40
- def all_tags # rubocop:disable Lint/DuplicateMethods
41
- @all_tags ||= System.all_tags.split("\n")
40
+ def git_all_tags
41
+ @git_all_tags ||= System.all_tags.split("\n")
42
42
  # return Error.new(msg: :missing_tags) unless all_tags.present?
43
43
  end
44
44
 
45
45
  # @api private
46
- def copy_single_tag_of_activity(tag_from:, tag_to: "HEAD") # rubocop:disable Metrics/MethodLength
46
+ def copy_single_tag_of_activity(tag_from:, tag_to: "HEAD")
47
47
  [features, bugs, misc].each_with_index do |regex, i|
48
48
  log = system_log(
49
49
  tag_from: tag_from,
@@ -70,22 +70,28 @@ module Release
70
70
  return false unless system_log(tag_from: last_tag, label: all_labels).present?
71
71
 
72
72
  # output the date right now
73
- digest_date date: date_humanized
73
+ header_content date: date_humanized, tag: tag_to
74
74
  copy_single_tag_of_activity(tag_from: last_tag)
75
75
  end
76
76
 
77
77
  # @api private
78
78
  def find_all_tags_and_log_all
79
- all_tags.each_with_index do |ta, i|
80
- previous_tag = all_tags[i + 1]
79
+ git_all_tags.each_with_index do |ta, i|
80
+ previous_tag = git_all_tags[i + 1]
81
81
  next unless previous_tag.present? &&
82
82
  system_log(tag_from: previous_tag, tag_to: ta, label: all_labels).present?
83
83
 
84
- digest_date date: date_humanized(date: System.tag_date(tag: ta))
84
+ header_content date: date_humanized(date: System.tag_date(tag: ta)), tag: ta
85
85
  copy_single_tag_of_activity(tag_from: previous_tag, tag_to: ta)
86
86
  end
87
87
  end
88
88
 
89
+ # @api private
90
+ def header_content(**date_and_tag)
91
+ digest_header(date_and_tag[header_title_type.to_sym])
92
+ end
93
+
94
+ # @api private
89
95
  def titles
90
96
  [feature_title, bug_title, misc_title]
91
97
  end
@@ -8,9 +8,14 @@ module Release
8
8
  extend ActiveSupport::Concern
9
9
  include Git
10
10
 
11
+ delegate :all_labels, to: :"Release::Notes.configuration"
12
+
11
13
  included do
12
14
  def system_log(**opts)
13
- return `#{invert_log(opts.merge(label: all_labels, invert_grep: "--invert-grep"))}` if opts[:log_all] == true
15
+ if opts.delete(:log_all) == true
16
+ opts[:label] = all_labels
17
+ opts[:invert_grep] = " --invert-grep"
18
+ end
14
19
 
15
20
  `#{log(opts)}`
16
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Release
4
4
  module Notes
5
- VERSION = "1.2.1"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
@@ -30,10 +30,10 @@ module Release
30
30
  digest(titles)
31
31
  end
32
32
 
33
- # formats dates to be added to the new file
34
- def digest_date(date: nil)
35
- @date = date
36
- digest(date_present)
33
+ # formats the headers to be added to the new file
34
+ def digest_header(header)
35
+ @header = header
36
+ digest(header_present)
37
37
  end
38
38
 
39
39
  # append old file to new temp file
@@ -49,8 +49,8 @@ module Release
49
49
  private
50
50
 
51
51
  # @api private
52
- def date_present
53
- "\n## #{@date}\n"
52
+ def header_present
53
+ "\n## #{@header}\n"
54
54
  end
55
55
 
56
56
  # @api private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: release-notes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Monroe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-30 00:00:00.000000000 Z
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport