raketeer 0.2.5 → 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 +38 -14
- data/Gemfile +0 -18
- data/README.md +116 -5
- data/Rakefile +12 -18
- data/lib/raketeer.rb +4 -16
- data/lib/raketeer/all.rb +5 -17
- data/lib/raketeer/bump.rb +3 -17
- data/lib/raketeer/bump_task.rb +130 -147
- data/lib/raketeer/bump_ver.rb +46 -58
- data/lib/raketeer/files_bumper.rb +40 -56
- data/lib/raketeer/github_pkg.rb +22 -0
- data/lib/raketeer/github_pkg_task.rb +57 -0
- 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 +60 -74
- data/lib/raketeer/util.rb +49 -35
- data/lib/raketeer/version.rb +9 -25
- data/raketeer.gemspec +20 -36
- metadata +14 -10
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,42 @@
|
|
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.
|
13
|
+
|
14
|
+
## [v0.2.9] - 2020-03-01
|
15
|
+
### Changed
|
16
|
+
- Changed Gemspec description (mainly for testing other project Raketary)
|
17
|
+
|
18
|
+
## [v0.2.8] - 2020-03-01
|
19
|
+
### Added
|
20
|
+
- GitHubPkg (lib/raketeer/github_pkg.rb)
|
21
|
+
- GitHubPkgTask (lib/raketeer/github_pkg_task.rb)
|
22
|
+
- Publish/Push your `pkg/*.gem` release(s) to GitHub Packages
|
23
|
+
|
24
|
+
## [v0.2.7] - 2019-12-18
|
25
|
+
### Added
|
26
|
+
- Add more info to README
|
27
|
+
- Add default dirs to Util methods
|
28
|
+
- Add Util.get_env_bool() method
|
29
|
+
- Add more TODOs and skeletons for future
|
30
|
+
- Add strict as an env var to bump task
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
- Check env vars for bundle task in bump task
|
34
|
+
|
35
|
+
## [v0.2.6] - 2019-08-03
|
36
|
+
### Changed
|
37
|
+
- Refactored BumpTask for a new project I'm working on to use this project in a CLI
|
38
|
+
|
39
|
+
### Fixed
|
40
|
+
- SemVer's initialize_copy()
|
6
41
|
|
7
42
|
## [v0.2.5] - 2019-08-02
|
8
43
|
### Added
|
@@ -55,16 +90,5 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
55
90
|
|
56
91
|
## [v0.1.0] - 2019-07-23
|
57
92
|
### Added
|
58
|
-
-
|
59
|
-
-
|
60
|
-
- Gemfile
|
61
|
-
- LICENSE.txt
|
62
|
-
- README.md
|
63
|
-
- Rakefile
|
64
|
-
- raketeer.gemspec
|
65
|
-
- lib/raketeer.rb
|
66
|
-
- lib/raketeer/irb_task.rb
|
67
|
-
- lib/raketeer/nokogiri_install_tasks.rb
|
68
|
-
- lib/raketeer/nokogiri_installs.rb
|
69
|
-
- lib/raketeer/raketeers.rb
|
70
|
-
- 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
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
Extra Ruby Rake Tasks.
|
10
10
|
|
11
|
+
A [CLI app](https://github.com/esotericpig/raketary) is also available that uses these tasks, which is useful for tasks like *bump* (which bumps the version for your RubyGem project) so that you don't have to include this Gem as a development dependency for every project.
|
12
|
+
|
11
13
|
## Contents
|
12
14
|
|
13
15
|
- [Setup](#setup)
|
@@ -26,16 +28,17 @@ With the RubyGems CLI package manager:
|
|
26
28
|
In your *Gemspec* (*<project>.gemspec*):
|
27
29
|
|
28
30
|
```Ruby
|
29
|
-
spec.add_development_dependency 'raketeer', '~>
|
31
|
+
spec.add_development_dependency 'raketeer', '~> 0.2'
|
30
32
|
```
|
31
33
|
|
32
34
|
In your *Gemfile*:
|
33
35
|
|
34
36
|
```Ruby
|
35
|
-
gem 'raketeer', '~>
|
37
|
+
gem 'raketeer', '~> 0.2', group: [:development, :test]
|
38
|
+
|
36
39
|
# or...
|
37
|
-
gem 'raketeer', :
|
38
|
-
:
|
40
|
+
gem 'raketeer', git: 'https://github.com/esotericpig/raketeer.git',
|
41
|
+
tag: 'v0.2.10', group: [:development, :test]
|
39
42
|
```
|
40
43
|
|
41
44
|
Manually:
|
@@ -49,10 +52,118 @@ $ bundle exec rake install:local
|
|
49
52
|
|
50
53
|
## [Using](#contents)
|
51
54
|
|
55
|
+
**Rakefile**
|
56
|
+
|
57
|
+
In your *Rakefile*, you can either include all tasks...
|
58
|
+
|
59
|
+
```Ruby
|
60
|
+
require 'raketeer/all'
|
61
|
+
```
|
62
|
+
|
63
|
+
Or, include the specific tasks that you need:
|
64
|
+
|
65
|
+
```Ruby
|
66
|
+
require 'raketeer/bump'
|
67
|
+
require 'raketeer/github_pkg'
|
68
|
+
require 'raketeer/irb'
|
69
|
+
require 'raketeer/nokogiri_installs'
|
70
|
+
require 'raketeer/run'
|
71
|
+
```
|
72
|
+
|
73
|
+
If you have conflicting tasks and/or you want to see what tasks have been included, you can put them in a namespace:
|
74
|
+
|
75
|
+
```Ruby
|
76
|
+
namespace :rt do
|
77
|
+
require 'raketeer/all'
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
**Included Tasks**
|
82
|
+
|
83
|
+
```
|
84
|
+
rake bump[version] # Show/Set/Bump the version
|
85
|
+
rake bump:build[build] # Set/Erase the build metadata
|
86
|
+
rake bump:bundle # Bump the Gemfile.lock version
|
87
|
+
rake bump:help # Show the help/usage for bump tasks
|
88
|
+
rake bump:major[major] # Bump/Set the major version
|
89
|
+
rake bump:minor[minor] # Bump/Set the minor version
|
90
|
+
rake bump:patch[patch] # Bump/Set the patch version
|
91
|
+
rake bump:pre[pre] # Set/Erase the pre-release version
|
92
|
+
rake github_pkg # Publish this project's gem(s) to GitHub Packages
|
93
|
+
rake irb # Open an irb session loaded with this library
|
94
|
+
rake nokogiri_apt # Install Nokogiri libs for Ubuntu/Debian
|
95
|
+
rake nokogiri_dnf # Install Nokogiri libs for Fedora/CentOS/Red Hat
|
96
|
+
rake nokogiri_other # Install Nokogiri libs for other OSes
|
97
|
+
rake run # Run this project's main file: "rake run -- --version"
|
98
|
+
```
|
99
|
+
|
100
|
+
**bump:help**
|
101
|
+
|
102
|
+
```
|
103
|
+
$ rake bump:help
|
104
|
+
rake bump # Print the current version
|
105
|
+
|
106
|
+
# You can run a dry run for any task (will not write to files)
|
107
|
+
rake bump dryrun=true
|
108
|
+
|
109
|
+
rake bump[1.2.3-alpha.4-beta.5] # Set the version manually
|
110
|
+
rake bump major=1 minor=2 patch=3 # Set the version numbers
|
111
|
+
rake bump pre=alpha.4 build=beta.5 # Set the version extensions
|
112
|
+
rake bump major=+1 minor=+1 patch=+1 # Bump the version numbers by 1
|
113
|
+
rake bump major=+2 minor=+3 patch=+4 # Bump the version numbers by X
|
114
|
+
|
115
|
+
rake bump:major # Bump the major version by 1
|
116
|
+
rake bump:major[1] # Set the major version to 1
|
117
|
+
rake bump:major[+2] # Bump the major version by 2
|
118
|
+
rake bump:minor # Bump the minor version by 1
|
119
|
+
rake bump:minor[2] # Set the minor version to 2
|
120
|
+
rake bump:minor[+3] # Bump the minor version by 3
|
121
|
+
rake bump:patch # Bump the patch version by 1
|
122
|
+
rake bump:patch[3] # Set the patch version to 3
|
123
|
+
rake bump:patch[+4] # Bump the patch version by 4
|
124
|
+
rake bump:pre # Erase the pre-release version
|
125
|
+
rake bump:pre[alpha.4] # Set the pre-release version
|
126
|
+
rake bump:build # Erase the build metadata
|
127
|
+
rake bump:build[beta.5] # Set the build metadata
|
128
|
+
rake bump:bundle # Bump the Gemfile.lock version
|
129
|
+
```
|
130
|
+
|
131
|
+
**Modifying Tasks**
|
132
|
+
|
133
|
+
If you need more control, for now, please look at the accessors of each task (better documentation is planned for v1.0.0):
|
134
|
+
|
135
|
+
- [BumpTask](lib/raketeer/bump_task.rb)
|
136
|
+
- [GitHubPkgTask](lib/raketeer/github_pkg_task.rb)
|
137
|
+
- [IRBTask](lib/raketeer/irb_task.rb)
|
138
|
+
- [NokogiriAPTTask](lib/raketeer/nokogiri_install_tasks.rb)
|
139
|
+
- [NokogiriDNFTask](lib/raketeer/nokogiri_install_tasks.rb)
|
140
|
+
- [NokogiriOtherTask](lib/raketeer/nokogiri_install_tasks.rb)
|
141
|
+
- [RunTask](lib/raketeer/run_task.rb)
|
142
|
+
|
143
|
+
For example, in your *Rakefile*:
|
144
|
+
|
145
|
+
```Ruby
|
146
|
+
require 'raketeer/bump_task'
|
147
|
+
|
148
|
+
Raketeer::BumpTask.new() do |task|
|
149
|
+
task.strict = true
|
150
|
+
end
|
151
|
+
```
|
152
|
+
|
153
|
+
```Ruby
|
154
|
+
require 'raketeer/github_pkg_task'
|
155
|
+
|
156
|
+
Raketeer::GitHubPkgTask.new() do |task|
|
157
|
+
task.deps << 'test'
|
158
|
+
task.username = 'esotericpig'
|
159
|
+
end
|
160
|
+
```
|
161
|
+
|
52
162
|
## [Hacking](#contents)
|
53
163
|
|
54
164
|
```
|
55
165
|
$ git clone 'https://github.com/esotericpig/raketeer.git'
|
166
|
+
$ cd raketeer
|
56
167
|
$ bundle install
|
57
168
|
$ bundle exec rake -T
|
58
169
|
```
|
@@ -62,7 +173,7 @@ $ bundle exec rake -T
|
|
62
173
|
[GNU LGPL v3+](LICENSE.txt)
|
63
174
|
|
64
175
|
> Raketeer (<https://github.com/esotericpig/raketeer>)
|
65
|
-
> Copyright (c) 2019 Jonathan Bradley Whited
|
176
|
+
> Copyright (c) 2019-2021 Jonathan Bradley Whited
|
66
177
|
>
|
67
178
|
> Raketeer is free software: you can redistribute it and/or modify
|
68
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
|
|
@@ -34,3 +16,15 @@ CLOBBER.include('doc/')
|
|
34
16
|
namespace :rt do
|
35
17
|
require 'raketeer/all'
|
36
18
|
end
|
19
|
+
|
20
|
+
namespace :todo do
|
21
|
+
# TODO: make this into a task class
|
22
|
+
# TODO: do 'gem:files'? and also 'gem:info' for all other methods?
|
23
|
+
desc 'Output dat gemspec bootyliciousness'
|
24
|
+
task :gem do |task,args|
|
25
|
+
# TODO: if this doesn't work, read *.gemspec somehow? probably not...
|
26
|
+
gem = Gem::Specification.find_by_name('raketeer')
|
27
|
+
puts gem.files
|
28
|
+
#puts gem.methods.sort - Object.methods
|
29
|
+
end
|
30
|
+
end
|
data/lib/raketeer.rb
CHANGED
@@ -1,29 +1,16 @@
|
|
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
|
|
24
10
|
require 'raketeer/bump_task'
|
25
11
|
require 'raketeer/bump_ver'
|
26
12
|
require 'raketeer/files_bumper'
|
13
|
+
require 'raketeer/github_pkg_task'
|
27
14
|
require 'raketeer/irb_task'
|
28
15
|
require 'raketeer/nokogiri_install_tasks'
|
29
16
|
require 'raketeer/run_task'
|
@@ -31,8 +18,9 @@ require 'raketeer/sem_ver'
|
|
31
18
|
require 'raketeer/util'
|
32
19
|
require 'raketeer/version'
|
33
20
|
|
21
|
+
|
34
22
|
###
|
35
|
-
# @author Jonathan Bradley Whited
|
23
|
+
# @author Jonathan Bradley Whited
|
36
24
|
# @since 0.1.0
|
37
25
|
###
|
38
26
|
module Raketeer
|
data/lib/raketeer/all.rb
CHANGED
@@ -1,36 +1,24 @@
|
|
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
|
|
24
10
|
require 'raketeer/bump' # @since 0.2.4
|
11
|
+
require 'raketeer/github_pkg' # @since 0.2.8
|
25
12
|
require 'raketeer/irb' # @since 0.2.0
|
26
13
|
require 'raketeer/nokogiri_installs' # @since 0.1.0
|
27
14
|
require 'raketeer/run' # @since 0.2.2
|
28
15
|
|
16
|
+
|
29
17
|
module Raketeer
|
30
18
|
###
|
31
19
|
# Defines all Raketeer tasks in your Rakefile.
|
32
|
-
#
|
33
|
-
# @author Jonathan Bradley Whited
|
20
|
+
#
|
21
|
+
# @author Jonathan Bradley Whited
|
34
22
|
# @since 0.2.0
|
35
23
|
###
|
36
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,31 +1,15 @@
|
|
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
|
|
24
10
|
require 'date'
|
25
11
|
require 'rake'
|
26
|
-
|
27
12
|
require 'rake/tasklib'
|
28
|
-
|
29
13
|
require 'raketeer/bump_ver'
|
30
14
|
require 'raketeer/files_bumper'
|
31
15
|
require 'raketeer/sem_ver'
|
@@ -33,7 +17,7 @@ require 'raketeer/util'
|
|
33
17
|
|
34
18
|
module Raketeer
|
35
19
|
###
|
36
|
-
# @author Jonathan Bradley Whited
|
20
|
+
# @author Jonathan Bradley Whited
|
37
21
|
# @since 0.2.4
|
38
22
|
###
|
39
23
|
class BumpTask < Rake::TaskLib
|
@@ -47,33 +31,32 @@ module Raketeer
|
|
47
31
|
attr_accessor :ruby_files # Looks for {ruby_var}
|
48
32
|
attr_accessor :ruby_var
|
49
33
|
attr_accessor :strict
|
50
|
-
|
34
|
+
|
51
35
|
alias_method :bump_bundle?,:bump_bundle
|
52
36
|
alias_method :dry_run?,:dry_run
|
53
37
|
alias_method :strict?,:strict
|
54
|
-
|
38
|
+
|
55
39
|
def initialize(name=:bump)
|
56
40
|
super()
|
57
|
-
|
41
|
+
|
58
42
|
@bump_bundle = false
|
59
43
|
@bump_files = Rake::FileList[]
|
60
44
|
@bundle_cmd = 'bundle'
|
61
45
|
@changelogs = Rake::FileList['CHANGELOG.md']
|
62
46
|
@dry_run = false
|
63
|
-
@git_msg =
|
47
|
+
@git_msg = "git commit -m 'Bump version to v%{version}'"
|
64
48
|
@name = name
|
65
49
|
@ruby_files = Rake::FileList[File.join('lib','**','version.rb')]
|
66
50
|
@ruby_var = 'VERSION'
|
67
51
|
@strict = false
|
68
|
-
|
69
|
-
yield self if block_given?
|
70
|
-
define
|
52
|
+
|
53
|
+
yield self if block_given?
|
54
|
+
define
|
71
55
|
end
|
72
|
-
|
73
|
-
def define
|
56
|
+
|
57
|
+
def define
|
74
58
|
desc 'Show/Set/Bump the version'
|
75
59
|
task @name,[:version] do |task,args|
|
76
|
-
check_env()
|
77
60
|
bump_all(BumpVer.new(
|
78
61
|
version: args.version,
|
79
62
|
major: ENV['major'],
|
@@ -83,249 +66,249 @@ module Raketeer
|
|
83
66
|
build_meta: ENV['build']
|
84
67
|
))
|
85
68
|
end
|
86
|
-
|
69
|
+
|
87
70
|
namespace @name do
|
88
71
|
desc 'Bump/Set the major version'
|
89
72
|
task :major,[:major] do |task,args|
|
90
73
|
bump_ver = BumpVer.new(major: args.major)
|
91
|
-
|
74
|
+
|
92
75
|
# You can't erase the major version (required)
|
93
|
-
bump_ver.major = '+1' if bump_ver.major.nil?
|
94
|
-
|
95
|
-
check_env()
|
76
|
+
bump_ver.major = '+1' if bump_ver.major.nil? || bump_ver.major.empty?
|
77
|
+
|
96
78
|
bump_all(bump_ver)
|
97
79
|
end
|
98
|
-
|
80
|
+
|
99
81
|
desc 'Bump/Set the minor version'
|
100
82
|
task :minor,[:minor] do |task,args|
|
101
83
|
bump_ver = BumpVer.new(minor: args.minor)
|
102
|
-
bump_ver.minor = '+1' if bump_ver.minor.nil?
|
103
|
-
|
104
|
-
check_env()
|
84
|
+
bump_ver.minor = '+1' if bump_ver.minor.nil?
|
85
|
+
|
105
86
|
bump_all(bump_ver)
|
106
87
|
end
|
107
|
-
|
88
|
+
|
108
89
|
desc 'Bump/Set the patch version'
|
109
90
|
task :patch,[:patch] do |task,args|
|
110
91
|
bump_ver = BumpVer.new(patch: args.patch)
|
111
|
-
bump_ver.patch = '+1' if bump_ver.patch.nil?
|
112
|
-
|
113
|
-
check_env()
|
92
|
+
bump_ver.patch = '+1' if bump_ver.patch.nil?
|
93
|
+
|
114
94
|
bump_all(bump_ver)
|
115
95
|
end
|
116
|
-
|
96
|
+
|
117
97
|
desc 'Set/Erase the pre-release version'
|
118
98
|
task :pre,[:pre] do |task,args|
|
119
99
|
bump_ver = BumpVer.new(prerelease: args.pre)
|
120
|
-
bump_ver.prerelease = '' if bump_ver.prerelease.nil?
|
121
|
-
|
122
|
-
check_env()
|
100
|
+
bump_ver.prerelease = '' if bump_ver.prerelease.nil?
|
101
|
+
|
123
102
|
bump_all(bump_ver)
|
124
103
|
end
|
125
|
-
|
104
|
+
|
126
105
|
desc 'Set/Erase the build metadata'
|
127
106
|
task :build,[:build] do |task,args|
|
128
107
|
bump_ver = BumpVer.new(build_meta: args.build)
|
129
|
-
bump_ver.build_meta = '' if bump_ver.build_meta.nil?
|
130
|
-
|
131
|
-
check_env()
|
108
|
+
bump_ver.build_meta = '' if bump_ver.build_meta.nil?
|
109
|
+
|
132
110
|
bump_all(bump_ver)
|
133
111
|
end
|
134
|
-
|
112
|
+
|
135
113
|
desc 'Bump the Gemfile.lock version'
|
136
114
|
task :bundle do
|
137
|
-
check_env
|
138
|
-
bump_bundle_file
|
115
|
+
check_env
|
116
|
+
bump_bundle_file
|
139
117
|
end
|
140
|
-
|
118
|
+
|
141
119
|
desc "Show the help/usage for #{name} tasks"
|
142
120
|
task :help do
|
143
|
-
print_help
|
121
|
+
print_help
|
144
122
|
end
|
145
123
|
end
|
146
124
|
end
|
147
|
-
|
125
|
+
|
148
126
|
def bump_all(bump_ver)
|
127
|
+
check_env
|
128
|
+
|
149
129
|
sem_vers = []
|
150
|
-
|
130
|
+
|
151
131
|
# Order matters for outputting the most accurate version
|
152
132
|
sem_vers << bump_ruby_files(bump_ver)
|
153
133
|
sem_vers << bump_bump_files(bump_ver)
|
154
134
|
sem_vers << bump_changelogs(bump_ver)
|
155
|
-
|
156
|
-
sem_vers.compact!
|
157
|
-
|
158
|
-
if
|
159
|
-
|
135
|
+
|
136
|
+
sem_vers.compact!
|
137
|
+
|
138
|
+
if sem_vers.empty?
|
139
|
+
puts '! No versions found'
|
140
|
+
|
141
|
+
return
|
160
142
|
end
|
161
|
-
|
143
|
+
|
144
|
+
if @bump_bundle && !bump_ver.empty?
|
145
|
+
bump_bundle_file
|
146
|
+
end
|
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
|
320
|
-
|
321
|
-
|
322
|
-
if !env_dryrun.nil?() && !(env_dryrun = env_dryrun.to_s().strip()).empty?()
|
323
|
-
@dry_run = Util.to_bool(env_dryrun)
|
324
|
-
end
|
304
|
+
|
305
|
+
def check_env
|
306
|
+
@dry_run = Util.get_env_bool('dryrun',@dry_run)
|
307
|
+
@strict = Util.get_env_bool('strict',@strict)
|
325
308
|
end
|
326
|
-
|
327
|
-
def print_help
|
328
|
-
puts <<-
|
309
|
+
|
310
|
+
def print_help
|
311
|
+
puts <<-HELP
|
329
312
|
rake #{@name} # Print the current version
|
330
313
|
|
331
314
|
# You can run a dry run for any task (will not write to files)
|
@@ -338,20 +321,20 @@ rake #{@name} major=+1 minor=+1 patch=+1 # Bump the version numbers by 1
|
|
338
321
|
rake #{@name} major=+2 minor=+3 patch=+4 # Bump the version numbers by X
|
339
322
|
|
340
323
|
rake #{@name}:major # Bump the major version by 1
|
341
|
-
rake #{@name}:major[1] # Set the major version
|
324
|
+
rake #{@name}:major[1] # Set the major version to 1
|
342
325
|
rake #{@name}:major[+2] # Bump the major version by 2
|
343
326
|
rake #{@name}:minor # Bump the minor version by 1
|
344
|
-
rake #{@name}:minor[2] # Set the minor version
|
327
|
+
rake #{@name}:minor[2] # Set the minor version to 2
|
345
328
|
rake #{@name}:minor[+3] # Bump the minor version by 3
|
346
329
|
rake #{@name}:patch # Bump the patch version by 1
|
347
|
-
rake #{@name}:patch[3] # Set the patch version
|
330
|
+
rake #{@name}:patch[3] # Set the patch version to 3
|
348
331
|
rake #{@name}:patch[+4] # Bump the patch version by 4
|
349
332
|
rake #{@name}:pre # Erase the pre-release version
|
350
333
|
rake #{@name}:pre[alpha.4] # Set the pre-release version
|
351
334
|
rake #{@name}:build # Erase the build metadata
|
352
335
|
rake #{@name}:build[beta.5] # Set the build metadata
|
353
336
|
rake #{@name}:bundle # Bump the Gemfile.lock version
|
354
|
-
|
337
|
+
HELP
|
355
338
|
end
|
356
339
|
end
|
357
340
|
end
|