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
data/lib/raketeer/sem_ver.rb
CHANGED
@@ -1,47 +1,33 @@
|
|
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
|
module Raketeer
|
25
11
|
###
|
26
12
|
# Semantic Version
|
27
|
-
#
|
13
|
+
#
|
28
14
|
# This is a non-strict version of Semantic Versioning v2.0.0.
|
29
|
-
#
|
30
|
-
# @author Jonathan Bradley Whited
|
15
|
+
#
|
16
|
+
# @author Jonathan Bradley Whited
|
31
17
|
# @since 0.2.4
|
32
18
|
# @see https://semver.org
|
33
19
|
###
|
34
20
|
class SemVer
|
35
|
-
REGEX = /\d+(\.\d+)?(\.\d+)?(\-[0-9A-Za-z\-\.]+)?(\+[0-9A-Za-z\-\.]+)
|
36
|
-
STRICT_REGEX = /\d+\.\d+\.\d+(\-[0-9A-Za-z\-\.]+)?(\+[0-9A-Za-z\-\.]+)
|
37
|
-
|
21
|
+
REGEX = /\d+(\.\d+)?(\.\d+)?(\-[0-9A-Za-z\-\.]+)?(\+[0-9A-Za-z\-\.]+)?/.freeze
|
22
|
+
STRICT_REGEX = /\d+\.\d+\.\d+(\-[0-9A-Za-z\-\.]+)?(\+[0-9A-Za-z\-\.]+)?/.freeze
|
23
|
+
|
38
24
|
attr_accessor :build_meta
|
39
25
|
attr_accessor :major
|
40
26
|
attr_accessor :minor
|
41
27
|
attr_accessor :patch
|
42
28
|
attr_accessor :prerelease
|
43
29
|
attr_accessor :version # If not +nil+, {to_s} will only return this.
|
44
|
-
|
30
|
+
|
45
31
|
def initialize(major: nil,minor: nil,patch: nil,prerelease: nil,build_meta: nil)
|
46
32
|
@build_meta = build_meta
|
47
33
|
@major = major
|
@@ -50,85 +36,85 @@ module Raketeer
|
|
50
36
|
@prerelease = prerelease
|
51
37
|
@version = nil
|
52
38
|
end
|
53
|
-
|
39
|
+
|
54
40
|
def initialize_copy(orig)
|
55
41
|
super(orig)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@build_meta =
|
60
|
-
@major =
|
61
|
-
@minor =
|
62
|
-
@patch =
|
63
|
-
@prerelease =
|
64
|
-
@version =
|
42
|
+
|
43
|
+
copy = caller[0].to_s.include?('clone') ? :clone : :dup
|
44
|
+
|
45
|
+
@build_meta = @build_meta.__send__(copy)
|
46
|
+
@major = @major.__send__(copy)
|
47
|
+
@minor = @minor.__send__(copy)
|
48
|
+
@patch = @patch.__send__(copy)
|
49
|
+
@prerelease = @prerelease.__send__(copy)
|
50
|
+
@version = @version.__send__(copy)
|
65
51
|
end
|
66
|
-
|
52
|
+
|
67
53
|
def self.parse(str)
|
68
54
|
# Parsing backwards makes the logic easier
|
69
55
|
build_meta = str.split('+',2)
|
70
56
|
prerelease = build_meta[0].split('-',2)
|
71
57
|
numbers = prerelease[0].split('.',3)
|
72
|
-
|
73
|
-
sem_ver = SemVer.new
|
74
|
-
sem_ver.major = numbers[0].to_i
|
75
|
-
|
58
|
+
|
59
|
+
sem_ver = SemVer.new
|
60
|
+
sem_ver.major = numbers[0].to_i # There must always be a major version
|
61
|
+
|
76
62
|
if numbers.length >= 2
|
77
|
-
minor = numbers[1].strip
|
78
|
-
sem_ver.minor = minor.to_i
|
79
|
-
|
63
|
+
minor = numbers[1].strip
|
64
|
+
sem_ver.minor = minor.to_i unless minor.empty?
|
65
|
+
|
80
66
|
if numbers.length == 3
|
81
|
-
patch = numbers[2].strip
|
82
|
-
sem_ver.patch = patch.to_i
|
67
|
+
patch = numbers[2].strip
|
68
|
+
sem_ver.patch = patch.to_i unless patch.empty?
|
83
69
|
end
|
84
70
|
end
|
85
|
-
|
71
|
+
|
86
72
|
if prerelease.length == 2
|
87
|
-
prerelease = prerelease[1].strip
|
88
|
-
sem_ver.prerelease = prerelease unless prerelease.empty?
|
73
|
+
prerelease = prerelease[1].strip
|
74
|
+
sem_ver.prerelease = prerelease unless prerelease.empty?
|
89
75
|
end
|
90
|
-
|
76
|
+
|
91
77
|
if build_meta.length == 2
|
92
|
-
build_meta = build_meta[1].strip
|
93
|
-
sem_ver.build_meta = build_meta unless build_meta.empty?
|
78
|
+
build_meta = build_meta[1].strip
|
79
|
+
sem_ver.build_meta = build_meta unless build_meta.empty?
|
94
80
|
end
|
95
|
-
|
81
|
+
|
96
82
|
return sem_ver
|
97
83
|
end
|
98
|
-
|
84
|
+
|
99
85
|
def self.parse_line(line,strict: false)
|
100
86
|
str = line[regex(strict)]
|
101
|
-
|
102
|
-
return nil if str.nil?
|
87
|
+
|
88
|
+
return nil if str.nil? || (str = str.strip).empty?
|
103
89
|
return parse(str)
|
104
90
|
end
|
105
|
-
|
106
|
-
def empty?
|
107
|
-
return @build_meta.nil?
|
108
|
-
@major.nil?
|
109
|
-
@minor.nil?
|
110
|
-
@patch.nil?
|
111
|
-
@prerelease.nil?
|
112
|
-
@version.nil?
|
91
|
+
|
92
|
+
def empty?
|
93
|
+
return @build_meta.nil? &&
|
94
|
+
@major.nil? &&
|
95
|
+
@minor.nil? &&
|
96
|
+
@patch.nil? &&
|
97
|
+
@prerelease.nil? &&
|
98
|
+
@version.nil?
|
113
99
|
end
|
114
|
-
|
100
|
+
|
115
101
|
def self.regex(strict=false)
|
116
102
|
return strict ? STRICT_REGEX : REGEX
|
117
103
|
end
|
118
|
-
|
119
|
-
def to_s
|
120
|
-
s = ''.dup
|
121
|
-
|
122
|
-
if !@version.nil?
|
123
|
-
s << @version.to_s
|
124
|
-
elsif !@major.nil?
|
125
|
-
s << @major.to_s
|
126
|
-
s << ".#{@minor
|
127
|
-
s << ".#{@patch
|
128
|
-
s << "-#{@prerelease
|
129
|
-
s << "+#{@build_meta
|
104
|
+
|
105
|
+
def to_s
|
106
|
+
s = ''.dup
|
107
|
+
|
108
|
+
if !@version.nil?
|
109
|
+
s << @version.to_s
|
110
|
+
elsif !@major.nil?
|
111
|
+
s << @major.to_s
|
112
|
+
s << ".#{@minor}" unless @minor.nil?
|
113
|
+
s << ".#{@patch}" unless @patch.nil?
|
114
|
+
s << "-#{@prerelease}" unless @prerelease.nil?
|
115
|
+
s << "+#{@build_meta}" unless @build_meta.nil?
|
130
116
|
end
|
131
|
-
|
117
|
+
|
132
118
|
return s
|
133
119
|
end
|
134
120
|
end
|
data/lib/raketeer/util.rb
CHANGED
@@ -1,70 +1,84 @@
|
|
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
|
module Raketeer
|
25
11
|
###
|
26
|
-
# @author Jonathan Bradley Whited
|
12
|
+
# @author Jonathan Bradley Whited
|
27
13
|
# @since 0.2.2
|
28
14
|
###
|
29
15
|
module Util
|
30
16
|
# @since 0.2.4
|
31
|
-
TRUE_BOOLS = [
|
32
|
-
|
33
|
-
|
17
|
+
TRUE_BOOLS = %w[ 1 on t true y yes ].freeze
|
18
|
+
|
19
|
+
# This is pretty hacky...
|
20
|
+
#
|
21
|
+
# @since 0.2.8
|
22
|
+
def self.find_github_username
|
23
|
+
Dir.glob('*.gemspec') do |file|
|
24
|
+
File.foreach(file) do |line|
|
25
|
+
md = line.match(%r{(github\.com/)([^/]+)}i)
|
26
|
+
|
27
|
+
next if md.nil? || md.length < 3
|
28
|
+
|
29
|
+
return md[2].gsub(/\s+/,'')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
return nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.find_main_executable(bin_dir='bin')
|
34
37
|
# Try the bin/ dir
|
35
38
|
main_exe = Dir.glob(File.join(bin_dir,'*'))
|
36
|
-
|
39
|
+
|
37
40
|
return File.basename(main_exe[0]) if main_exe.length == 1
|
38
|
-
|
41
|
+
|
39
42
|
# Try using the main module
|
40
|
-
main_mod = find_main_module
|
41
|
-
|
42
|
-
if !main_mod.nil?
|
43
|
+
main_mod = find_main_module
|
44
|
+
|
45
|
+
if !main_mod.nil?
|
43
46
|
main_exe = File.join(bin_dir,main_mod)
|
44
|
-
|
47
|
+
|
45
48
|
return main_mod if File.exist?(main_exe)
|
46
49
|
end
|
47
|
-
|
50
|
+
|
48
51
|
return nil
|
49
52
|
end
|
50
|
-
|
51
|
-
def self.find_main_module()
|
53
|
+
|
54
|
+
def self.find_main_module(lib_dir='lib')
|
52
55
|
# Try the lib/ dir
|
53
|
-
main_file = Dir.glob(File.join(
|
54
|
-
|
56
|
+
main_file = Dir.glob(File.join(lib_dir,'*.rb'))
|
57
|
+
|
55
58
|
return File.basename(main_file[0],'.*') if main_file.length == 1
|
56
|
-
|
59
|
+
|
57
60
|
# Try the Gemspec
|
58
61
|
main_file = Dir.glob('*.gemspec')
|
59
|
-
|
62
|
+
|
60
63
|
return File.basename(main_file[0],'.*') if main_file.length == 1
|
61
|
-
|
64
|
+
|
62
65
|
return nil
|
63
66
|
end
|
64
|
-
|
67
|
+
|
68
|
+
# @since 0.2.7
|
69
|
+
def self.get_env_bool(env_name,def_value=nil)
|
70
|
+
value = ENV[env_name]
|
71
|
+
|
72
|
+
if value.nil? || (value = value.to_s.strip).empty?
|
73
|
+
return def_value
|
74
|
+
end
|
75
|
+
|
76
|
+
return to_bool(value)
|
77
|
+
end
|
78
|
+
|
65
79
|
# @since 0.2.4
|
66
80
|
def self.to_bool(obj)
|
67
|
-
return TRUE_BOOLS.include?(obj.to_s
|
81
|
+
return TRUE_BOOLS.include?(obj.to_s.downcase)
|
68
82
|
end
|
69
83
|
end
|
70
84
|
end
|
data/lib/raketeer/version.rb
CHANGED
@@ -1,40 +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
|
module Raketeer
|
25
|
-
VERSION = '0.2.
|
26
|
-
|
11
|
+
VERSION = '0.2.10'
|
12
|
+
|
27
13
|
# @since 0.2.4
|
28
14
|
DEP_VERSIONS = {
|
29
|
-
'irb' => '
|
30
|
-
}
|
31
|
-
|
15
|
+
'irb' => '>= 1.0'
|
16
|
+
}.freeze
|
17
|
+
|
32
18
|
# @since 0.2.4
|
33
19
|
def self.try_require_dev(gem_name)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
raise e.exception("Add development dependency: '#{gem_name}','#{DEP_VERSIONS[gem_name]}'")
|
38
|
-
end
|
20
|
+
require gem_name
|
21
|
+
rescue LoadError => e
|
22
|
+
raise e.exception("Add development dependency: '#{gem_name}','#{DEP_VERSIONS[gem_name]}'")
|
39
23
|
end
|
40
24
|
end
|
data/raketeer.gemspec
CHANGED
@@ -1,74 +1,58 @@
|
|
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
|
lib = File.expand_path(File.join('..','lib'),__FILE__)
|
24
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
7
|
|
26
8
|
require 'raketeer/version'
|
27
9
|
|
28
|
-
Gem::Specification.new
|
10
|
+
Gem::Specification.new do |spec|
|
29
11
|
spec.name = 'raketeer'
|
30
12
|
spec.version = Raketeer::VERSION
|
31
|
-
spec.authors = ['Jonathan Bradley Whited
|
13
|
+
spec.authors = ['Jonathan Bradley Whited']
|
32
14
|
spec.email = ['bradley@esotericpig.com']
|
33
15
|
spec.licenses = ['LGPL-3.0-or-later']
|
34
16
|
spec.homepage = 'https://github.com/esotericpig/raketeer'
|
35
17
|
spec.summary = 'Extra Ruby Rake Tasks.'
|
36
|
-
spec.description =
|
37
|
-
|
18
|
+
spec.description = <<-DESC
|
19
|
+
Extra Ruby Rake Tasks for bumping the version, GitHub Packages, Nokogiri, IRB, running, etc.
|
20
|
+
DESC
|
21
|
+
|
38
22
|
spec.metadata = {
|
39
23
|
'bug_tracker_uri' => 'https://github.com/esotericpig/raketeer/issues',
|
40
24
|
'changelog_uri' => 'https://github.com/esotericpig/raketeer/blob/master/CHANGELOG.md',
|
41
25
|
'homepage_uri' => 'https://github.com/esotericpig/raketeer',
|
42
26
|
'source_code_uri' => 'https://github.com/esotericpig/raketeer'
|
43
27
|
}
|
44
|
-
|
28
|
+
|
45
29
|
spec.require_paths = ['lib']
|
46
|
-
|
30
|
+
|
47
31
|
spec.files = Dir.glob(File.join("{#{spec.require_paths.join(',')}}",'**','*.{erb,rb}')) +
|
48
32
|
Dir.glob(File.join('{test,yard}','**','*.{erb,rb}')) +
|
49
|
-
%W
|
50
|
-
%w
|
51
|
-
|
33
|
+
%W[ Gemfile #{spec.name}.gemspec Rakefile ] +
|
34
|
+
%w[ CHANGELOG.md LICENSE.txt README.md ]
|
35
|
+
|
52
36
|
spec.required_ruby_version = '>= 2.1.10'
|
53
|
-
|
37
|
+
|
54
38
|
# TODO: also add the below comment to the README & reword for user
|
55
|
-
#
|
39
|
+
#
|
56
40
|
# If it is a dependency specific to a task, then it should probably be added
|
57
41
|
# as a development dependency (not a runtime dependency) so that a bunch of
|
58
42
|
# non-essential dependencies (to the user) are not added.
|
59
|
-
#
|
43
|
+
#
|
60
44
|
# For example, if the user only uses the Nokogiri tasks, then they don't need
|
61
45
|
# the IRB dependency.
|
62
|
-
#
|
46
|
+
#
|
63
47
|
# Therefore, it is up to the user to add the dependencies they need.
|
64
48
|
# If the user uses the IRB task, then they will have to add 'irb' as a
|
65
49
|
# development dependency in their own project's Gemspec.
|
66
|
-
|
50
|
+
|
67
51
|
dv = Raketeer::DEP_VERSIONS
|
68
|
-
|
69
|
-
spec.add_runtime_dependency 'rake'
|
70
|
-
|
71
|
-
spec.add_development_dependency 'bundler','~>
|
52
|
+
|
53
|
+
spec.add_runtime_dependency 'rake'
|
54
|
+
|
55
|
+
spec.add_development_dependency 'bundler','~> 2.2'
|
72
56
|
spec.add_development_dependency 'irb' ,dv['irb'] # For IRBTask
|
73
57
|
spec.add_development_dependency 'yard' ,'~> 0.9' # For documentation
|
74
58
|
end
|