bake-gem 0.13.0 → 0.14.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: 92e701ad0396f8ba45c9392081df802445fdf23e0181518927806d7d425b9979
4
- data.tar.gz: fd7c9dffebf368a8d080351163e6a9202fddc59cf4da6143d5184c1022c4e270
3
+ metadata.gz: c8159704892dcd4d98b3562f7c4867a24e4efa26936dbda61f125e1d50173eea
4
+ data.tar.gz: 4c0001d022cef9b2a9a8eeae6d7a7a90e10b42a11cdb6311cbed87d6b2817db6
5
5
  SHA512:
6
- metadata.gz: 35eba973249b282bc4dafd5fcdf8ee58442a2a64bdcc8bc44a3f5c44e6c38ce014917b9300e2f94892413469ba49d3192d0e8c3667e7c652b5f289d9b5634a11
7
- data.tar.gz: 69140b5f782db2d5ddbaae4789cf8357b41b07fe99302ff519f19f2982f7e9f2e2760cf75780211cf9f6783b4bbaf2055c6ea2353255d22fb88dd49be1ba3f42
6
+ metadata.gz: bd14d2adc3026d423bc75826dcfc4d8fde6777c0df54d68fe6ba0a995e84081748a48e981317fb7312a9cffff81eaa7557d4070fc67ca8c3547d98525bc0329f
7
+ data.tar.gz: f9e1951d82b11086f3c05c77098d2b6b3ac12a51ead185e809874eaf88e85b15a6877fb8da89eea05e119039f4cc0b3feef898b157f09de93c5d36dc4532623b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
 
6
6
  # Increment the patch number of the current version.
7
7
  def patch
data/bake/gem/release.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Released under the MIT License.
2
- # Copyright, 2021-2025, by Samuel Williams.
2
+ # Copyright, 2021-2026, by Samuel Williams.
3
3
 
4
4
  # frozen_string_literal: true
5
5
 
data/bake/gem.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
  # Copyright, 2025, by Copilot.
6
6
 
7
7
  # Initialize the gem context with helper for gem operations.
@@ -31,8 +31,14 @@ end
31
31
  # Build and install the gem into system gems.
32
32
  # @parameter local [Boolean] only use locally available caches.
33
33
  def install(local: false)
34
- # For installing the gem, don't bother with signinng it:
35
- path = @helper.build_gem(signing_key: false)
34
+ changes = @helper.uncommitted_changes
35
+
36
+ if changes.any?
37
+ Console.warn(self, "Installing from clean git worktree; uncommitted changes are not included in the installed gem.", changes: changes.map(&:chomp))
38
+ end
39
+
40
+ # For installing the gem, don't bother with signing it:
41
+ path = @helper.build_gem_in_worktree(signing_key: false)
36
42
 
37
43
  arguments = []
38
44
  arguments << "--local" if local
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
  # Copyright, 2025, by Copilot.
6
6
 
7
7
  require "rubygems"
@@ -103,7 +103,17 @@ module Bake
103
103
  # @returns [String | Nil] The path to the version file, or nil if not found.
104
104
  def version_path
105
105
  if @gemspec
106
- @gemspec.files.grep(/lib(.*?)\/version.rb/).first
106
+ candidates = @gemspec.files.grep(/lib(.*?)\/version.rb/)
107
+
108
+ # If only one version file exists, use it:
109
+ return candidates.first if candidates.size == 1
110
+
111
+ # Try to match the gem name convention (e.g., "protocol-rack" -> "lib/protocol/rack/version.rb"):
112
+ expected_path = "lib/#{@gemspec.name.gsub('-', '/')}/version.rb"
113
+ return expected_path if candidates.include?(expected_path)
114
+
115
+ # Fall back to the shortest path (most likely to be the main gem version):
116
+ return candidates.min_by(&:length)
107
117
  end
108
118
  end
109
119
 
@@ -141,7 +151,7 @@ module Bake
141
151
  # @returns [Boolean] True if the repository is clean.
142
152
  # @raises [RuntimeError] If there are uncommitted changes in the repository.
143
153
  def guard_clean
144
- lines = readlines("git", "status", "--porcelain", chdir: @root)
154
+ lines = uncommitted_changes
145
155
 
146
156
  if lines.any?
147
157
  raise "Repository has uncommited changes!\n#{lines.join('')}"
@@ -150,6 +160,12 @@ module Bake
150
160
  return true
151
161
  end
152
162
 
163
+ # Get the list of uncommitted changes in the repository.
164
+ # @returns [Array(String)] The porcelain status lines for uncommitted changes.
165
+ def uncommitted_changes
166
+ readlines("git", "status", "--porcelain", chdir: @root)
167
+ end
168
+
153
169
  # Verify that the last commit was not a version bump.
154
170
  # @returns [Boolean] True if the last commit was not a version bump.
155
171
  # @raises [RuntimeError] If the last commit was a version bump.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
  # Copyright, 2025, by Copilot.
6
6
 
7
7
  require "console"
@@ -11,6 +11,9 @@ module Bake
11
11
  module Gem
12
12
  # Exception raised when a command execution fails.
13
13
  class CommandExecutionError < RuntimeError
14
+ # Initialize the exception with the specified message and process status.
15
+ # @parameter message [String] The error message.
16
+ # @parameter status [Process::Status] The status object of the failed command.
14
17
  def initialize(message, status)
15
18
  super(message)
16
19
  @status = status
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
 
6
6
  module Bake
7
7
  module Gem
8
- VERSION = "0.13.0"
8
+ VERSION = "0.14.0"
9
9
  end
10
10
  end
data/lib/bake/gem.rb CHANGED
@@ -1,7 +1,7 @@
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-2026, by Samuel Williams.
5
5
  # Copyright, 2025, by Copilot.
6
6
 
7
7
  require_relative "gem/version"
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2021-2025, by Samuel Williams.
3
+ Copyright, 2021-2026, by Samuel Williams.
4
4
  Copyright, 2025, by Copilot.
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
data/readme.md CHANGED
@@ -14,6 +14,10 @@ Please see the [project documentation](https://ioquatix.github.io/bake-gem/) for
14
14
 
15
15
  Please see the [project releases](https://ioquatix.github.io/bake-gem/releases/index) for all releases.
16
16
 
17
+ ### v0.13.1
18
+
19
+ - Better `version.rb` detection in `version_path` method.
20
+
17
21
  ### v0.13.0
18
22
 
19
23
  - Add `after_gem_release` hook for post-release actions.
@@ -54,6 +58,22 @@ We welcome contributions to this project.
54
58
  4. Push to the branch (`git push origin my-new-feature`).
55
59
  5. Create new Pull Request.
56
60
 
61
+ ### Running Tests
62
+
63
+ To run the test suite:
64
+
65
+ ``` shell
66
+ bundle exec sus
67
+ ```
68
+
69
+ ### Making Releases
70
+
71
+ To make a new release:
72
+
73
+ ``` shell
74
+ bundle exec bake gem:release:patch # or minor or major
75
+ ```
76
+
57
77
  ### Developer Certificate of Origin
58
78
 
59
79
  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.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.13.1
4
+
5
+ - Better `version.rb` detection in `version_path` method.
6
+
3
7
  ## v0.13.0
4
8
 
5
9
  - Add `after_gem_release` hook for post-release actions.
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.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file