bake-gem 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7134f75e4aa9a9df4257010e618c642992afabc3ef2b8e1ee7526df2cec03803
4
- data.tar.gz: a021ef6de34278c00449f6e07f13ddc6c375ce73e40bf20bccbedc48a1be578e
3
+ metadata.gz: eb1522e1efc020b5ba5344b8abdb7d483aba9a5e27761ad290d9660206d6edb7
4
+ data.tar.gz: b91569a810a601f3611231132939b5bd3e97c8d2ef37817ef68dbff52d700fb7
5
5
  SHA512:
6
- metadata.gz: a463cd528579aef8887ce8d555e74014259b8cace35245506b2d08c91a55bb6210acc179f2cc4d81a97f34bfa1a24230c439dfb0831c3cccc58b23e789304988
7
- data.tar.gz: ff26660be13c706fe5363dd46eee25252985dedeabddb3346c4bd19213067234f16ef3a9eeb10db0b0d73ede4f5d9934cb730aeafe352a85a3b0f576b463ac10
6
+ metadata.gz: 8930be16cf24b8d04243daf39a3befc1578c24f8620a786f85495724f3c84b59c94defe24da5d64d6856f8db77cda5ff60b4bba256dbaf2baacc1b46df2e660f
7
+ data.tar.gz: 20e82111f1b291e23165468b003ab4da12f793393be019e7a142b36cf882273fc58ea98ab473e6d8597f49a4f6b0948ccf5f442fc617a854922fddbf66475f77
checksums.yaml.gz.sig CHANGED
Binary file
data/bake/gem.rb CHANGED
@@ -41,8 +41,11 @@ def files
41
41
  end
42
42
 
43
43
  # Build the gem into the pkg directory.
44
- def build
45
- @helper.build_gem
44
+ # @parameter root [String] The root directory to build the gem into. Defaults to `pkg`.
45
+ # @parameter signing_key [Boolean] Whether to use a signing key.
46
+ def build(root: "pkg", signing_key: nil)
47
+ pp signing_key: signing_key
48
+ @helper.build_gem(root: root, signing_key: signing_key)
46
49
  end
47
50
 
48
51
  # Build and install the gem into system gems.
@@ -78,14 +81,19 @@ def release(tag: true)
78
81
  # If we are on a branch, push, otherwise just push the tags (assuming shallow checkout):
79
82
  if current_branch
80
83
  system("git", "push")
81
- else
82
- system("git", "push", "--tags")
83
84
  end
85
+
86
+ system("git", "push", "--tags")
84
87
  end
85
88
 
86
89
  private
87
90
 
88
91
  # Figure out if there is a current branch, if not, return `nil`.
89
92
  def current_branch
90
- readlines("git", "branch", "--show-current").first&.chomp
93
+ # We originally used this but it is not supported by older versions of git.
94
+ # readlines("git", "branch", "--show-current").first&.chomp
95
+
96
+ readlines("git", "symbolic-ref", "--short", "--quiet", "HEAD").first&.chomp
97
+ rescue
98
+ nil
91
99
  end
@@ -83,13 +83,22 @@ module Bake
83
83
  end
84
84
 
85
85
  # @parameter root [String] The root path for package files.
86
+ # @parameter signing_key [String | Nil] The signing key to use for signing the package.
86
87
  # @returns [String] The path to the built gem package.
87
- def build_gem(root: "pkg")
88
+ def build_gem(root: "pkg", signing_key: nil)
88
89
  # Ensure the output directory exists:
89
90
  FileUtils.mkdir_p("pkg")
90
91
 
91
92
  output_path = File.join('pkg', @gemspec.file_name)
92
93
 
94
+ if signing_key == false
95
+ @gemspec.signing_key = nil
96
+ elsif signing_key.is_a?(String)
97
+ @gemspec.signing_key = signing_key
98
+ elsif signing_key == true and @gemspec.signing_key.nil?
99
+ raise ArgumentError, "Signing key is required for signing the gem, but none was specified by the gemspec."
100
+ end
101
+
93
102
  ::Gem::Package.build(@gemspec, false, false, output_path)
94
103
  end
95
104
 
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Bake
24
24
  module Gem
25
- VERSION = "0.2.8"
25
+ VERSION = "0.3.0"
26
26
  end
27
27
  end
data/lib/bake/gem.rb CHANGED
@@ -1,8 +1,23 @@
1
- require "bake/gem/version"
1
+ # frozen_string_literal: true
2
2
 
3
- module Bake
4
- module Gem
5
- class Error < StandardError; end
6
- # Your code goes here...
7
- end
8
- end
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require_relative "gem/version"
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.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -36,8 +36,50 @@ cert_chain:
36
36
  RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
37
  HiLJ8VOFx6w=
38
38
  -----END CERTIFICATE-----
39
- date: 2022-05-03 00:00:00.000000000 Z
40
- dependencies: []
39
+ date: 2022-07-31 00:00:00.000000000 Z
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: covered
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description:
42
84
  email:
43
85
  executables: []
@@ -71,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
113
  - !ruby/object:Gem::Version
72
114
  version: '0'
73
115
  requirements: []
74
- rubygems_version: 3.1.6
116
+ rubygems_version: 3.3.7
75
117
  signing_key:
76
118
  specification_version: 4
77
119
  summary: Release management for Ruby gems.
metadata.gz.sig CHANGED
Binary file