raketeer 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -14
- data/Gemfile +0 -18
- data/README.md +8 -7
- data/Rakefile +0 -18
- data/lib/raketeer.rb +2 -16
- data/lib/raketeer/all.rb +3 -17
- data/lib/raketeer/bump.rb +3 -17
- data/lib/raketeer/bump_task.rb +122 -136
- data/lib/raketeer/bump_ver.rb +46 -58
- data/lib/raketeer/files_bumper.rb +40 -56
- data/lib/raketeer/github_pkg.rb +3 -17
- data/lib/raketeer/github_pkg_task.rb +17 -31
- data/lib/raketeer/irb.rb +3 -17
- data/lib/raketeer/irb_task.rb +15 -29
- data/lib/raketeer/nokogiri_install_tasks.rb +25 -39
- data/lib/raketeer/nokogiri_installs.rb +6 -20
- data/lib/raketeer/run.rb +3 -17
- data/lib/raketeer/run_task.rb +24 -38
- data/lib/raketeer/sem_ver.rb +54 -68
- data/lib/raketeer/util.rb +29 -43
- data/lib/raketeer/version.rb +9 -25
- data/raketeer.gemspec +20 -36
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8318d5b5dddcf509b11a49cdfa57ef8e7af9d572e09ac254adbc2c1d93fd38f0
|
4
|
+
data.tar.gz: 31778d29a79cb2c04da6ba45b4bd6b44b9e38660f161ee2313d98206e3331ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d98b728c0df3e4c7b1481950b97fdc7b5e6e92ea124b8eeeeebcee3b874a402c04deb73aea7668983ba8d060b607c20b05f0cff3f71dfb5a277735162b084e
|
7
|
+
data.tar.gz: b22fb89132681c1ec4008fd05d4d7d14c4ae17817136d701c140973fead91cf614eceb91243a334500a53732c2fe67e319b7367f688c91002021969605976e68
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
4
|
|
5
|
-
## [[Unreleased]](https://github.com/esotericpig/raketeer/compare/v0.2.
|
5
|
+
## [[Unreleased]](https://github.com/esotericpig/raketeer/compare/v0.2.10...master)
|
6
|
+
|
7
|
+
## [v0.2.10] - 2021-05-30
|
8
|
+
### Changed
|
9
|
+
- Formatted all code using RuboCop.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Updated Bundler and Gems because of GitHub security warning.
|
6
13
|
|
7
14
|
## [v0.2.9] - 2020-03-01
|
8
15
|
### Changed
|
@@ -83,16 +90,5 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
83
90
|
|
84
91
|
## [v0.1.0] - 2019-07-23
|
85
92
|
### Added
|
86
|
-
-
|
87
|
-
-
|
88
|
-
- Gemfile
|
89
|
-
- LICENSE.txt
|
90
|
-
- README.md
|
91
|
-
- Rakefile
|
92
|
-
- raketeer.gemspec
|
93
|
-
- lib/raketeer.rb
|
94
|
-
- lib/raketeer/irb_task.rb
|
95
|
-
- lib/raketeer/nokogiri_install_tasks.rb
|
96
|
-
- lib/raketeer/nokogiri_installs.rb
|
97
|
-
- lib/raketeer/raketeers.rb
|
98
|
-
- lib/raketeer/version.rb
|
93
|
+
- IRB task
|
94
|
+
- Nokogiri installs
|
data/Gemfile
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of Raketeer.
|
6
|
-
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# Raketeer is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
4
|
|
23
5
|
source 'https://rubygems.org'
|
24
6
|
|
data/README.md
CHANGED
@@ -28,16 +28,17 @@ With the RubyGems CLI package manager:
|
|
28
28
|
In your *Gemspec* (*<project>.gemspec*):
|
29
29
|
|
30
30
|
```Ruby
|
31
|
-
spec.add_development_dependency 'raketeer', '~>
|
31
|
+
spec.add_development_dependency 'raketeer', '~> 0.2'
|
32
32
|
```
|
33
33
|
|
34
34
|
In your *Gemfile*:
|
35
35
|
|
36
36
|
```Ruby
|
37
|
-
gem 'raketeer', '~>
|
37
|
+
gem 'raketeer', '~> 0.2', group: [:development, :test]
|
38
|
+
|
38
39
|
# or...
|
39
|
-
gem 'raketeer', :
|
40
|
-
:
|
40
|
+
gem 'raketeer', git: 'https://github.com/esotericpig/raketeer.git',
|
41
|
+
tag: 'v0.2.10', group: [:development, :test]
|
41
42
|
```
|
42
43
|
|
43
44
|
Manually:
|
@@ -51,8 +52,6 @@ $ bundle exec rake install:local
|
|
51
52
|
|
52
53
|
## [Using](#contents)
|
53
54
|
|
54
|
-
**TODO:** flesh out Using section
|
55
|
-
|
56
55
|
**Rakefile**
|
57
56
|
|
58
57
|
In your *Rakefile*, you can either include all tasks...
|
@@ -149,7 +148,9 @@ require 'raketeer/bump_task'
|
|
149
148
|
Raketeer::BumpTask.new() do |task|
|
150
149
|
task.strict = true
|
151
150
|
end
|
151
|
+
```
|
152
152
|
|
153
|
+
```Ruby
|
153
154
|
require 'raketeer/github_pkg_task'
|
154
155
|
|
155
156
|
Raketeer::GitHubPkgTask.new() do |task|
|
@@ -172,7 +173,7 @@ $ bundle exec rake -T
|
|
172
173
|
[GNU LGPL v3+](LICENSE.txt)
|
173
174
|
|
174
175
|
> Raketeer (<https://github.com/esotericpig/raketeer>)
|
175
|
-
> Copyright (c) 2019-
|
176
|
+
> Copyright (c) 2019-2021 Jonathan Bradley Whited
|
176
177
|
>
|
177
178
|
> Raketeer is free software: you can redistribute it and/or modify
|
178
179
|
> it under the terms of the GNU Lesser General Public License as published by
|
data/Rakefile
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of Raketeer.
|
6
|
-
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# Raketeer is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
4
|
|
23
5
|
require 'bundler/gem_tasks'
|
24
6
|
|
data/lib/raketeer.rb
CHANGED
@@ -1,23 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of Raketeer.
|
7
|
-
# Copyright (c) 2019-
|
8
|
-
#
|
9
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# Raketeer is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public License
|
20
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2019-2021 Jonathan Bradley Whited
|
21
7
|
#++
|
22
8
|
|
23
9
|
|
@@ -34,7 +20,7 @@ require 'raketeer/version'
|
|
34
20
|
|
35
21
|
|
36
22
|
###
|
37
|
-
# @author Jonathan Bradley Whited
|
23
|
+
# @author Jonathan Bradley Whited
|
38
24
|
# @since 0.1.0
|
39
25
|
###
|
40
26
|
module Raketeer
|
data/lib/raketeer/all.rb
CHANGED
@@ -1,23 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of Raketeer.
|
7
|
-
# Copyright (c) 2019-
|
8
|
-
#
|
9
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# Raketeer is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public License
|
20
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2019-2021 Jonathan Bradley Whited
|
21
7
|
#++
|
22
8
|
|
23
9
|
|
@@ -31,8 +17,8 @@ require 'raketeer/run' # @since 0.2.2
|
|
31
17
|
module Raketeer
|
32
18
|
###
|
33
19
|
# Defines all Raketeer tasks in your Rakefile.
|
34
|
-
#
|
35
|
-
# @author Jonathan Bradley Whited
|
20
|
+
#
|
21
|
+
# @author Jonathan Bradley Whited
|
36
22
|
# @since 0.2.0
|
37
23
|
###
|
38
24
|
module All
|
data/lib/raketeer/bump.rb
CHANGED
@@ -1,23 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of Raketeer.
|
7
|
-
# Copyright (c) 2019 Jonathan Bradley Whited
|
8
|
-
#
|
9
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# Raketeer is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public License
|
20
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2019-2021 Jonathan Bradley Whited
|
21
7
|
#++
|
22
8
|
|
23
9
|
|
@@ -25,11 +11,11 @@ require 'raketeer/bump_task'
|
|
25
11
|
|
26
12
|
module Raketeer
|
27
13
|
###
|
28
|
-
# @author Jonathan Bradley Whited
|
14
|
+
# @author Jonathan Bradley Whited
|
29
15
|
# @since 0.2.4
|
30
16
|
###
|
31
17
|
module Bump
|
32
18
|
end
|
33
19
|
end
|
34
20
|
|
35
|
-
Raketeer::BumpTask.new
|
21
|
+
Raketeer::BumpTask.new # @since 0.2.4
|
data/lib/raketeer/bump_task.rb
CHANGED
@@ -1,23 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of Raketeer.
|
7
|
-
# Copyright (c) 2019 Jonathan Bradley Whited
|
8
|
-
#
|
9
|
-
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# Raketeer is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public License
|
20
|
-
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2019-2021 Jonathan Bradley Whited
|
21
7
|
#++
|
22
8
|
|
23
9
|
|
@@ -31,7 +17,7 @@ require 'raketeer/util'
|
|
31
17
|
|
32
18
|
module Raketeer
|
33
19
|
###
|
34
|
-
# @author Jonathan Bradley Whited
|
20
|
+
# @author Jonathan Bradley Whited
|
35
21
|
# @since 0.2.4
|
36
22
|
###
|
37
23
|
class BumpTask < Rake::TaskLib
|
@@ -45,30 +31,30 @@ module Raketeer
|
|
45
31
|
attr_accessor :ruby_files # Looks for {ruby_var}
|
46
32
|
attr_accessor :ruby_var
|
47
33
|
attr_accessor :strict
|
48
|
-
|
34
|
+
|
49
35
|
alias_method :bump_bundle?,:bump_bundle
|
50
36
|
alias_method :dry_run?,:dry_run
|
51
37
|
alias_method :strict?,:strict
|
52
|
-
|
38
|
+
|
53
39
|
def initialize(name=:bump)
|
54
40
|
super()
|
55
|
-
|
41
|
+
|
56
42
|
@bump_bundle = false
|
57
43
|
@bump_files = Rake::FileList[]
|
58
44
|
@bundle_cmd = 'bundle'
|
59
45
|
@changelogs = Rake::FileList['CHANGELOG.md']
|
60
46
|
@dry_run = false
|
61
|
-
@git_msg =
|
47
|
+
@git_msg = "git commit -m 'Bump version to v%{version}'"
|
62
48
|
@name = name
|
63
49
|
@ruby_files = Rake::FileList[File.join('lib','**','version.rb')]
|
64
50
|
@ruby_var = 'VERSION'
|
65
51
|
@strict = false
|
66
|
-
|
67
|
-
yield self if block_given?
|
68
|
-
define
|
52
|
+
|
53
|
+
yield self if block_given?
|
54
|
+
define
|
69
55
|
end
|
70
|
-
|
71
|
-
def define
|
56
|
+
|
57
|
+
def define
|
72
58
|
desc 'Show/Set/Bump the version'
|
73
59
|
task @name,[:version] do |task,args|
|
74
60
|
bump_all(BumpVer.new(
|
@@ -80,249 +66,249 @@ module Raketeer
|
|
80
66
|
build_meta: ENV['build']
|
81
67
|
))
|
82
68
|
end
|
83
|
-
|
69
|
+
|
84
70
|
namespace @name do
|
85
71
|
desc 'Bump/Set the major version'
|
86
72
|
task :major,[:major] do |task,args|
|
87
73
|
bump_ver = BumpVer.new(major: args.major)
|
88
|
-
|
74
|
+
|
89
75
|
# You can't erase the major version (required)
|
90
|
-
bump_ver.major = '+1' if bump_ver.major.nil?
|
91
|
-
|
76
|
+
bump_ver.major = '+1' if bump_ver.major.nil? || bump_ver.major.empty?
|
77
|
+
|
92
78
|
bump_all(bump_ver)
|
93
79
|
end
|
94
|
-
|
80
|
+
|
95
81
|
desc 'Bump/Set the minor version'
|
96
82
|
task :minor,[:minor] do |task,args|
|
97
83
|
bump_ver = BumpVer.new(minor: args.minor)
|
98
|
-
bump_ver.minor = '+1' if bump_ver.minor.nil?
|
99
|
-
|
84
|
+
bump_ver.minor = '+1' if bump_ver.minor.nil?
|
85
|
+
|
100
86
|
bump_all(bump_ver)
|
101
87
|
end
|
102
|
-
|
88
|
+
|
103
89
|
desc 'Bump/Set the patch version'
|
104
90
|
task :patch,[:patch] do |task,args|
|
105
91
|
bump_ver = BumpVer.new(patch: args.patch)
|
106
|
-
bump_ver.patch = '+1' if bump_ver.patch.nil?
|
107
|
-
|
92
|
+
bump_ver.patch = '+1' if bump_ver.patch.nil?
|
93
|
+
|
108
94
|
bump_all(bump_ver)
|
109
95
|
end
|
110
|
-
|
96
|
+
|
111
97
|
desc 'Set/Erase the pre-release version'
|
112
98
|
task :pre,[:pre] do |task,args|
|
113
99
|
bump_ver = BumpVer.new(prerelease: args.pre)
|
114
|
-
bump_ver.prerelease = '' if bump_ver.prerelease.nil?
|
115
|
-
|
100
|
+
bump_ver.prerelease = '' if bump_ver.prerelease.nil?
|
101
|
+
|
116
102
|
bump_all(bump_ver)
|
117
103
|
end
|
118
|
-
|
104
|
+
|
119
105
|
desc 'Set/Erase the build metadata'
|
120
106
|
task :build,[:build] do |task,args|
|
121
107
|
bump_ver = BumpVer.new(build_meta: args.build)
|
122
|
-
bump_ver.build_meta = '' if bump_ver.build_meta.nil?
|
123
|
-
|
108
|
+
bump_ver.build_meta = '' if bump_ver.build_meta.nil?
|
109
|
+
|
124
110
|
bump_all(bump_ver)
|
125
111
|
end
|
126
|
-
|
112
|
+
|
127
113
|
desc 'Bump the Gemfile.lock version'
|
128
114
|
task :bundle do
|
129
|
-
check_env
|
130
|
-
bump_bundle_file
|
115
|
+
check_env
|
116
|
+
bump_bundle_file
|
131
117
|
end
|
132
|
-
|
118
|
+
|
133
119
|
desc "Show the help/usage for #{name} tasks"
|
134
120
|
task :help do
|
135
|
-
print_help
|
121
|
+
print_help
|
136
122
|
end
|
137
123
|
end
|
138
124
|
end
|
139
|
-
|
125
|
+
|
140
126
|
def bump_all(bump_ver)
|
141
|
-
check_env
|
142
|
-
|
127
|
+
check_env
|
128
|
+
|
143
129
|
sem_vers = []
|
144
|
-
|
130
|
+
|
145
131
|
# Order matters for outputting the most accurate version
|
146
132
|
sem_vers << bump_ruby_files(bump_ver)
|
147
133
|
sem_vers << bump_bump_files(bump_ver)
|
148
134
|
sem_vers << bump_changelogs(bump_ver)
|
149
|
-
|
150
|
-
sem_vers.compact!
|
151
|
-
|
152
|
-
if sem_vers.empty?
|
135
|
+
|
136
|
+
sem_vers.compact!
|
137
|
+
|
138
|
+
if sem_vers.empty?
|
153
139
|
puts '! No versions found'
|
154
|
-
|
140
|
+
|
155
141
|
return
|
156
142
|
end
|
157
|
-
|
158
|
-
if @bump_bundle && !bump_ver.empty?
|
159
|
-
bump_bundle_file
|
143
|
+
|
144
|
+
if @bump_bundle && !bump_ver.empty?
|
145
|
+
bump_bundle_file
|
160
146
|
end
|
161
|
-
|
147
|
+
|
162
148
|
# Always output it, in case the user just wants to see what the git message
|
163
149
|
# should be without making changes.
|
164
|
-
if !@git_msg.nil?
|
150
|
+
if !@git_msg.nil?
|
165
151
|
puts '[Git]:'
|
166
|
-
puts '= ' + (@git_msg % {version: sem_vers[0].to_s
|
152
|
+
puts '= ' + (@git_msg % {version: sem_vers[0].to_s})
|
167
153
|
end
|
168
154
|
end
|
169
|
-
|
155
|
+
|
170
156
|
def bump_bump_files(bump_ver)
|
171
|
-
return nil if @bump_files.empty?
|
172
|
-
|
157
|
+
return nil if @bump_files.empty?
|
158
|
+
|
173
159
|
bumper = FilesBumper.new(@bump_files,bump_ver,@dry_run,@strict)
|
174
|
-
|
175
|
-
bumper.bump_files
|
176
|
-
next if bumper.changes > 0 || !bumper.sem_ver.nil?
|
160
|
+
|
161
|
+
bumper.bump_files do
|
162
|
+
next if bumper.changes > 0 || !bumper.sem_ver.nil?
|
177
163
|
next if bumper.line !~ SemVer.regex(@strict)
|
178
|
-
|
179
|
-
break if bumper.bump_line!
|
164
|
+
|
165
|
+
break if bumper.bump_line! != :no_ver && bumper.bump_ver_empty?
|
180
166
|
end
|
181
|
-
|
167
|
+
|
182
168
|
return bumper.version
|
183
169
|
end
|
184
|
-
|
185
|
-
def bump_bundle_file
|
170
|
+
|
171
|
+
def bump_bundle_file
|
186
172
|
sh_cmd = [@bundle_cmd,'list']
|
187
|
-
|
173
|
+
|
188
174
|
puts "[#{sh_cmd.join(' ')}]:"
|
189
|
-
|
175
|
+
|
190
176
|
if @dry_run
|
191
177
|
puts '= Nothing written (dry run)'
|
192
|
-
|
178
|
+
|
193
179
|
return
|
194
180
|
end
|
195
|
-
|
196
|
-
sh(*sh_cmd,
|
181
|
+
|
182
|
+
sh(*sh_cmd,verbose: false)
|
197
183
|
end
|
198
|
-
|
184
|
+
|
199
185
|
# @see https://keepachangelog.com/en/1.0.0/
|
200
186
|
def bump_changelogs(bump_ver)
|
201
|
-
return nil if @changelogs.empty?
|
202
|
-
|
187
|
+
return nil if @changelogs.empty?
|
188
|
+
|
203
189
|
bumper = FilesBumper.new(@changelogs,bump_ver,@dry_run,@strict) do
|
204
190
|
@header_bumped = false
|
205
191
|
@unreleased_bumped = false
|
206
192
|
end
|
207
|
-
|
193
|
+
|
208
194
|
header_regex = /\A(\s*##\s*\[+\D*)(#{SemVer.regex(@strict)})(.*)\z/m
|
209
195
|
unreleased_regex = /\A.*Unreleased.*http.*\.{3}/
|
210
|
-
|
211
|
-
bumper.bump_files
|
196
|
+
|
197
|
+
bumper.bump_files do
|
212
198
|
if @header_bumped && @unreleased_bumped
|
213
|
-
break if bumper.bump_ver_empty?
|
199
|
+
break if bumper.bump_ver_empty?
|
214
200
|
next
|
215
201
|
end
|
216
|
-
|
202
|
+
|
217
203
|
if bumper.line =~ unreleased_regex
|
218
204
|
next if @unreleased_bumped
|
219
|
-
|
205
|
+
|
220
206
|
# Match from the end, in case the URL has a number (like '%20')
|
221
207
|
match = bumper.line.match(/(#{SemVer.regex(@strict)})(\.{3}.*)\z/m)
|
222
|
-
|
223
|
-
next if match.nil?
|
224
|
-
|
208
|
+
|
209
|
+
next if match.nil? || match.length < 3 || (i = match.begin(0)) < 1
|
210
|
+
|
225
211
|
match = [bumper.line[0..i - 1],match[1],match[-1]]
|
226
|
-
|
227
|
-
next if match.any?
|
228
|
-
|
229
|
-
orig_line = bumper.line.dup
|
212
|
+
|
213
|
+
next if match.any? {|m| m.nil? || m.strip.empty? }
|
214
|
+
|
215
|
+
orig_line = bumper.line.dup
|
230
216
|
bumper.line = match[1]
|
231
|
-
|
217
|
+
|
232
218
|
if (result = bumper.bump_line!(add_change: false)) != :no_ver
|
233
219
|
@unreleased_bumped = true
|
234
|
-
|
220
|
+
|
235
221
|
if result == :same_ver
|
236
222
|
bumper.line = orig_line
|
237
|
-
|
223
|
+
|
238
224
|
next
|
239
225
|
end
|
240
|
-
|
226
|
+
|
241
227
|
bumper.line = match[0] << bumper.line << match[2]
|
242
|
-
|
228
|
+
|
243
229
|
bumper.add_change(bumper.line,push: false)
|
244
230
|
else
|
245
231
|
bumper.line = orig_line
|
246
232
|
end
|
247
|
-
elsif !(match = bumper.line.match(header_regex)).nil?
|
233
|
+
elsif !(match = bumper.line.match(header_regex)).nil?
|
248
234
|
next if @header_bumped || match.length < 4
|
249
|
-
|
235
|
+
|
250
236
|
match = [match[1],match[2],match[-1]]
|
251
|
-
|
252
|
-
next if match.any?
|
253
|
-
|
254
|
-
orig_line = bumper.line.dup
|
237
|
+
|
238
|
+
next if match.any? {|m| m.nil? || m.strip.empty? }
|
239
|
+
|
240
|
+
orig_line = bumper.line.dup
|
255
241
|
bumper.line = match[1]
|
256
|
-
|
242
|
+
|
257
243
|
if (result = bumper.bump_line!(add_change: false)) != :no_ver
|
258
244
|
@header_bumped = true
|
259
|
-
|
245
|
+
|
260
246
|
if result == :same_ver
|
261
247
|
bumper.line = orig_line
|
262
|
-
|
248
|
+
|
263
249
|
next
|
264
250
|
end
|
265
|
-
|
251
|
+
|
266
252
|
bumper.line = match[0] << bumper.line
|
267
|
-
|
253
|
+
|
268
254
|
# Replace the date with today's date for the new Markdown header, if it exists
|
269
|
-
match[2].sub!(/\d+\s*\-\s*\d+\s*\-\s*\d+(.*)\z/m,"#{Date.today
|
255
|
+
match[2].sub!(/\d+\s*\-\s*\d+\s*\-\s*\d+(.*)\z/m,"#{Date.today.strftime('%F')}\\1")
|
270
256
|
bumper.line << match[2]
|
271
|
-
|
257
|
+
|
272
258
|
bumper.add_change(bumper.line,push: true)
|
273
259
|
bumper.line << "\n" # Don't print this newline to the console
|
274
260
|
end
|
275
|
-
|
261
|
+
|
276
262
|
# We are adding a new Markdown header, so always set the line back to its original value
|
277
263
|
bumper.line = orig_line
|
278
264
|
end
|
279
265
|
end
|
280
|
-
|
266
|
+
|
281
267
|
return bumper.version
|
282
268
|
end
|
283
|
-
|
269
|
+
|
284
270
|
def bump_ruby_files(bump_ver)
|
285
|
-
return nil if @ruby_files.empty?
|
286
|
-
|
271
|
+
return nil if @ruby_files.empty?
|
272
|
+
|
287
273
|
bumper = FilesBumper.new(@ruby_files,bump_ver,@dry_run,@strict)
|
288
274
|
version_var_regex = /\A(\s*#{Regexp.quote(@ruby_var)}\s*=\D*)(#{SemVer.regex(@strict)})(.*)\z/m
|
289
|
-
|
290
|
-
bumper.bump_files
|
291
|
-
next if bumper.changes > 0 || !bumper.sem_ver.nil?
|
292
|
-
next if (match = bumper.line.match(version_var_regex)).nil?
|
275
|
+
|
276
|
+
bumper.bump_files do
|
277
|
+
next if bumper.changes > 0 || !bumper.sem_ver.nil?
|
278
|
+
next if (match = bumper.line.match(version_var_regex)).nil?
|
293
279
|
next if match.length < 4
|
294
|
-
next if match[1..2].any?
|
295
|
-
|
296
|
-
orig_line = bumper.line.dup
|
280
|
+
next if match[1..2].any? {|m| m.nil? || m.strip.empty? }
|
281
|
+
|
282
|
+
orig_line = bumper.line.dup
|
297
283
|
bumper.line = match[2]
|
298
|
-
|
284
|
+
|
299
285
|
if (result = bumper.bump_line!(add_change: false)) != :no_ver
|
300
286
|
if result == :same_ver
|
301
287
|
bumper.line = orig_line
|
302
|
-
|
303
|
-
break if bumper.bump_ver_empty?
|
288
|
+
|
289
|
+
break if bumper.bump_ver_empty?
|
304
290
|
next
|
305
291
|
end
|
306
|
-
|
292
|
+
|
307
293
|
bumper.line = match[1] << bumper.line
|
308
|
-
bumper.line << match[-1] unless match[-1].nil?
|
309
|
-
|
294
|
+
bumper.line << match[-1] unless match[-1].nil?
|
295
|
+
|
310
296
|
bumper.add_change(bumper.line,push: false)
|
311
297
|
else
|
312
298
|
bumper.line = orig_line
|
313
299
|
end
|
314
300
|
end
|
315
|
-
|
301
|
+
|
316
302
|
return bumper.version
|
317
303
|
end
|
318
|
-
|
319
|
-
def check_env
|
304
|
+
|
305
|
+
def check_env
|
320
306
|
@dry_run = Util.get_env_bool('dryrun',@dry_run)
|
321
307
|
@strict = Util.get_env_bool('strict',@strict)
|
322
308
|
end
|
323
|
-
|
324
|
-
def print_help
|
325
|
-
puts <<-
|
309
|
+
|
310
|
+
def print_help
|
311
|
+
puts <<-HELP
|
326
312
|
rake #{@name} # Print the current version
|
327
313
|
|
328
314
|
# You can run a dry run for any task (will not write to files)
|
@@ -348,7 +334,7 @@ rake #{@name}:pre[alpha.4] # Set the pre-release version
|
|
348
334
|
rake #{@name}:build # Erase the build metadata
|
349
335
|
rake #{@name}:build[beta.5] # Set the build metadata
|
350
336
|
rake #{@name}:bundle # Bump the Gemfile.lock version
|
351
|
-
|
337
|
+
HELP
|
352
338
|
end
|
353
339
|
end
|
354
340
|
end
|