aufgaben 0.8.2 → 0.9.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: 7ffd158f88ddb4ddeb8f37c3ec2035aecdc060b49b3ff071503bdbc88e9758c1
4
- data.tar.gz: '019fee060bb762bb4bc11398da74475070128ffd287fca8a980c69713f9c0c57'
3
+ metadata.gz: b4b6e4ec3c6598239fb54928583b75f4a8cdea94891a7356ef4852261ae064cb
4
+ data.tar.gz: e9e42da4265df2fb295f4d0d1f1035f68faabbf131fe5ea5c3d0cc1a3f46d036
5
5
  SHA512:
6
- metadata.gz: 4d2903b58e2d9be8e530710bb8eee38afe9f449dda92af75268626b4537fd7303028b7f3db8bae2d2da8e252cd40ce52ccd6d303f996a83275bcdaad2a3ec41e
7
- data.tar.gz: 8e7c9784d66ba273f887b84c7ca6f3b09cad80b106e9db9380e802e3ed694d5622d95ed01f74587290eae50e356536575e6df1296f45dc42d5b23984cea470fc
6
+ metadata.gz: 95ab0e6a21c756e66ad5e39d673c086286b2fd1f4ebb387d4ca893d3d965e7dcae6030b70b23574ff81b5994f5c14a1213f891d61039d46cbb892ee0e62811ea
7
+ data.tar.gz: eb7d1ceda59ab6114e57fbbd61bbbf43247e709b0eb733247c6ad003c8340e4e705d20a1f862d2d8a2aa2110a1d1a7922070308f8091c04dbd7f4f4c4cf2b29e
data/CHANGELOG.md CHANGED
@@ -4,7 +4,31 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## Unreleased
6
6
 
7
- [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.8.2...HEAD)
7
+ [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.9.0...HEAD)
8
+
9
+ ## 0.9.0
10
+
11
+ [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.8.5...0.9.0)
12
+
13
+ - Support Ruby 3.0.3/2.7.5/2.6.9 for `bump:ruby` [#50](https://github.com/ybiquitous/aufgaben/pull/50)
14
+
15
+ ## 0.8.5
16
+
17
+ [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.8.4...0.8.5)
18
+
19
+ - Check committed files on `release` task [#49](https://github.com/ybiquitous/aufgaben/pull/49)
20
+
21
+ ## 0.8.4
22
+
23
+ [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.8.3...0.8.4)
24
+
25
+ - Check if specified files are updated on `release` task [#46](https://github.com/ybiquitous/aufgaben/pull/46)
26
+
27
+ ## 0.8.3
28
+
29
+ [Full diff](https://github.com/ybiquitous/aufgaben/compare/0.8.2...0.8.3)
30
+
31
+ - Run `git show` on `release` task [#45](https://github.com/ybiquitous/aufgaben/pull/45)
8
32
 
9
33
  ## 0.8.2
10
34
 
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/aufgaben.svg)](https://badge.fury.io/rb/aufgaben)
2
+
1
3
  # Aufgaben
2
4
 
3
5
  The collection of useful Rake tasks.
@@ -7,8 +9,7 @@ The collection of useful Rake tasks.
7
9
  Add this line to your `Gemfile`:
8
10
 
9
11
  ```ruby
10
- gem "aufgaben", git: "https://github.com/ybiquitous/aufgaben.git", tag: "<<tag_you_want>>", require: false
11
-
12
+ gem "aufgaben", require: false
12
13
  ```
13
14
 
14
15
  ## Usage
@@ -112,9 +113,21 @@ $ rake bump:nodejs'[12.16.1]' [DRY_RUN=1]
112
113
 
113
114
  ## Development
114
115
 
115
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
116
+ To set up:
117
+
118
+ ```console
119
+ bin/setup
120
+ ```
121
+
122
+ To run an interactive prompt:
123
+
124
+ ```console
125
+ bin/console
126
+ ```
127
+
128
+ To release:
116
129
 
117
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
130
+ Run manually on the [Release workflow](https://github.com/ybiquitous/aufgaben/actions/workflows/release.yml).
118
131
 
119
132
  ## Contributing
120
133
 
data/lib/aufgaben/base.rb CHANGED
@@ -17,5 +17,9 @@ module Aufgaben
17
17
  def dry_run?
18
18
  ENV["DRY_RUN"] || dry_run
19
19
  end
20
+
21
+ def git(*cmd, &block)
22
+ sh("git", *cmd, &block)
23
+ end
20
24
  end
21
25
  end
@@ -83,8 +83,8 @@ MSG
83
83
  elsif !dry_run?
84
84
  puts "Committing changed files ..."
85
85
  puts ""
86
- sh "git", "add", *changed_files
87
- sh "git", "commit", "-m", commit_message
86
+ git "add", *changed_files
87
+ git "commit", "-m", commit_message
88
88
  end
89
89
  end
90
90
  end
@@ -9,14 +9,17 @@ module Aufgaben
9
9
 
10
10
  DEFAULT_RELEASE_NOTE_URL = "https://www.ruby-lang.org/en/news".freeze
11
11
  RELEASE_NOTE_URLS = {
12
+ "3.0.3": "https://www.ruby-lang.org/en/news/2021/11/24/ruby-3-0-3-released/",
12
13
  "3.0.2": "https://www.ruby-lang.org/en/news/2021/07/07/ruby-3-0-2-released/",
13
14
  "3.0.1": "https://www.ruby-lang.org/en/news/2021/04/05/ruby-3-0-1-released/",
14
15
  "3.0.0": "https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/",
16
+ "2.7.5": "https://www.ruby-lang.org/en/news/2021/11/24/ruby-2-7-5-released/",
15
17
  "2.7.4": "https://www.ruby-lang.org/en/news/2021/07/07/ruby-2-7-4-released/",
16
18
  "2.7.3": "https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-7-3-released/",
17
19
  "2.7.2": "https://www.ruby-lang.org/en/news/2020/10/02/ruby-2-7-2-released/",
18
20
  "2.7.1": "https://www.ruby-lang.org/en/news/2020/03/31/ruby-2-7-1-released/",
19
21
  "2.7.0": "https://www.ruby-lang.org/en/news/2019/12/25/ruby-2-7-0-released/",
22
+ "2.6.9": "https://www.ruby-lang.org/en/news/2021/11/24/ruby-2-6-9-released/",
20
23
  "2.6.8": "https://www.ruby-lang.org/en/news/2021/07/07/ruby-2-6-8-released/",
21
24
  "2.6.7": "https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-6-7-released/",
22
25
  "2.6.6": "https://www.ruby-lang.org/en/news/2020/03/31/ruby-2-6-6-released/",
@@ -34,8 +34,8 @@ module Aufgaben
34
34
 
35
35
  msg "If you want to do this on dry-run mode, set 'DRY_RUN=1'." unless dry_run?
36
36
 
37
- sh "git", "checkout", default_branch, "--quiet"
38
- sh "git", "pull", "origin", default_branch, "--quiet"
37
+ git "checkout", default_branch, "--quiet"
38
+ git "pull", "origin", default_branch, "--quiet"
39
39
  sh "bundle", "install", "--quiet"
40
40
 
41
41
  if current_version.empty?
@@ -47,7 +47,7 @@ module Aufgaben
47
47
  end
48
48
  end
49
49
 
50
- sh "git", "diff", "--exit-code", "--quiet" do |ok|
50
+ git "diff", "--exit-code", "--quiet" do |ok|
51
51
  abort "Uncommitted changes found!" unless ok
52
52
  end
53
53
 
@@ -57,7 +57,11 @@ module Aufgaben
57
57
  msg "Releasing a new version: #{current_version} -> #{colored_new_version}"
58
58
  end
59
59
 
60
- sh "git", "--no-pager", "log", "--format=%C(auto)%h %Creset%s", "#{current_version}..HEAD"
60
+ git "--no-pager", "log", "--format=%C(auto)%h %Creset%s", "#{current_version}..HEAD"
61
+
62
+ each_file do |file|
63
+ update_version_in file, write: false
64
+ end
61
65
 
62
66
  if dry_run?
63
67
  msg "This is a dry-run mode. No actual changes. Next, run this without `DRY_RUN=1`."
@@ -71,16 +75,21 @@ module Aufgaben
71
75
  else
72
76
  add_changelog with: new_version
73
77
  end
74
- sh "git", "add", changelog
78
+ git "add", changelog
75
79
 
76
- Dir.glob(files, File::FNM_EXTGLOB).each do |file|
80
+ each_file do |file|
77
81
  update_version_in file
78
- sh "git", "add", file
82
+ git "add", file
79
83
  end
80
84
 
81
- sh "git", "commit", "--quiet", "--message", "Version #{new_version}"
82
- sh "git", "tag", "--annotate", "--message", "Version #{new_version}", new_version
83
- msg "The tag '#{new_version}' is added. Run 'git push --follow-tags'."
85
+ git "commit", "--quiet", "--message", "Version #{new_version}"
86
+ git "tag", "--annotate", "--message", "Version #{new_version}", new_version
87
+ git "show", "--pretty"
88
+
89
+ check_committed_files
90
+
91
+ git_push = Color.new("git push --follow-tags").green
92
+ msg "The tag '#{colored_new_version}' is added. Run '#{git_push}'."
84
93
  end
85
94
  end
86
95
  end
@@ -151,12 +160,44 @@ module Aufgaben
151
160
  msg "'#{changelog}' is added."
152
161
  end
153
162
 
154
- def update_version_in(file)
163
+ def check_committed_files
164
+ expected = [*expanded_files, changelog].sort
165
+ actual = `git diff --name-only HEAD^...HEAD`.lines(chomp: true).sort
166
+
167
+ if expected != actual
168
+ abort <<~MSG
169
+ The committed files are not what was expected.
170
+ Expected: #{expected}
171
+ Actual: #{actual}
172
+ MSG
173
+ end
174
+ end
175
+
176
+ def expanded_files
177
+ @expanded_files ||= Dir.glob(files, File::FNM_EXTGLOB)
178
+ end
179
+
180
+ def each_file(&block)
181
+ expanded_files.each(&block)
182
+ end
183
+
184
+ def update_version_in(file, write: true)
155
185
  content = File.read(file)
156
- content = content.gsub(Regexp.new('\b' + Regexp.escape(current_version) + '\b'), new_version)
157
- File.write(file, content)
158
186
 
159
- msg "'#{file}' is updated."
187
+ current_version_pattern = Regexp.new('\b' + Regexp.escape(current_version) + '\b')
188
+ unless current_version_pattern.match?(content)
189
+ abort "The current version '#{current_version}' is not found in '#{file}'!"
190
+ end
191
+
192
+ new_content = content.gsub(current_version_pattern, new_version)
193
+ if content == new_content
194
+ abort "No changes in '#{file}'"
195
+ end
196
+
197
+ if write
198
+ File.write(file, new_content)
199
+ msg "'#{file}' is updated."
200
+ end
160
201
  end
161
202
 
162
203
  def msg(text)
@@ -1,3 +1,3 @@
1
1
  module Aufgaben
2
- VERSION = "0.8.2".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aufgaben
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Koba
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-09 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.2.22
96
+ rubygems_version: 3.2.32
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: The collection of useful Rake tasks.