bake-gem 0.4.0 → 0.6.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: 56f25a569c1ad97d712dd23c2651d425f48934744ae1f93404109cfd5ca4df79
4
- data.tar.gz: f3f4c84f836f42c1b25040dd72ae0f0fee003a3e74071aa0e471840edb130a20
3
+ metadata.gz: 73b07dbaea11129cd0e9022c476330602dbd3aeeec3fe69064bd365d20976665
4
+ data.tar.gz: 42675a6c56c29dd54e5a103a6eee4ca5e42febf8f93783ed1633fe9cb9438db6
5
5
  SHA512:
6
- metadata.gz: db2c62ccb6a54db12070f212f61c17481c17fe4aa06f9da1724ed6a5aee48f3ce6392799589b0d1693de05789ebce4159a3f84efd503290ddd4ffd641d79676d
7
- data.tar.gz: b24640b9579858b9f95b56040dfe47953a11c056c6460f15951a5cf2d5e23e4e4da64c9a5c2ffad4245b3af2dfb07fc3e8301cf44c12057accec94546f9a2dd1
6
+ metadata.gz: 99578f4c9aca82a9dda42e006b261f84858a6f282f7f725849af9c566e459e5490569f701b37c5ae1f083bcb414c9b32cd06bbf876a574fa52c71f26f9d741d9
7
+ data.tar.gz: fdd496e868dbf915ee81d7f11851cb274770792e39698785c32c38990af88e21b6d7a243f5f0f1a056cca84e1a8cfbd9b49279ecb61d6e541945c353fb6da144
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, by Samuel Williams.
4
+ # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  require_relative '../../../lib/bake/gem/shell'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021, by Samuel Williams.
4
+ # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  require_relative '../../../lib/bake/gem/shell'
7
7
 
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-2022, by Samuel Williams.
4
+ # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  require_relative '../lib/bake/gem/helper'
7
7
  require_relative '../lib/bake/gem/shell'
@@ -44,6 +44,7 @@ end
44
44
 
45
45
  def release(tag: true)
46
46
  @helper.guard_clean
47
+ @helper.guard_default_branch
47
48
 
48
49
  version = @helper.gemspec.version
49
50
 
@@ -19,6 +19,7 @@ module Bake
19
19
  @gemspec = gemspec || find_gemspec
20
20
  end
21
21
 
22
+ attr :root
22
23
  attr :gemspec
23
24
 
24
25
  def version_path
@@ -27,8 +28,8 @@ module Bake
27
28
 
28
29
  VERSION_PATTERN = /VERSION = ['"](?<value>\d+\.\d+\.\d+)(?<pre>.*?)['"]/
29
30
 
30
- def update_version(bump)
31
- return unless version_path = self.version_path
31
+ def update_version(bump, version_path = self.version_path)
32
+ return false unless version_path
32
33
 
33
34
  lines = File.readlines(version_path)
34
35
  version = nil
@@ -49,7 +50,9 @@ module Bake
49
50
  end
50
51
 
51
52
  if version
52
- yield version if block_given?
53
+ if block_given?
54
+ yield version
55
+ end
53
56
 
54
57
  File.write(version_path, lines.join)
55
58
 
@@ -58,11 +61,24 @@ module Bake
58
61
  end
59
62
 
60
63
  def guard_clean
61
- lines = readlines("git", "status", "--porcelain")
64
+ lines = readlines("git", "status", "--porcelain", chdir: @root)
62
65
 
63
66
  if lines.any?
64
67
  raise "Repository has uncommited changes!\n#{lines.join('')}"
65
68
  end
69
+
70
+ return true
71
+ end
72
+
73
+ def guard_default_branch
74
+ branch = readlines("git", "branch", "--show-current", chdir: @root).first.chomp
75
+ remote_head_branch = readlines("git", "symbolic-ref", "refs/remotes/origin/HEAD", chdir: @root).first.chomp.split('/').last
76
+
77
+ if branch != remote_head_branch
78
+ raise "Current branch is not the default branch: #{branch} != #{remote_head_branch}"
79
+ end
80
+
81
+ return true
66
82
  end
67
83
 
68
84
  # @parameter root [String] The root path for package files.
@@ -81,7 +97,7 @@ module Bake
81
97
  elsif signing_key == true and @gemspec.signing_key.nil?
82
98
  raise ArgumentError, "Signing key is required for signing the gem, but none was specified by the gemspec."
83
99
  end
84
-
100
+
85
101
  ::Gem::Package.build(@gemspec, false, false, output_path)
86
102
  end
87
103
 
@@ -93,8 +109,6 @@ module Bake
93
109
  system("gem", "push", path, *arguments)
94
110
  end
95
111
 
96
- private
97
-
98
112
  def find_gemspec(glob = "*.gemspec")
99
113
  paths = Dir.glob(glob, base: @root).sort
100
114
 
@@ -1,35 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021, by Samuel Williams.
4
+ # Copyright, 2021-2024, by Samuel Williams.
5
+
6
+ require 'console'
7
+ require 'console/event/spawn'
5
8
 
6
9
  module Bake
7
10
  module Gem
8
11
  module Shell
9
12
  def system(*arguments, **options)
10
- Console.logger.info(self, Console::Event::Spawn.for(*arguments, **options))
13
+ Console::Event::Spawn.for(*arguments, **options).emit(self)
11
14
 
12
15
  begin
13
16
  pid = Process.spawn(*arguments, **options)
14
- yield if block_given?
17
+ return yield if block_given?
15
18
  ensure
16
19
  pid, status = Process.wait2(pid) if pid
17
20
 
18
21
  unless status.success?
19
22
  raise "Failed to execute #{arguments}: #{status}!"
20
23
  end
24
+
25
+ return true
21
26
  end
22
27
  end
23
28
 
24
29
  def execute(*arguments, **options)
25
- Console.logger.info(self, Console::Event::Spawn.for(*arguments, **options))
30
+ Console::Event::Spawn.for(*arguments, **options).emit(self)
26
31
 
27
32
  IO.pipe do |input, output|
28
33
  pid = Process.spawn(*arguments, out: output, **options)
29
34
  output.close
30
35
 
31
36
  begin
32
- yield input
37
+ return yield(input)
33
38
  ensure
34
39
  pid, status = Process.wait2(pid)
35
40
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Gem
8
- VERSION = "0.4.0"
8
+ VERSION = "0.6.0"
9
9
  end
10
10
  end
data/lib/bake/gem.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  require_relative "gem/version"
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2021-2023, by Samuel Williams.
3
+ Copyright, 2021-2024, by Samuel Williams.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -2,50 +2,31 @@
2
2
 
3
3
  Provides bake tasks for common gem release workflows.
4
4
 
5
- [![Test](https://github.com/ioquatix/bake-gem/workflows/Test/badge.svg)](https://github.com/ioquatix/bake-gem/actions?workflow=Test)
6
-
7
- ## Installation
8
-
9
- ``` shell
10
- $ bundle add bake-gem
11
- ```
5
+ [![Development Status](https://github.com/ioquatix/bake-gem/workflows/Test/badge.svg)](https://github.com/ioquatix/bake-gem/actions?workflow=Test)
12
6
 
13
7
  ## Usage
14
8
 
15
- ### Local
16
-
17
- Releasing a gem locally is the most typical process.
18
-
19
- ``` shell
20
- $ bake gem:release:version:(major|minor|patch) gem:release
21
- ```
9
+ Please see the [project documentation](https://ioquatix.github.io/bake-gem/) for more details.
22
10
 
23
- This will bump the gem version, commit it, build and push the gem, then tag it.
11
+ - [Getting Started](https://ioquatix.github.io/bake-gem/guides/getting-started/index) - This guide explains how to use `bake-gem` to release gems.
24
12
 
25
- ### Automated
26
-
27
- Releasing a gem via a automated pipeline is also supported. Locally, create a release branch:
13
+ ## Contributing
28
14
 
29
- ``` shell
30
- $ bake gem:release:branch:(major|minor|patch)
31
- ```
15
+ We welcome contributions to this project.
32
16
 
33
- This will create a branch, bump the gem version and commit it. You are then responsible for merging this into master (e.g. using a pull request). Once this is done, to automatically release the gem:
17
+ 1. Fork it.
18
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
19
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
20
+ 4. Push to the branch (`git push origin my-new-feature`).
21
+ 5. Create new Pull Request.
34
22
 
35
- ``` shell
36
- $ export RUBYGEMS_HOST=...
37
- $ export GEM_HOST_API_KEY=...
23
+ ### Developer Certificate of Origin
38
24
 
39
- $ bake gem:release
40
- ```
25
+ 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.
41
26
 
42
- ## Contributing
27
+ ### Contributor Covenant
43
28
 
44
- 1. Fork it
45
- 2. Create your feature branch (`git checkout -b my-new-feature`)
46
- 3. Commit your changes (`git commit -am 'Add some feature'`)
47
- 4. Push to the branch (`git push origin my-new-feature`)
48
- 5. Create new Pull Request
29
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
49
30
 
50
31
  ## See Also
51
32
 
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.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,50 +37,22 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2023-05-01 00:00:00.000000000 Z
40
+ date: 2024-06-10 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
- name: bundler
43
+ name: console
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
48
+ version: '1.25'
49
+ type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: covered
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
55
+ version: '1.25'
84
56
  description:
85
57
  email:
86
58
  executables: []
@@ -100,7 +72,9 @@ homepage: https://github.com/ioquatix/bake-gem
100
72
  licenses:
101
73
  - MIT
102
74
  metadata:
75
+ documentation_uri: https://ioquatix.github.io/bake-gem/
103
76
  funding_uri: https://github.com/sponsors/ioquatix/
77
+ source_code_uri: https://github.com/ioquatix/bake-gem.git
104
78
  post_install_message:
105
79
  rdoc_options: []
106
80
  require_paths:
@@ -109,14 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
83
  requirements:
110
84
  - - ">="
111
85
  - !ruby/object:Gem::Version
112
- version: 2.3.0
86
+ version: '3.1'
113
87
  required_rubygems_version: !ruby/object:Gem::Requirement
114
88
  requirements:
115
89
  - - ">="
116
90
  - !ruby/object:Gem::Version
117
91
  version: '0'
118
92
  requirements: []
119
- rubygems_version: 3.4.10
93
+ rubygems_version: 3.5.9
120
94
  signing_key:
121
95
  specification_version: 4
122
96
  summary: Release management for Ruby gems.
metadata.gz.sig CHANGED
Binary file