bake-gem 0.8.0 → 0.10.0
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
- checksums.yaml.gz.sig +0 -0
- data/bake/gem/release/version.rb +11 -5
- data/bake/gem.rb +2 -0
- data/lib/bake/gem/helper.rb +65 -18
- data/lib/bake/gem/version.rb +1 -1
- data/readme.md +4 -4
- 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,12 @@ 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
|
39
|
+
|
40
|
+
after_increment(version)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -54,9 +54,15 @@ def commit(bump, message: "Bump version.")
|
|
54
54
|
version_path = increment(bump, message: message)
|
55
55
|
|
56
56
|
if version_path
|
57
|
-
system("git", "add",
|
57
|
+
system("git", "add", "--all", chdir: context.root)
|
58
58
|
system("git", "commit", "-m", message, chdir: context.root)
|
59
59
|
else
|
60
60
|
raise "Could not find version number!"
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
|
66
|
+
def after_increment(version)
|
67
|
+
context['after_gem_release_version_increment']&.call(version)
|
68
|
+
end
|
data/bake/gem.rb
CHANGED
@@ -42,6 +42,8 @@ def install(local: false)
|
|
42
42
|
@helper.install_gem(*arguments, path: path)
|
43
43
|
end
|
44
44
|
|
45
|
+
# Release the gem by building it, pushing it to the server, and tagging the release.
|
46
|
+
# @parameter tag [Boolean] Whether to tag the release.
|
45
47
|
def release(tag: true)
|
46
48
|
@helper.guard_clean
|
47
49
|
|
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/readme.md
CHANGED
@@ -10,6 +10,10 @@ Please see the [project documentation](https://ioquatix.github.io/bake-gem/) for
|
|
10
10
|
|
11
11
|
- [Getting Started](https://ioquatix.github.io/bake-gem/guides/getting-started/index) - This guide explains how to use `bake-gem` to release gems.
|
12
12
|
|
13
|
+
## See Also
|
14
|
+
|
15
|
+
- [Bake](https://github.com/ioquatix/bake) — The bake task execution tool.
|
16
|
+
|
13
17
|
## Contributing
|
14
18
|
|
15
19
|
We welcome contributions to this project.
|
@@ -27,7 +31,3 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
|
|
27
31
|
### Contributor Covenant
|
28
32
|
|
29
33
|
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
30
|
-
|
31
|
-
## See Also
|
32
|
-
|
33
|
-
- [Bake](https://github.com/ioquatix/bake) — The bake task execution tool.
|
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-
|
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
|