gitlab_awesome_release 1.0.4 → 1.1.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
  SHA256:
3
- metadata.gz: 8f8216d0fc231295e49843e172a98823956739932b4e1c9234a47c10c41d6d73
4
- data.tar.gz: 44d3f967e2acb74643e7dabdcaaf94308b7446f954954050281b8c51cdf0a3bd
3
+ metadata.gz: 7cad7a8fb4252175cc533f51788429613f1179184673acc5ea4f0cba6ac9dd3c
4
+ data.tar.gz: a0e628140618abb954ee01b84875e26d650a96c0c578d81b18241012b9b78511
5
5
  SHA512:
6
- metadata.gz: d71835b0b185a3b3003c0c2f185a3067c7bdf07f3a3c390046430c4fd1c5387154254e1b27bbaf6def8de879c9db1348cf7ade8d302b316e43be428893498cbc
7
- data.tar.gz: 9f7c6371fcd757fa9ccfc4353a81c69abd3cced58acc681a0f78f1dbe4e7d88f61ff7e6dde2666446f12f4cf38fa92afb00363d6b45bd8ccab5b1863b9ee6bda
6
+ metadata.gz: 0df70b6f8dc1758e6799a71bce46d320c8ade32669796aa2806e328ed9be23bd7226956056b553a671adfaee8de57a9a5731be326c368b4ca19f18e137a330f8
7
+ data.tar.gz: a742658d82662e4318d96ca198df439b26ee77ec1e99fb4ca8467350745c659ec89bd47d2d9a2fe47c23510d10a0880a087c046e6e198d1e68de2e82ecffc210
data/.gitlab-ci.yml CHANGED
@@ -23,11 +23,16 @@ test:
23
23
 
24
24
  script:
25
25
  - bundle exec rspec
26
- - bundle exec rubocop -P
26
+
27
+ coverage: '/LOC \(([\d.]+)%\) covered/'
28
+
29
+ artifacts:
30
+ reports:
31
+ coverage_report:
32
+ coverage_format: cobertura
33
+ path: coverage/coverage.xml
27
34
 
28
35
  rules:
29
- - if: '$IMAGE == "rubylang/ruby:master-nightly-bionic"'
30
- allow_failure: true
31
36
  - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
32
37
  - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
33
38
 
@@ -42,7 +47,10 @@ test:
42
47
  - ruby:2.6
43
48
  - ruby:2.7
44
49
  - ruby:3.0
45
- - rubylang/ruby:master-nightly-bionic
50
+ - ruby:3.1
51
+ - ruby:3.2
52
+ - ruby:3.3
53
+ - ruby:3.4
46
54
 
47
55
  pages:
48
56
  extends: .default
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Unreleased
2
- [full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.4...master)
2
+ [full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.1.1...master)
3
+
4
+ ## v1.1.1
5
+ [full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.1.0...v1.1.1)
6
+
7
+ * Fix warning in Ruby 3.4
8
+ * https://gitlab.com/sue445/gitlab_awesome_release/-/merge_requests/59
9
+
10
+ ## v1.1.0
11
+ [full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.4...v1.1.0)
12
+
13
+ * Allow specifying M-R commit format for changelog generation
14
+ * https://gitlab.com/sue445/gitlab_awesome_release/-/merge_requests/57
3
15
 
4
16
  ## v1.0.4
5
17
  [full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v1.0.3...v1.0.4)
data/Gemfile CHANGED
@@ -3,7 +3,13 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in gitlab_awesome_release.gemspec
4
4
  gemspec
5
5
 
6
- # rubocop:disable Bundler/DuplicatedGem
6
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.0")
7
+ group :development do
8
+ # NOTE: addressable 2.8.1+ requires ruby 2.2.0+
9
+ gem "addressable", "< 2.8.1"
10
+ end
11
+ end
12
+
7
13
  if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
8
14
  group :development do
9
15
  # NOTE: gitlab 4.6.0+ requires ruby 2.3.0+
@@ -14,6 +20,15 @@ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
14
20
 
15
21
  # NOTE: httparty 0.20.0+ requires ruby 2.3.0+
16
22
  gem "httparty", "< 0.20.0"
23
+
24
+ # NOTE: webrick 1.4.0+ requires ruby 2.3.0+
25
+ gem "webrick", "< 1.4.0"
26
+
27
+ # NOTE: webmock 3.17.0+ requires ruby 2.3.0+
28
+ gem "webmock", "< 3.17.0"
29
+
30
+ # NOTE: logger 1.3.0+ doesn't work on < ruby 2.3.0
31
+ gem "logger", "< 1.3.0"
17
32
  end
18
33
  elsif Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.4.0")
19
34
  group :development do
@@ -34,12 +49,14 @@ elsif Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.4.0")
34
49
  gem "parallel", "< 1.20.1"
35
50
  end
36
51
  end
37
- # rubocop:enable Bundler/DuplicatedGem
38
52
 
39
53
  if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.5.0")
40
54
  group :development do
41
55
  # NOTE: docile 1.4.0+ requires ruby 2.5.0+
42
56
  gem "docile", "< 1.4.0"
57
+
58
+ # NOTE: simplecov-cobertura 2.0.0+ requires ruby 2.5.0+
59
+ gem "simplecov-cobertura", "< 2.0.0"
43
60
  end
44
61
  end
45
62
 
@@ -47,6 +64,9 @@ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.4.0")
47
64
  group :development do
48
65
  # NOTE: simplecov-html 0.11.0+ requires ruby 2.4.0+
49
66
  gem "simplecov-html", "< 0.11.0"
67
+
68
+ # NOTE: unicode-display_width 2.4.0+ requires ruby 2.4.0+
69
+ gem "unicode-display_width", "< 2.4.0"
50
70
  end
51
71
  end
52
72
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # GitlabAwesomeRelease
2
- Generate changelog from tags and MergeRequests on [GitLab](https://about.gitlab.com/)
2
+ Generate changelog from tags and MergeRequests on [GitLab](https://about.gitlab.com/)
3
+
4
+ _GITLAB is a trademark of GitLab Inc. in the United States and other countries and regions_
3
5
 
4
6
  [![Gem Version](https://badge.fury.io/rb/gitlab_awesome_release.svg)](https://badge.fury.io/rb/gitlab_awesome_release)
5
7
  [![pipeline status](https://gitlab.com/sue445/gitlab_awesome_release/badges/master/pipeline.svg)](https://gitlab.com/sue445/gitlab_awesome_release/commits/master)
@@ -60,8 +62,11 @@ All options can be specified in both the command arguments and environment varia
60
62
  * Filepath to changelog file (e.g. `CHANGELOG.md`)
61
63
  * if empty, output to console
62
64
  * `--allow-tag-format` , `ALLOW_TAG_FORMAT`
63
- * Tag format for release note heading (regular expresion pattern)
65
+ * Tag format for release note heading (regular expression pattern)
64
66
  * default: `^v?[\d.]+`
67
+ * `--merge-request-commit-format` , `MERGE_REQUEST_COMMIT_FORMAT`
68
+ * Commit format for matching merge request (regular expression pattern)
69
+ * default: `^Merge branch .*See merge request .*\!(\d+)$`
65
70
  * `--log-level` , `LOG_LEVEL`
66
71
  * Log level `(debug|info|warn|error|fatal|unknown)`
67
72
  * default: `info`
@@ -86,8 +91,11 @@ All options can be specified in both the command arguments and environment varia
86
91
  * Filepath to changelog file (e.g. `CHANGELOG.md`)
87
92
  * if empty, output to console
88
93
  * `--allow-tag-format` , `ALLOW_TAG_FORMAT`
89
- * Tag format for release note heading (regular expresion pattern)
94
+ * Tag format for release note heading (regular expression pattern)
90
95
  * default: `^v?[\d.]+`
96
+ * `--merge-request-commit-format` , `MERGE_REQUEST_COMMIT_FORMAT`
97
+ * Commit format for matching merge request (regular expression pattern)
98
+ * default: `^Merge branch .*See merge request .*\!(\d+)$`
91
99
  * `--log-level` , `LOG_LEVEL`
92
100
  * Log level `(debug|info|warn|error|fatal|unknown)`
93
101
  * default: `info`
@@ -27,15 +27,15 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency "dotenv"
29
29
  spec.add_dependency "gitlab", ">= 4.0.0"
30
+ spec.add_dependency "logger"
30
31
  spec.add_dependency "thor"
31
32
 
32
33
  spec.add_development_dependency "bundler", ">= 1.10"
33
- spec.add_development_dependency "onkcop", "0.53.0.2"
34
- spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rake", ">= 10.0"
35
35
  spec.add_development_dependency "rspec"
36
36
  spec.add_development_dependency "rspec-temp_dir"
37
- spec.add_development_dependency "rubocop", "0.57.2" # rubocop v0.58.0+ requires ruby 2.2+
38
37
  spec.add_development_dependency "simplecov"
38
+ spec.add_development_dependency "simplecov-cobertura"
39
39
  spec.add_development_dependency "webmock"
40
40
  spec.add_development_dependency "yard"
41
41
  end
@@ -7,6 +7,7 @@ module GitlabAwesomeRelease
7
7
 
8
8
  class CLI < Thor
9
9
  DEFAULT_VERSION_FORMAT = "^v?[\\d.]+".freeze
10
+ DEFAULT_MERGE_REQUEST_COMMIT_FORMAT = "^Merge branch .*See merge request .*\!(\d+)$".freeze
10
11
  GITLAB_ENV_FILES = %w[.env.gitlab ~/.env.gitlab].freeze
11
12
 
12
13
  GITLAB_API_DESCRIPTION = "GitLab API endpoint (e.g. http://example.com/api/v4)".freeze
@@ -20,14 +21,15 @@ module GitlabAwesomeRelease
20
21
  end
21
22
 
22
23
  desc "create_note", "generate changelog"
23
- option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
24
- option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
25
- option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
26
- option :from_tag, desc: "The first tag to create a changelog (default: oldest tag)"
27
- option :to_tag, desc: "The last tag to create a changelog (default: latest tag)"
28
- option :filename, desc: "Filepath to changelog file (e.g. CHANGELOG.md). if empty, output to console"
29
- option :allow_tag_format, desc: "Tag format for release note heading (regular expresion pattern)", default: DEFAULT_VERSION_FORMAT
30
- option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
24
+ option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
25
+ option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
26
+ option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
27
+ option :from_tag, desc: "The first tag to create a changelog (default: oldest tag)"
28
+ option :to_tag, desc: "The last tag to create a changelog (default: latest tag)"
29
+ option :filename, desc: "Filepath to changelog file (e.g. CHANGELOG.md). if empty, output to console"
30
+ option :allow_tag_format, desc: "Tag format for release note heading (regular expression pattern)", default: DEFAULT_VERSION_FORMAT
31
+ option :merge_request_commit_format, desc: "Commit format for matching merge request (regular expression pattern)", default: DEFAULT_MERGE_REQUEST_COMMIT_FORMAT
32
+ option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
31
33
  def create_note
32
34
  Dotenv.load(*GITLAB_ENV_FILES)
33
35
 
@@ -44,12 +46,13 @@ module GitlabAwesomeRelease
44
46
  end
45
47
 
46
48
  desc "create_latest_note", "generate release note only latest version and unreleased"
47
- option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
48
- option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
49
- option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
50
- option :filename, desc: "Filepath to changelog file (e.g. CHANGELOG.md). if empty, output to console"
51
- option :allow_tag_format, desc: "Tag format for release note heading (regular expresion pattern)", default: DEFAULT_VERSION_FORMAT
52
- option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
49
+ option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
50
+ option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
51
+ option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
52
+ option :filename, desc: "Filepath to changelog file (e.g. CHANGELOG.md). if empty, output to console"
53
+ option :allow_tag_format, desc: "Tag format for release note heading (regular expression pattern)", default: DEFAULT_VERSION_FORMAT
54
+ option :merge_request_commit_format, desc: "Commit format for matching merge request (regular expression pattern)", default: DEFAULT_MERGE_REQUEST_COMMIT_FORMAT
55
+ option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
53
56
  def create_latest_note
54
57
  Dotenv.load(*GITLAB_ENV_FILES)
55
58
 
@@ -111,10 +114,11 @@ module GitlabAwesomeRelease
111
114
  end
112
115
 
113
116
  def create_project
114
- gitlab_api_endpoint = option_or_env!(:gitlab_api_endpoint)
115
- gitlab_api_private_token = option_or_env!(:gitlab_api_private_token)
116
- gitlab_project_name = option_or_env!(:gitlab_project_name)
117
- allow_tag_format = option_or_env(:allow_tag_format, DEFAULT_VERSION_FORMAT)
117
+ gitlab_api_endpoint = option_or_env!(:gitlab_api_endpoint)
118
+ gitlab_api_private_token = option_or_env!(:gitlab_api_private_token)
119
+ gitlab_project_name = option_or_env!(:gitlab_project_name)
120
+ allow_tag_format = option_or_env(:allow_tag_format, DEFAULT_VERSION_FORMAT)
121
+ merge_request_commit_format = option_or_env(:merge_request_commit_format, DEFAULT_MERGE_REQUEST_COMMIT_FORMAT)
118
122
 
119
123
  @logger = Logger.new(STDOUT)
120
124
  @logger.level = logger_level(option_or_env(:log_level))
@@ -128,6 +132,7 @@ module GitlabAwesomeRelease
128
132
  private_token: gitlab_api_private_token,
129
133
  project_name: gitlab_project_name,
130
134
  allow_tag_format: /#{allow_tag_format}/,
135
+ merge_request_commit_format: /#{merge_request_commit_format}/m,
131
136
  logger: @logger,
132
137
  )
133
138
  end
@@ -11,13 +11,15 @@ module GitlabAwesomeRelease
11
11
  # @param private_token [String]
12
12
  # @param project_name [String]
13
13
  # @param allow_tag_format [Regexp]
14
- def initialize(api_endpoint:, private_token:, project_name:, allow_tag_format:, logger:)
14
+ # @param merge_request_commit_format [Regexp]
15
+ def initialize(api_endpoint:, private_token:, project_name:, allow_tag_format:, merge_request_commit_format:, logger:)
15
16
  Gitlab.configure do |config|
16
17
  config.endpoint = api_endpoint
17
18
  config.private_token = private_token
18
19
  end
19
20
  @project_name = project_name
20
21
  @allow_tag_format = allow_tag_format
22
+ @merge_request_commit_format = merge_request_commit_format
21
23
  @logger = logger
22
24
  end
23
25
 
@@ -36,10 +38,9 @@ module GitlabAwesomeRelease
36
38
  Gitlab.repo_tags(@project_name, params)
37
39
  end
38
40
 
39
- # rubocop:disable Style/SymbolProc avoid SEGV on ruby 2.6.0
41
+ # avoid SEGV on ruby 2.6.0
40
42
  # https://bugs.ruby-lang.org/issues/15489
41
43
  @all_tag_names = repo_tags.sort_by {|tag| tag.commit.authored_date }.map {|tag| tag.name }
42
- # rubocop:enable Style/SymbolProc
43
44
  end
44
45
 
45
46
  # @return [Array<String>]
@@ -104,7 +105,7 @@ module GitlabAwesomeRelease
104
105
 
105
106
  merge_request_iids =
106
107
  commits.map do |commit|
107
- commit["message"] =~ /^Merge branch .*See merge request .*\!(\d+)$/m
108
+ commit["message"] =~ @merge_request_commit_format
108
109
  Regexp.last_match(1)
109
110
  end
110
111
 
@@ -139,7 +140,7 @@ module GitlabAwesomeRelease
139
140
  mr_iids.each_with_object("") do |iid, str|
140
141
  begin
141
142
  str << merge_request_summary(iid) + "\n"
142
- rescue Gitlab::Error::NotFound # rubocop:disable Lint/HandleExceptions
143
+ rescue Gitlab::Error::NotFound
143
144
  # NOTE: suppress error (e.g. other repo's iid)
144
145
  end
145
146
  end
@@ -1,3 +1,3 @@
1
1
  module GitlabAwesomeRelease
2
- VERSION = "1.0.4".freeze
2
+ VERSION = "1.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_awesome_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
10
+ date: 2025-01-08 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dotenv
@@ -39,7 +38,7 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: 4.0.0
41
40
  - !ruby/object:Gem::Dependency
42
- name: thor
41
+ name: logger
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
@@ -53,45 +52,45 @@ dependencies:
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
54
  - !ruby/object:Gem::Dependency
56
- name: bundler
55
+ name: thor
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: '1.10'
62
- type: :development
60
+ version: '0'
61
+ type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
- version: '1.10'
67
+ version: '0'
69
68
  - !ruby/object:Gem::Dependency
70
- name: onkcop
69
+ name: bundler
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - '='
72
+ - - ">="
74
73
  - !ruby/object:Gem::Version
75
- version: 0.53.0.2
74
+ version: '1.10'
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - '='
79
+ - - ">="
81
80
  - !ruby/object:Gem::Version
82
- version: 0.53.0.2
81
+ version: '1.10'
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: rake
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
- - - "~>"
86
+ - - ">="
88
87
  - !ruby/object:Gem::Version
89
88
  version: '10.0'
90
89
  type: :development
91
90
  prerelease: false
92
91
  version_requirements: !ruby/object:Gem::Requirement
93
92
  requirements:
94
- - - "~>"
93
+ - - ">="
95
94
  - !ruby/object:Gem::Version
96
95
  version: '10.0'
97
96
  - !ruby/object:Gem::Dependency
@@ -123,21 +122,21 @@ dependencies:
123
122
  - !ruby/object:Gem::Version
124
123
  version: '0'
125
124
  - !ruby/object:Gem::Dependency
126
- name: rubocop
125
+ name: simplecov
127
126
  requirement: !ruby/object:Gem::Requirement
128
127
  requirements:
129
- - - '='
128
+ - - ">="
130
129
  - !ruby/object:Gem::Version
131
- version: 0.57.2
130
+ version: '0'
132
131
  type: :development
133
132
  prerelease: false
134
133
  version_requirements: !ruby/object:Gem::Requirement
135
134
  requirements:
136
- - - '='
135
+ - - ">="
137
136
  - !ruby/object:Gem::Version
138
- version: 0.57.2
137
+ version: '0'
139
138
  - !ruby/object:Gem::Dependency
140
- name: simplecov
139
+ name: simplecov-cobertura
141
140
  requirement: !ruby/object:Gem::Requirement
142
141
  requirements:
143
142
  - - ">="
@@ -190,7 +189,6 @@ files:
190
189
  - ".gitignore"
191
190
  - ".gitlab-ci.yml"
192
191
  - ".rspec"
193
- - ".rubocop.yml"
194
192
  - ".yardopts"
195
193
  - CHANGELOG.md
196
194
  - Gemfile
@@ -217,7 +215,6 @@ metadata:
217
215
  source_code_uri: https://gitlab.com/sue445/gitlab_awesome_release
218
216
  changelog_uri: https://gitlab.com/sue445/gitlab_awesome_release/blob/master/CHANGELOG.md
219
217
  rubygems_mfa_required: 'true'
220
- post_install_message:
221
218
  rdoc_options: []
222
219
  require_paths:
223
220
  - lib
@@ -232,8 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
229
  - !ruby/object:Gem::Version
233
230
  version: '0'
234
231
  requirements: []
235
- rubygems_version: 3.2.22
236
- signing_key:
232
+ rubygems_version: 3.6.2
237
233
  specification_version: 4
238
234
  summary: Generate changelog from tags and MergeRequests on GitLab
239
235
  test_files: []
data/.rubocop.yml DELETED
@@ -1,20 +0,0 @@
1
- inherit_gem:
2
- onkcop: "config/rubocop.yml"
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.4
6
-
7
- Gemspec/RequiredRubyVersion:
8
- Enabled: false
9
-
10
- Layout/AlignHash:
11
- EnforcedColonStyle: table
12
-
13
- Layout/ClosingHeredocIndentation:
14
- Enabled: false
15
-
16
- Layout/IndentHeredoc:
17
- Enabled: false
18
-
19
- Metrics/ClassLength:
20
- Max: 130