bake-gem 0.9.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 307b46bb648004706745207f0c6d53fcd1a30b8c2bfed945b57f23a2d65685d8
4
- data.tar.gz: 3ed9dee4422cf593efe9ca45a92b1db0e55f2cf4d863f8e38d1b46fa5ce7b2cc
3
+ metadata.gz: 9350c6f56e7017043a435dad7b6a1c33c8e5094607928bd584bef68701ee143e
4
+ data.tar.gz: 1e4ec888c6149c52f91575edc84dd5c65940349cb74cb7a3ec20e71678af693d
5
5
  SHA512:
6
- metadata.gz: 3984cc693ce4a547ab0c880a396738b5c9f74c16bf604b8c56494ad7aafe9d68f8b2468a52c52d816532c290a6828b4236a0274f535842850ecf38d7f166cc7a
7
- data.tar.gz: dffb5ba0adff68a801aa29a0cb76275cee66d3218227e2333ffc2dae98da546a86faef310ba11b0045dd447a4bbb08fc7ad53711ff036e6948d9b424fb1756f5
6
+ metadata.gz: 7571129ebde2c248ca42c6b30231b2299a8485f8a47ae62eb46e56bb626ffde738d5878e7273b8482cea821a68e89260f161e11fa6c114b0b19835f9f3ba093e
7
+ data.tar.gz: 0eb9329e17cf0d610d9da131717fd20bc20f671f6574afa405f41c1231aa8d5ebf4b4e1e030d16335a1ea08dd069fd4abc5dc51df4c3f66ddbeba9582234cf2e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2024, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
- require_relative '../../../lib/bake/gem/shell'
6
+ require_relative "../../../lib/bake/gem/shell"
7
7
 
8
8
  include Bake::Gem::Shell
9
9
 
@@ -27,13 +27,13 @@ end
27
27
  # @parameter bump [Array(Integer | Nil)] the version bump to apply before publishing, e.g. `0,1,0` to increment minor version number.
28
28
  # @parameter message [String] the git commit message to use.
29
29
  def commit(bump, message: "Bump version.")
30
- release = context.lookup('gem:release')
30
+ release = context.lookup("gem:release")
31
31
  helper = release.instance.helper
32
32
  gemspec = helper.gemspec
33
33
 
34
34
  # helper.guard_clean
35
35
 
36
- version_path = context.lookup('gem:release:version:increment').call(bump, message: message)
36
+ version_path = context.lookup("gem:release:version:increment").call(bump, message: message)
37
37
 
38
38
  if version_path
39
39
  system("git", "checkout", "-b", "release-v#{gemspec.version}")
@@ -42,4 +42,10 @@ def commit(bump, message: "Bump version.")
42
42
  else
43
43
  raise "Could not find version number!"
44
44
  end
45
+
46
+ return {
47
+ version: gemspec.version,
48
+ version_path: version_path,
49
+ branch: "release-v#{gemspec.version}",
50
+ }
45
51
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2024, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
- require_relative '../../../lib/bake/gem/shell'
6
+ require_relative "../../../lib/bake/gem/shell"
7
7
 
8
8
  include Bake::Gem::Shell
9
9
 
@@ -27,20 +27,23 @@ end
27
27
  # @parameter bump [Array(Integer | Nil)] the version bump to apply before publishing, e.g. `0,1,0` to increment minor version number.
28
28
  # @parameter message [String] the git commit message to use.
29
29
  def increment(bump, message: "Bump version.")
30
- release = context.lookup('gem:release')
30
+ release = context.lookup("gem:release")
31
31
  helper = release.instance.helper
32
32
  gemspec = helper.gemspec
33
33
 
34
34
  helper.update_version(bump) do |version|
35
- version_string = version.join('.')
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 = ::Gem::Version.new(version_string)
38
+ gemspec.version = version.join
41
39
 
42
40
  after_increment(version)
43
41
  end
42
+
43
+ return {
44
+ version: gemspec.version,
45
+ version_path: helper.version_path,
46
+ }
44
47
  end
45
48
 
46
49
  # Increments the version and commits the changes on the current branch.
@@ -48,7 +51,7 @@ end
48
51
  # @parameter bump [Array(Integer | Nil)] the version bump to apply before publishing, e.g. `0,1,0` to increment minor version number.
49
52
  # @parameter message [String] the git commit message to use.
50
53
  def commit(bump, message: "Bump version.")
51
- release = context.lookup('gem:release')
54
+ release = context.lookup("gem:release")
52
55
  helper = release.instance.helper
53
56
 
54
57
  helper.guard_clean
@@ -61,10 +64,15 @@ def commit(bump, message: "Bump version.")
61
64
  else
62
65
  raise "Could not find version number!"
63
66
  end
67
+
68
+ return {
69
+ version: helper.gemspec.version,
70
+ version_path: version_path,
71
+ }
64
72
  end
65
73
 
66
74
  protected
67
75
 
68
76
  def after_increment(version)
69
- context['after_gem_release_version_increment']&.call(version)
77
+ context["after_gem_release_version_increment"]&.call(version)
70
78
  end
data/bake/gem.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2024, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
- require_relative '../lib/bake/gem/helper'
7
- require_relative '../lib/bake/gem/shell'
6
+ require_relative "../lib/bake/gem/helper"
7
+ require_relative "../lib/bake/gem/shell"
8
8
 
9
9
  include Bake::Gem::Shell
10
10
 
@@ -40,6 +40,12 @@ def install(local: false)
40
40
  arguments << "--local" if local
41
41
 
42
42
  @helper.install_gem(*arguments, path: path)
43
+
44
+ return {
45
+ name: @helper.gemspec.name,
46
+ version: @helper.gemspec.version,
47
+ package_path: path,
48
+ }
43
49
  end
44
50
 
45
51
  # Release the gem by building it, pushing it to the server, and tagging the release.
@@ -69,6 +75,13 @@ def release(tag: true)
69
75
  end
70
76
 
71
77
  system("git", "push", "--tags")
78
+
79
+ return {
80
+ name: @helper.gemspec.name,
81
+ version: @helper.gemspec.version,
82
+ package_path: path,
83
+ tag: name,
84
+ }
72
85
  end
73
86
 
74
87
  private
@@ -1,16 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2023, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
- require 'rubygems'
7
- require 'rubygems/package'
8
- require 'fileutils'
6
+ require "rubygems"
7
+ require "rubygems/package"
8
+ require "fileutils"
9
9
 
10
- require_relative 'shell'
10
+ 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
- version = nil
91
+ new_version = nil
36
92
 
37
93
  lines.each do |line|
38
- if match = line.match(VERSION_PATTERN)
39
- version = match[:value].split(/\./).map(&:to_i)
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 version
99
+ if new_version
100
+ File.write(version_path, lines.join)
101
+
53
102
  if block_given?
54
- yield version
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
@@ -77,7 +124,7 @@ module Bake
77
124
  # Ensure the output directory exists:
78
125
  FileUtils.mkdir_p("pkg")
79
126
 
80
- output_path = File.join('pkg', @gemspec.file_name)
127
+ output_path = File.join("pkg", @gemspec.file_name)
81
128
 
82
129
  if signing_key == false
83
130
  @gemspec.signing_key = nil
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2024, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
- require 'console'
7
- require 'console/event/spawn'
6
+ require "console"
7
+ require "console/event/spawn"
8
8
 
9
9
  module Bake
10
10
  module Gem
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2023, by Samuel Williams.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
5
 
6
6
  module Bake
7
7
  module Gem
8
- VERSION = "0.9.0"
8
+ VERSION = "0.11.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -10,6 +10,14 @@ 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
+ ## Releases
14
+
15
+ Please see the [project releases](https://ioquatix.github.io/bake-gem/releases/index) for all releases.
16
+
17
+ ### v0.11.0
18
+
19
+ - Improved bake task return values.
20
+
13
21
  ## See Also
14
22
 
15
23
  - [Bake](https://github.com/ioquatix/bake) — The bake task execution tool.
@@ -26,8 +34,8 @@ We welcome contributions to this project.
26
34
 
27
35
  ### Developer Certificate of Origin
28
36
 
29
- This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
37
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
30
38
 
31
- ### Contributor Covenant
39
+ ### Community Guidelines
32
40
 
33
- This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
41
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
data/releases.md ADDED
@@ -0,0 +1,5 @@
1
+ # Releases
2
+
3
+ ## v0.11.0
4
+
5
+ - Improved bake task return values.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
@@ -37,7 +36,7 @@ cert_chain:
37
36
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
37
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
38
  -----END CERTIFICATE-----
40
- date: 2024-08-22 00:00:00.000000000 Z
39
+ date: 1980-01-02 00:00:00.000000000 Z
41
40
  dependencies:
42
41
  - !ruby/object:Gem::Dependency
43
42
  name: console
@@ -53,8 +52,6 @@ dependencies:
53
52
  - - "~>"
54
53
  - !ruby/object:Gem::Version
55
54
  version: '1.25'
56
- description:
57
- email:
58
55
  executables: []
59
56
  extensions: []
60
57
  extra_rdoc_files: []
@@ -68,6 +65,7 @@ files:
68
65
  - lib/bake/gem/version.rb
69
66
  - license.md
70
67
  - readme.md
68
+ - releases.md
71
69
  homepage: https://github.com/ioquatix/bake-gem
72
70
  licenses:
73
71
  - MIT
@@ -75,7 +73,6 @@ metadata:
75
73
  documentation_uri: https://ioquatix.github.io/bake-gem/
76
74
  funding_uri: https://github.com/sponsors/ioquatix/
77
75
  source_code_uri: https://github.com/ioquatix/bake-gem.git
78
- post_install_message:
79
76
  rdoc_options: []
80
77
  require_paths:
81
78
  - lib
@@ -83,15 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
80
  requirements:
84
81
  - - ">="
85
82
  - !ruby/object:Gem::Version
86
- version: '3.1'
83
+ version: '3.2'
87
84
  required_rubygems_version: !ruby/object:Gem::Requirement
88
85
  requirements:
89
86
  - - ">="
90
87
  - !ruby/object:Gem::Version
91
88
  version: '0'
92
89
  requirements: []
93
- rubygems_version: 3.5.11
94
- signing_key:
90
+ rubygems_version: 3.6.7
95
91
  specification_version: 4
96
92
  summary: Release management for Ruby gems.
97
93
  test_files: []
metadata.gz.sig CHANGED
Binary file