raketeer 0.2.8 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -15
- data/Gemfile +0 -18
- data/README.md +8 -7
- data/Rakefile +0 -18
- data/lib/raketeer.rb +4 -16
- data/lib/raketeer/all.rb +5 -17
- data/lib/raketeer/bump.rb +5 -17
- data/lib/raketeer/bump_task.rb +146 -138
- data/lib/raketeer/bump_ver.rb +71 -58
- data/lib/raketeer/files_bumper.rb +42 -56
- data/lib/raketeer/github_pkg.rb +5 -17
- data/lib/raketeer/github_pkg_task.rb +19 -31
- data/lib/raketeer/irb.rb +5 -17
- data/lib/raketeer/irb_task.rb +17 -29
- data/lib/raketeer/nokogiri_install_tasks.rb +27 -39
- data/lib/raketeer/nokogiri_installs.rb +8 -20
- data/lib/raketeer/run.rb +5 -17
- data/lib/raketeer/run_task.rb +26 -38
- data/lib/raketeer/sem_ver.rb +56 -68
- data/lib/raketeer/util.rb +31 -43
- data/lib/raketeer/version.rb +11 -25
- data/raketeer.gemspec +21 -37
- metadata +16 -14
data/lib/raketeer/bump_ver.rb
CHANGED
@@ -1,23 +1,11 @@
|
|
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
|
-
#
|
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
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
@@ -26,12 +14,14 @@ require 'raketeer/sem_ver'
|
|
26
14
|
module Raketeer
|
27
15
|
###
|
28
16
|
# Bump Version
|
29
|
-
#
|
30
|
-
# @author Jonathan Bradley Whited
|
17
|
+
#
|
18
|
+
# @author Jonathan Bradley Whited
|
31
19
|
# @since 0.2.4
|
32
20
|
###
|
33
21
|
class BumpVer < SemVer
|
34
22
|
def initialize(version: nil,major: nil,minor: nil,patch: nil,prerelease: nil,build_meta: nil)
|
23
|
+
super()
|
24
|
+
|
35
25
|
self.build_meta = build_meta
|
36
26
|
self.major = major
|
37
27
|
self.minor = minor
|
@@ -39,104 +29,127 @@ module Raketeer
|
|
39
29
|
self.prerelease = prerelease
|
40
30
|
self.version = version
|
41
31
|
end
|
42
|
-
|
32
|
+
|
43
33
|
def init_int_or_str(obj)
|
44
|
-
return nil if obj.nil?
|
34
|
+
return nil if obj.nil?
|
45
35
|
return obj if obj.is_a?(Integer)
|
46
|
-
|
47
|
-
obj = obj.to_s
|
48
|
-
|
49
|
-
return obj if obj.empty?
|
50
|
-
return obj.to_i
|
36
|
+
|
37
|
+
obj = obj.to_s.strip
|
38
|
+
|
39
|
+
return obj if obj.empty? || obj[0] == '+'
|
40
|
+
return obj.to_i
|
51
41
|
end
|
52
|
-
|
42
|
+
|
53
43
|
def init_str(obj)
|
54
|
-
return obj.nil?
|
44
|
+
return obj.nil? ? nil : obj.to_s.strip
|
55
45
|
end
|
56
|
-
|
46
|
+
|
57
47
|
def bump!(sem_ver)
|
58
|
-
if !@version.nil?
|
48
|
+
if !@version.nil?
|
59
49
|
sem_ver.version = @version
|
60
50
|
else
|
61
|
-
if !@major.nil?
|
51
|
+
if !@major.nil?
|
62
52
|
if @major.is_a?(Integer)
|
63
53
|
sem_ver.major = @major
|
64
|
-
elsif @major.empty?
|
54
|
+
elsif @major.empty?
|
65
55
|
sem_ver.major = 0 # There must always be a major version
|
66
56
|
else
|
67
|
-
sem_ver.major = 0 if sem_ver.major.nil?
|
68
|
-
|
57
|
+
sem_ver.major = 0 if sem_ver.major.nil?
|
58
|
+
|
59
|
+
old_major = sem_ver.major
|
60
|
+
sem_ver.major += @major.to_i
|
61
|
+
|
62
|
+
if sem_ver.major != old_major
|
63
|
+
# Reset minor & patch so that 1.1.1 => 2.0.0.
|
64
|
+
# If the user wishes, minor & patch will continue
|
65
|
+
# to be affected after ('+1.+1.+1').
|
66
|
+
sem_ver.minor = 0
|
67
|
+
sem_ver.patch = 0
|
68
|
+
|
69
|
+
# It's difficult to decide whether to set
|
70
|
+
# pre-release and build-metadata to nil,
|
71
|
+
# so just leave them.
|
72
|
+
end
|
69
73
|
end
|
70
74
|
end
|
71
|
-
|
72
|
-
if !@minor.nil?
|
75
|
+
|
76
|
+
if !@minor.nil?
|
73
77
|
if @minor.is_a?(Integer)
|
74
78
|
sem_ver.minor = @minor
|
75
|
-
elsif @minor.empty?
|
79
|
+
elsif @minor.empty?
|
76
80
|
sem_ver.minor = nil
|
77
81
|
else
|
78
|
-
sem_ver.minor = 0 if sem_ver.minor.nil?
|
79
|
-
|
82
|
+
sem_ver.minor = 0 if sem_ver.minor.nil?
|
83
|
+
|
84
|
+
old_minor = sem_ver.minor
|
85
|
+
sem_ver.minor += @minor.to_i
|
86
|
+
|
87
|
+
if sem_ver.minor != old_minor
|
88
|
+
# Reset patch so that 1.1.1 => 1.2.0.
|
89
|
+
# If the user wishes, patch will continue
|
90
|
+
# to be affected after ('X.+1.+1').
|
91
|
+
sem_ver.patch = 0
|
92
|
+
end
|
80
93
|
end
|
81
94
|
end
|
82
|
-
|
83
|
-
if !@patch.nil?
|
95
|
+
|
96
|
+
if !@patch.nil?
|
84
97
|
if @patch.is_a?(Integer)
|
85
98
|
sem_ver.patch = @patch
|
86
|
-
elsif @patch.empty?
|
99
|
+
elsif @patch.empty?
|
87
100
|
sem_ver.patch = nil
|
88
101
|
else
|
89
|
-
sem_ver.patch = 0 if sem_ver.patch.nil?
|
90
|
-
sem_ver.patch += @patch.to_i
|
102
|
+
sem_ver.patch = 0 if sem_ver.patch.nil?
|
103
|
+
sem_ver.patch += @patch.to_i
|
91
104
|
end
|
92
105
|
end
|
93
|
-
|
94
|
-
if !@prerelease.nil?
|
95
|
-
if @prerelease.empty?
|
106
|
+
|
107
|
+
if !@prerelease.nil?
|
108
|
+
if @prerelease.empty?
|
96
109
|
sem_ver.prerelease = nil
|
97
110
|
else
|
98
111
|
sem_ver.prerelease = @prerelease
|
99
112
|
end
|
100
113
|
end
|
101
|
-
|
102
|
-
if !@build_meta.nil?
|
103
|
-
if @build_meta.empty?
|
114
|
+
|
115
|
+
if !@build_meta.nil?
|
116
|
+
if @build_meta.empty?
|
104
117
|
sem_ver.build_meta = nil
|
105
118
|
else
|
106
119
|
sem_ver.build_meta = @build_meta
|
107
120
|
end
|
108
121
|
end
|
109
122
|
end
|
110
|
-
|
123
|
+
|
111
124
|
return sem_ver
|
112
125
|
end
|
113
|
-
|
126
|
+
|
114
127
|
def bump_line!(line,sem_ver,strict: false)
|
115
|
-
line.sub!(self.class.regex(strict),bump!(sem_ver).to_s
|
116
|
-
|
128
|
+
line.sub!(self.class.regex(strict),bump!(sem_ver).to_s)
|
129
|
+
|
117
130
|
return line
|
118
131
|
end
|
119
|
-
|
132
|
+
|
120
133
|
def build_meta=(build_meta)
|
121
134
|
super(init_str(build_meta))
|
122
135
|
end
|
123
|
-
|
136
|
+
|
124
137
|
def major=(major)
|
125
138
|
super(init_int_or_str(major))
|
126
139
|
end
|
127
|
-
|
140
|
+
|
128
141
|
def minor=(minor)
|
129
142
|
super(init_int_or_str(minor))
|
130
143
|
end
|
131
|
-
|
144
|
+
|
132
145
|
def patch=(patch)
|
133
146
|
super(init_int_or_str(patch))
|
134
147
|
end
|
135
|
-
|
148
|
+
|
136
149
|
def prerelease=(prerelease)
|
137
150
|
super(init_str(prerelease))
|
138
151
|
end
|
139
|
-
|
152
|
+
|
140
153
|
def version=(version)
|
141
154
|
super(init_str(version))
|
142
155
|
end
|
@@ -1,23 +1,11 @@
|
|
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
|
-
#
|
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
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
@@ -26,7 +14,7 @@ require 'raketeer/sem_ver'
|
|
26
14
|
|
27
15
|
module Raketeer
|
28
16
|
###
|
29
|
-
# @author Jonathan Bradley Whited
|
17
|
+
# @author Jonathan Bradley Whited
|
30
18
|
# @since 0.2.4
|
31
19
|
###
|
32
20
|
class FilesBumper
|
@@ -42,67 +30,67 @@ module Raketeer
|
|
42
30
|
attr_accessor :strict
|
43
31
|
attr_accessor :version
|
44
32
|
attr_accessor :version_bumped # Was the version actually bumped?
|
45
|
-
|
33
|
+
|
46
34
|
alias_method :bump_ver_empty?,:bump_ver_empty
|
47
35
|
alias_method :dry_run?,:dry_run
|
48
36
|
alias_method :strict?,:strict
|
49
37
|
alias_method :version_bumped?,:version_bumped
|
50
|
-
|
38
|
+
|
51
39
|
def initialize(files,bump_ver,dry_run,strict,&init_per_file)
|
52
40
|
@bump_ver = bump_ver
|
53
|
-
@bump_ver_empty = bump_ver.empty?
|
41
|
+
@bump_ver_empty = bump_ver.empty?
|
54
42
|
@dry_run = dry_run
|
55
|
-
@files = files.to_a
|
43
|
+
@files = files.to_a
|
56
44
|
@init_per_file = init_per_file
|
57
45
|
@sem_ver = nil
|
58
46
|
@strict = strict
|
59
47
|
@version = nil
|
60
48
|
@version_bumped = false
|
61
49
|
end
|
62
|
-
|
50
|
+
|
63
51
|
def add_change(line,push: true)
|
64
52
|
puts "+ #{line}"
|
65
|
-
|
53
|
+
|
66
54
|
@changes += 1
|
67
55
|
@lines << line if push
|
68
56
|
end
|
69
|
-
|
57
|
+
|
70
58
|
def bump_files(&block)
|
71
59
|
@files.each do |filename|
|
72
60
|
puts "[#{filename}]:"
|
73
|
-
|
61
|
+
|
74
62
|
if !File.exist?(filename)
|
75
63
|
puts '! File does not exist'
|
76
|
-
|
64
|
+
|
77
65
|
next
|
78
66
|
end
|
79
|
-
|
67
|
+
|
80
68
|
@changes = 0 # For possible future use
|
81
69
|
@lines = []
|
82
70
|
@sem_ver = nil
|
83
|
-
|
84
|
-
@init_per_file
|
85
|
-
|
71
|
+
|
72
|
+
@init_per_file&.call(self)
|
73
|
+
|
86
74
|
File.foreach(filename) do |line|
|
87
75
|
@line = line
|
88
|
-
|
89
|
-
block.call(self) if !@line.strip
|
90
|
-
|
76
|
+
|
77
|
+
block.call(self) if !@line.strip.empty?
|
78
|
+
|
91
79
|
@lines << @line
|
92
80
|
end
|
93
|
-
|
94
|
-
next if bump_ver_empty?
|
95
|
-
|
81
|
+
|
82
|
+
next if bump_ver_empty?
|
83
|
+
|
96
84
|
print '= '
|
97
|
-
|
85
|
+
|
98
86
|
if @changes > 0
|
99
|
-
if dry_run?
|
87
|
+
if dry_run?
|
100
88
|
puts "Nothing written (dry run): #{@sem_ver}"
|
101
89
|
else
|
102
90
|
File.open(filename,'w') do |file|
|
103
91
|
file.puts @lines
|
104
92
|
end
|
105
|
-
|
93
|
+
|
106
94
|
puts "#{@changes} change#{@changes == 1 ? '' : 's'} written"
|
107
95
|
end
|
108
96
|
else
|
@@ -110,42 +98,40 @@ module Raketeer
|
|
110
98
|
end
|
111
99
|
end
|
112
100
|
end
|
113
|
-
|
101
|
+
|
114
102
|
# @return [:no_ver,:same_ver,:bumped_ver]
|
115
103
|
def bump_line!(add_change: true)
|
116
104
|
@sem_ver = SemVer.parse_line(@line,strict: @strict)
|
117
|
-
|
118
|
-
return :no_ver if @sem_ver.nil?
|
119
|
-
|
120
|
-
@version = @sem_ver if @version.nil?
|
121
|
-
|
122
|
-
if bump_ver_empty?
|
105
|
+
|
106
|
+
return :no_ver if @sem_ver.nil?
|
107
|
+
|
108
|
+
@version = @sem_ver if @version.nil?
|
109
|
+
|
110
|
+
if bump_ver_empty?
|
123
111
|
puts "= #{@sem_ver}"
|
124
|
-
|
112
|
+
|
125
113
|
return :same_ver
|
126
114
|
else
|
127
|
-
orig_line = @line.dup
|
128
|
-
orig_sem_ver_s = @sem_ver.to_s
|
129
|
-
|
115
|
+
orig_line = @line.dup
|
116
|
+
orig_sem_ver_s = @sem_ver.to_s
|
117
|
+
|
130
118
|
@bump_ver.bump_line!(@line,@sem_ver,strict: @strict)
|
131
|
-
|
132
|
-
if @sem_ver.to_s
|
119
|
+
|
120
|
+
if @sem_ver.to_s != orig_sem_ver_s
|
133
121
|
if !@version_bumped
|
134
122
|
@version = @sem_ver
|
135
123
|
@version_bumped = true
|
136
124
|
end
|
137
|
-
|
125
|
+
|
138
126
|
self.add_change(@line,push: false) if add_change
|
139
|
-
|
127
|
+
|
140
128
|
return :bumped_ver
|
141
129
|
else
|
142
130
|
@line = orig_line
|
143
|
-
|
131
|
+
|
144
132
|
return :same_ver
|
145
133
|
end
|
146
134
|
end
|
147
|
-
|
148
|
-
return :no_ver
|
149
135
|
end
|
150
136
|
end
|
151
137
|
end
|
data/lib/raketeer/github_pkg.rb
CHANGED
@@ -1,23 +1,11 @@
|
|
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)
|
8
|
-
#
|
9
|
-
#
|
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
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
@@ -26,11 +14,11 @@ require 'raketeer/github_pkg_task'
|
|
26
14
|
|
27
15
|
module Raketeer
|
28
16
|
###
|
29
|
-
# @author Jonathan Bradley Whited
|
17
|
+
# @author Jonathan Bradley Whited
|
30
18
|
# @since 0.2.8
|
31
19
|
###
|
32
20
|
module GitHubPkg
|
33
21
|
end
|
34
22
|
end
|
35
23
|
|
36
|
-
Raketeer::GitHubPkgTask.new
|
24
|
+
Raketeer::GitHubPkgTask.new # @since 0.2.8
|
@@ -1,23 +1,11 @@
|
|
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)
|
8
|
-
#
|
9
|
-
#
|
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
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
@@ -28,7 +16,7 @@ require 'raketeer/util'
|
|
28
16
|
|
29
17
|
module Raketeer
|
30
18
|
###
|
31
|
-
# @author Jonathan Bradley Whited
|
19
|
+
# @author Jonathan Bradley Whited
|
32
20
|
# @since 0.2.8
|
33
21
|
###
|
34
22
|
class GitHubPkgTask < Rake::TaskLib
|
@@ -36,34 +24,34 @@ module Raketeer
|
|
36
24
|
attr_accessor :description
|
37
25
|
attr_accessor :name
|
38
26
|
attr_accessor :username
|
39
|
-
|
27
|
+
|
40
28
|
def initialize(name=:github_pkg)
|
41
29
|
super()
|
42
|
-
|
30
|
+
|
43
31
|
@deps = [:build]
|
44
|
-
@description =
|
32
|
+
@description = "Publish this project's gem(s) to GitHub Packages"
|
45
33
|
@name = name
|
46
34
|
@username = nil
|
47
|
-
|
48
|
-
yield self if block_given?
|
49
|
-
|
50
|
-
@username = Util.find_github_username
|
51
|
-
|
52
|
-
raise "#{self.class.name}.username is nil" if @username.nil?
|
53
|
-
|
54
|
-
define
|
35
|
+
|
36
|
+
yield self if block_given?
|
37
|
+
|
38
|
+
@username = Util.find_github_username if @username.nil?
|
39
|
+
|
40
|
+
raise "#{self.class.name}.username is nil" if @username.nil?
|
41
|
+
|
42
|
+
define
|
55
43
|
end
|
56
|
-
|
57
|
-
def define
|
44
|
+
|
45
|
+
def define
|
58
46
|
desc @description
|
59
47
|
task @name => Array(@deps) do |task,args|
|
60
48
|
sh_cmd = ['gem']
|
61
|
-
|
49
|
+
|
62
50
|
sh_cmd.push('push')
|
63
51
|
sh_cmd.push('--key','github')
|
64
52
|
sh_cmd.push('--host',"https://rubygems.pkg.github.com/#{username}")
|
65
53
|
sh_cmd.push(*Dir.glob(File.join('pkg','*.gem'))) # Is this okay for multiple gems?
|
66
|
-
|
54
|
+
|
67
55
|
sh(*sh_cmd)
|
68
56
|
end
|
69
57
|
end
|