bake-gem 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/gem/release/version.rb +2 -4
- data/lib/bake/gem/helper.rb +65 -18
- data/lib/bake/gem/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436620eb899794e3709390307a7d665798d1808b2cdded1a151c005db9c3f55d
|
4
|
+
data.tar.gz: c438bf0f5436b9eb5935661d8d9b4b4241050f7d5dfd4f0da086a4fe9ff48e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb4833a86116ebdcfb5949f5d8960473ded2595ad0fbd3d533988a79fb8158535c43ffeeb1755e5ac657a2f884f863f99c3d4dca562a2efc2f2c8b53abe8735
|
7
|
+
data.tar.gz: 5821fefb80eac7a536e54c0f4df700ff0d800938bd72e4ad4c364f1262878247a68922ae70474bfc57a44821efad2ae7cf394ae19abef5fe12d0a9038887f2dd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/gem/release/version.rb
CHANGED
@@ -32,12 +32,10 @@ def increment(bump, message: "Bump version.")
|
|
32
32
|
gemspec = helper.gemspec
|
33
33
|
|
34
34
|
helper.update_version(bump) do |version|
|
35
|
-
|
36
|
-
|
37
|
-
Console.logger.info(self) {"Updated version to #{version_string}"}
|
35
|
+
Console.logger.info(self) {"Updated version: #{version}"}
|
38
36
|
|
39
37
|
# Ensure that any subsequent tasks use the correct version!
|
40
|
-
gemspec.version =
|
38
|
+
gemspec.version = version.join
|
41
39
|
|
42
40
|
after_increment(version)
|
43
41
|
end
|
data/lib/bake/gem/helper.rb
CHANGED
@@ -11,6 +11,64 @@ require_relative 'shell'
|
|
11
11
|
|
12
12
|
module Bake
|
13
13
|
module Gem
|
14
|
+
class Version
|
15
|
+
LINE_PATTERN = /VERSION = ['"](?<version>(?<parts>\d+\.\d+\.\d+)(-(?<suffix>.*?))?)['"]/
|
16
|
+
|
17
|
+
# If the line contains a version constant, update it using the provided block.
|
18
|
+
def self.update_version(line)
|
19
|
+
if match = line.match(LINE_PATTERN)
|
20
|
+
parts = match[:parts].split(/\./).map(&:to_i)
|
21
|
+
suffix = match[:suffix]
|
22
|
+
|
23
|
+
version = self.new(parts, suffix)
|
24
|
+
|
25
|
+
yield version
|
26
|
+
|
27
|
+
line.sub!(match[:version], version.join)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(parts, suffix)
|
32
|
+
@parts = parts
|
33
|
+
@suffix = suffix
|
34
|
+
end
|
35
|
+
|
36
|
+
def release?
|
37
|
+
@suffix.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Join all parts together to form a version string.
|
41
|
+
def join
|
42
|
+
if @suffix
|
43
|
+
return "#{@parts.join('.')}-#{@suffix}"
|
44
|
+
else
|
45
|
+
return @parts.join('.')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# The version string with a "v" prefix.
|
50
|
+
def to_s
|
51
|
+
"v#{join}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def increment(bump)
|
55
|
+
bump.each_with_index do |increment, index|
|
56
|
+
if index > @parts.size
|
57
|
+
@suffix = bump[index..-1].join('.')
|
58
|
+
break
|
59
|
+
end
|
60
|
+
|
61
|
+
if increment == 1
|
62
|
+
@parts[index] += 1
|
63
|
+
elsif increment == 0
|
64
|
+
@parts[index] = 0
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
return self
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
14
72
|
class Helper
|
15
73
|
include Shell
|
16
74
|
|
@@ -26,36 +84,25 @@ module Bake
|
|
26
84
|
@gemspec&.files.grep(/lib(.*?)\/version.rb/).first
|
27
85
|
end
|
28
86
|
|
29
|
-
VERSION_PATTERN = /VERSION = ['"](?<value>\d+\.\d+\.\d+)(?<pre>.*?)['"]/
|
30
|
-
|
31
87
|
def update_version(bump, version_path = self.version_path)
|
32
88
|
return false unless version_path
|
33
89
|
|
34
90
|
lines = File.readlines(version_path)
|
35
|
-
|
91
|
+
new_version = nil
|
36
92
|
|
37
93
|
lines.each do |line|
|
38
|
-
|
39
|
-
|
40
|
-
bump.each_with_index do |increment, index|
|
41
|
-
if increment == 1
|
42
|
-
version[index] += 1
|
43
|
-
elsif increment == 0
|
44
|
-
version[index] = 0
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
line.sub!(match[:value], version.join('.'))
|
94
|
+
Version.update_version(line) do |version|
|
95
|
+
new_version = version.increment(bump)
|
49
96
|
end
|
50
97
|
end
|
51
98
|
|
52
|
-
if
|
99
|
+
if new_version
|
100
|
+
File.write(version_path, lines.join)
|
101
|
+
|
53
102
|
if block_given?
|
54
|
-
yield
|
103
|
+
yield new_version
|
55
104
|
end
|
56
105
|
|
57
|
-
File.write(version_path, lines.join)
|
58
|
-
|
59
106
|
return version_path
|
60
107
|
end
|
61
108
|
end
|
data/lib/bake/gem/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bake-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2024-08-
|
40
|
+
date: 2024-08-23 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: console
|
metadata.gz.sig
CHANGED
Binary file
|