gemsmith 14.0.2 → 14.2.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.tar.gz.sig +0 -0
- data/{LICENSE.md → LICENSE.adoc} +29 -30
- data/README.adoc +417 -0
- data/bin/gemsmith +1 -1
- data/lib/gemsmith.rb +1 -0
- data/lib/gemsmith/cli.rb +11 -6
- data/lib/gemsmith/generators/bundler_audit.rb +2 -2
- data/lib/gemsmith/generators/git.rb +2 -1
- data/lib/gemsmith/generators/git_cop.rb +1 -1
- data/lib/gemsmith/generators/git_lint.rb +14 -0
- data/lib/gemsmith/generators/rake.rb +3 -3
- data/lib/gemsmith/identity.rb +5 -19
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +11 -12
- data/lib/gemsmith/templates/%gem_name%/.github/ISSUE_TEMPLATE.md.tt +8 -5
- data/lib/gemsmith/templates/%gem_name%/.github/PULL_REQUEST_TEMPLATE.md.tt +6 -6
- data/lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt +5 -5
- data/lib/gemsmith/templates/%gem_name%/CHANGES.md.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/README.md.tt +14 -0
- data/lib/gemsmith/templates/%gem_name%/Rakefile.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/bin/%gem_name%.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/cli.rb.tt +3 -3
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/identity.rb.tt +4 -15
- data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt +2 -2
- metadata +41 -39
- metadata.gz.sig +0 -0
- data/README.md +0 -383
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fec266e5af75d5e73a8406e702430fcbe4e9d007b4206a7f66822801edb6a0ef
|
4
|
+
data.tar.gz: 7f96466a64fe9ea9c0dd29e9ac54e277ff2abd4a08f8c44e186934304285b277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c79e2e4f66f4f6f9c52d6e6ab142a56dbd70871324e5bb1fda2ac96ea36904863021e2ea0800aa90ec4a37ff44e507777c0394837741f671502750325dd2c9a
|
7
|
+
data.tar.gz: 759ec8bd5cd230f47b564ae0b2cafe7e81d345c1d26353614ac4d38ddf3df4995a3cf8b19e28577a7a334b63eb475b3b0cf7ebdca8e831ebf544ac865853d2e4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{LICENSE.md → LICENSE.adoc}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
= Apache License
|
2
2
|
|
3
3
|
Version 2.0, January 2004
|
4
4
|
|
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
|
|
6
6
|
|
7
7
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
8
|
|
9
|
-
|
9
|
+
== 1. Definitions
|
10
10
|
|
11
11
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
12
12
|
Sections 1 through 9 of this document.
|
@@ -54,14 +54,14 @@ Contribution."
|
|
54
54
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
55
55
|
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
56
56
|
|
57
|
-
|
57
|
+
== 2. Grant of Copyright License
|
58
58
|
|
59
59
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
60
60
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
61
61
|
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
62
62
|
distribute the Work and such Derivative Works in Source or Object form.
|
63
63
|
|
64
|
-
|
64
|
+
== 3. Grant of Patent License
|
65
65
|
|
66
66
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
67
67
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
|
|
74
74
|
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
75
75
|
date such litigation is filed.
|
76
76
|
|
77
|
-
|
77
|
+
== 4. Redistribution
|
78
78
|
|
79
79
|
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
80
80
|
or without modifications, and in Source or Object form, provided that You meet the following
|
81
81
|
conditions:
|
82
82
|
|
83
|
-
|
83
|
+
. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
. You must cause any modified files to carry prominent notices stating that You changed the files;
|
86
|
+
and
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
construed as modifying the License.
|
92
|
+
. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
93
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
94
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
95
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
96
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
97
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
98
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
99
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
100
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
101
|
+
additional attribution notices cannot be construed as modifying the License.
|
103
102
|
|
104
103
|
You may add Your own copyright statement to Your modifications and may provide additional or
|
105
104
|
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
106
105
|
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
107
106
|
the Work otherwise complies with the conditions stated in this License.
|
108
107
|
|
109
|
-
|
108
|
+
== 5. Submission of Contributions
|
110
109
|
|
111
110
|
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
112
111
|
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
|
|
114
113
|
the terms of any separate license agreement you may have executed with Licensor regarding such
|
115
114
|
Contributions.
|
116
115
|
|
117
|
-
|
116
|
+
== 6. Trademarks
|
118
117
|
|
119
118
|
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
120
119
|
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
121
120
|
of the Work and reproducing the content of the NOTICE file.
|
122
121
|
|
123
|
-
|
122
|
+
== 7. Disclaimer of Warranty
|
124
123
|
|
125
124
|
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
126
125
|
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
|
|
129
128
|
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
130
129
|
risks associated with Your exercise of permissions under this License.
|
131
130
|
|
132
|
-
|
131
|
+
== 8. Limitation of Liability
|
133
132
|
|
134
133
|
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
135
134
|
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
|
|
139
138
|
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
140
139
|
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
141
140
|
|
142
|
-
|
141
|
+
== 9. Accepting Warranty or Additional Liability
|
143
142
|
|
144
143
|
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
145
144
|
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
@@ -151,11 +150,11 @@ additional liability.
|
|
151
150
|
|
152
151
|
END OF TERMS AND CONDITIONS
|
153
152
|
|
154
|
-
Copyright
|
153
|
+
Copyright link:https://www.alchemists.io[Alchemists].
|
155
154
|
|
156
155
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
157
|
-
compliance with the License. You may obtain a
|
158
|
-
the License.
|
156
|
+
compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
|
157
|
+
of the License.
|
159
158
|
|
160
159
|
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
161
160
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
data/README.adoc
ADDED
@@ -0,0 +1,417 @@
|
|
1
|
+
:toc: macro
|
2
|
+
:toclevels: 5
|
3
|
+
:figure-caption!:
|
4
|
+
|
5
|
+
= Gemsmith
|
6
|
+
|
7
|
+
[link=http://badge.fury.io/rb/gemsmith]
|
8
|
+
image::https://badge.fury.io/rb/gemsmith.svg[Gem Version]
|
9
|
+
[link=https://circleci.com/gh/bkuhlmann/gemsmith]
|
10
|
+
image::https://circleci.com/gh/bkuhlmann/gemsmith.svg?style=svg[Circle CI Status]
|
11
|
+
|
12
|
+
A command line interface for smithing new Ruby gems.
|
13
|
+
|
14
|
+
toc::[]
|
15
|
+
|
16
|
+
== Features
|
17
|
+
|
18
|
+
* Builds a gem skeleton with enhanced Bundler functionality.
|
19
|
+
* Uses link:https://www.alchemists.io/projects/refinements[Refinements] Ruby core library enhancements.
|
20
|
+
* Uses link:https://www.alchemists.io/projects/versionaire[Versionaire] for semantic versioning.
|
21
|
+
* Uses link:https://www.alchemists.io/projects/runcom[Runcom] for resource configuration management.
|
22
|
+
* Uses link:https://www.alchemists.io/projects/milestoner[Milestoner] for consistent project/gem versioning.
|
23
|
+
* Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
|
24
|
+
* Uses link:https://www.alchemists.io/projects/tocer[Tocer] for README table of contents generation.
|
25
|
+
* Supports link:https://github.com/rubysec/bundler-audit[Bundler Audit].
|
26
|
+
* Supports link:https://circleci.com[Circle CI].
|
27
|
+
* Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
|
28
|
+
* Supports link:https://github.com[GitHub].
|
29
|
+
* Supports link:https://github.com/guard/guard[Guard].
|
30
|
+
* Supports link:http://pryrepl.org[Pry].
|
31
|
+
* Supports link:https://github.com/troessner/reek[Reek].
|
32
|
+
* Supports link:https://rspec.info[RSpec].
|
33
|
+
* Supports link:https://github.com/rubocop-hq/rubocop[Rubocop].
|
34
|
+
* Supports link:https://github.com/rubocop-hq/rubocop-rspec[Rubocop RSpec].
|
35
|
+
* Supports link:http://rubyonrails.org[Ruby on Rails].
|
36
|
+
* Supports link:https://guides.rubygems.org/security[RubyGems Security].
|
37
|
+
* Supports link:https://github.com/colszowka/simplecov[SimpleCov].
|
38
|
+
* Supports link:https://github.com/erikhuda/thor[Thor].
|
39
|
+
* Supports common settings and a structured layout for building gems.
|
40
|
+
* Supports publishing to public or private gem servers.
|
41
|
+
* Provides common documentation:
|
42
|
+
** README
|
43
|
+
** CHANGES
|
44
|
+
** CONTRIBUTING
|
45
|
+
** CODE OF CONDUCT
|
46
|
+
** LICENSE
|
47
|
+
* Aids in viewing source code of semantically versioned gems within your favorite editor.
|
48
|
+
* Aids in viewing documentation of semantically versioned within your default browser.
|
49
|
+
|
50
|
+
== Screencasts
|
51
|
+
|
52
|
+
[link=https://www.alchemists.io/screencasts/gemsmith]
|
53
|
+
image::https://www.alchemists.io/images/screencasts/gemsmith/cover-original.png[Screencast,role=focal_point]
|
54
|
+
|
55
|
+
== Requirements
|
56
|
+
|
57
|
+
. A UNIX-based system.
|
58
|
+
. link:https://www.ruby-lang.org[Ruby 2.7.x].
|
59
|
+
. link:https://rubygems.org[RubyGems].
|
60
|
+
. link:https://github.com/bundler/bundler[Bundler].
|
61
|
+
|
62
|
+
== Setup
|
63
|
+
|
64
|
+
=== Production
|
65
|
+
|
66
|
+
To install, run:
|
67
|
+
|
68
|
+
[source,bash]
|
69
|
+
----
|
70
|
+
gem install gemsmith
|
71
|
+
----
|
72
|
+
|
73
|
+
=== Development
|
74
|
+
|
75
|
+
To contribute, run:
|
76
|
+
|
77
|
+
[source,bash]
|
78
|
+
----
|
79
|
+
git clone https://github.com/bkuhlmann/gemsmith.git
|
80
|
+
cd gemsmith
|
81
|
+
bin/setup
|
82
|
+
----
|
83
|
+
|
84
|
+
You can also use the IRB console for direct access to all objects:
|
85
|
+
|
86
|
+
[source,bash]
|
87
|
+
----
|
88
|
+
bin/console
|
89
|
+
----
|
90
|
+
|
91
|
+
== Usage
|
92
|
+
|
93
|
+
=== Command Line Interface (CLI)
|
94
|
+
|
95
|
+
From the command line, type: `gemsmith --help`
|
96
|
+
|
97
|
+
....
|
98
|
+
gemsmith -c, [--config] # Manage gem configuration.
|
99
|
+
gemsmith -g, [--generate=GEM] # Generate new gem.
|
100
|
+
gemsmith -h, [--help=COMMAND] # Show this message or get help for a command.
|
101
|
+
gemsmith -o, [--open=GEM] # Open a gem in default editor.
|
102
|
+
gemsmith -r, [--read=GEM] # Open a gem in default browser.
|
103
|
+
gemsmith -v, [--version] # Show gem version.
|
104
|
+
....
|
105
|
+
|
106
|
+
For more gem generation options, type: `gemsmith --help --generate`
|
107
|
+
|
108
|
+
....
|
109
|
+
[--bundler-audit], [--no-bundler-audit] # Add Bundler Audit support.
|
110
|
+
# Default: true
|
111
|
+
[--circle-ci], [--no-circle-ci] # Add Circle CI support.
|
112
|
+
[--cli], [--no-cli] # Add CLI support.
|
113
|
+
[--engine], [--no-engine] # Add Rails Engine support.
|
114
|
+
[--git-cop], [--no-git-cop] # Add Git Cop support. DEPRECATED: Use Git Lint instead.
|
115
|
+
[--git-lint], [--no-git-lint] # Add Git Lint support.
|
116
|
+
# Default: true
|
117
|
+
[--git-hub], [--no-git-hub] # Add GitHub support.
|
118
|
+
[--guard], [--no-guard] # Add Guard support.
|
119
|
+
# Default: true
|
120
|
+
[--pry], [--no-pry] # Add Pry support.
|
121
|
+
# Default: true
|
122
|
+
[--reek], [--no-reek] # Add Reek support.
|
123
|
+
# Default: true
|
124
|
+
[--rspec], [--no-rspec] # Add RSpec support.
|
125
|
+
# Default: true
|
126
|
+
[--rubocop], [--no-rubocop] # Add Rubocop support.
|
127
|
+
# Default: true
|
128
|
+
[--simple-cov], [--no-simple-cov] # Add SimpleCov support.
|
129
|
+
# Default: true
|
130
|
+
[--security], [--no-security] # Add security support.
|
131
|
+
....
|
132
|
+
|
133
|
+
=== Rake
|
134
|
+
|
135
|
+
Once a gem skeleton has been created, the following tasks are available (i.e. `bundle exec rake
|
136
|
+
-T`):
|
137
|
+
|
138
|
+
....
|
139
|
+
rake build # Build example-0.1.0.gem package
|
140
|
+
rake bundle:audit # Updates the ruby-advisory-db then runs bundle-audit
|
141
|
+
rake clean # Clean gem artifacts
|
142
|
+
rake code_quality # Run code quality checks
|
143
|
+
rake git_cop # Run Git Cop
|
144
|
+
rake install # Install example-0.1.0.gem package
|
145
|
+
rake publish # Build, tag as 0.1.0 (unsigned), and push example-0.1.0.gem to RubyGems
|
146
|
+
rake reek # Check for code smells
|
147
|
+
rake rubocop # Run RuboCop
|
148
|
+
rake rubocop:auto_correct # Auto-correct RuboCop offenses
|
149
|
+
rake spec # Run RSpec code examples
|
150
|
+
rake toc # Update Table of Contents (README)
|
151
|
+
....
|
152
|
+
|
153
|
+
_NOTE: Some tasks might differ depending on what options you enabled/disabled during gem
|
154
|
+
generation._
|
155
|
+
|
156
|
+
When building/testing your gem locally, a typical workflow is:
|
157
|
+
|
158
|
+
. `bundle exec rake install`
|
159
|
+
. Test your gem locally.
|
160
|
+
. Repeat until satisfied.
|
161
|
+
|
162
|
+
When satified with your gem, builds are green, and ready to publish, run:
|
163
|
+
|
164
|
+
....
|
165
|
+
bundle exec rake publish
|
166
|
+
....
|
167
|
+
|
168
|
+
=== Configuration
|
169
|
+
|
170
|
+
This gem can be configured via a global configuration:
|
171
|
+
|
172
|
+
....
|
173
|
+
$HOME/.config/gemsmith/configuration.yml
|
174
|
+
....
|
175
|
+
|
176
|
+
It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment variables.
|
177
|
+
|
178
|
+
The default configuration is as follows:
|
179
|
+
|
180
|
+
[source,yaml]
|
181
|
+
----
|
182
|
+
:year: <current year>
|
183
|
+
:github_user: "<Git config GitHub user>"
|
184
|
+
:gem:
|
185
|
+
:label: "Undefined"
|
186
|
+
:name: "undefined"
|
187
|
+
:path: "undefined"
|
188
|
+
:class: "Undefined"
|
189
|
+
:platform: "Gem::Platform::RUBY"
|
190
|
+
:url: "https://github.com/<author>/<gem name>"
|
191
|
+
:license: "MIT"
|
192
|
+
:author:
|
193
|
+
:name: "<Git config user name>"
|
194
|
+
:email: "<Git config user email>"
|
195
|
+
:url: ""
|
196
|
+
:organization:
|
197
|
+
:name: ""
|
198
|
+
:url: ""
|
199
|
+
:versions:
|
200
|
+
:ruby: "<current Ruby version>"
|
201
|
+
:rails: "5.1"
|
202
|
+
:generate:
|
203
|
+
:bundler_audit: true
|
204
|
+
:circle_ci: false
|
205
|
+
:cli: false
|
206
|
+
:engine: false
|
207
|
+
:git_lint: true
|
208
|
+
:git_hub: true
|
209
|
+
:guard: true
|
210
|
+
:pry: true
|
211
|
+
:reek: true
|
212
|
+
:rspec: true
|
213
|
+
:rubocop: true
|
214
|
+
:simple_cov: true
|
215
|
+
:security: false
|
216
|
+
:publish:
|
217
|
+
:sign: false
|
218
|
+
----
|
219
|
+
|
220
|
+
Feel free to take this default configuration, modify, and save as your own custom
|
221
|
+
`configuration.yml`.
|
222
|
+
|
223
|
+
=== Existing Gems
|
224
|
+
|
225
|
+
If you have gems that were not originally crafted by Gemsmith, you can add Gemsmith support to them
|
226
|
+
by modifying the following files:
|
227
|
+
|
228
|
+
Add the following to your gem's `.gemspec` file:
|
229
|
+
|
230
|
+
[source,ruby]
|
231
|
+
----
|
232
|
+
spec.add_development_dependency "gemsmith"
|
233
|
+
----
|
234
|
+
|
235
|
+
Replace or add a modified version of the following to your gem's `Rakefile`:
|
236
|
+
|
237
|
+
[source,ruby]
|
238
|
+
----
|
239
|
+
# frozen_string_literal: true
|
240
|
+
|
241
|
+
begin
|
242
|
+
require "gemsmith/rake/setup"
|
243
|
+
rescue LoadError => error
|
244
|
+
puts error.message
|
245
|
+
end
|
246
|
+
----
|
247
|
+
|
248
|
+
_NOTE: Ensure `require "bundler/gem_tasks"` is removed as Gemsmith replaces Bundler functionality._
|
249
|
+
|
250
|
+
With those changes, you can leverage the benefits of Gemsmith within your existing gem.
|
251
|
+
|
252
|
+
== Tests
|
253
|
+
|
254
|
+
To test, run:
|
255
|
+
|
256
|
+
[source,bash]
|
257
|
+
----
|
258
|
+
bundle exec rake
|
259
|
+
----
|
260
|
+
|
261
|
+
== Security
|
262
|
+
|
263
|
+
=== Git Signing Key
|
264
|
+
|
265
|
+
To securely sign your Git tags, install and configure link:https://www.gnupg.org[GPG]:
|
266
|
+
|
267
|
+
[source,bash]
|
268
|
+
----
|
269
|
+
brew install gpg
|
270
|
+
gpg --gen-key
|
271
|
+
----
|
272
|
+
|
273
|
+
When creating your GPG key, choose these settings:
|
274
|
+
|
275
|
+
* Key kind: RSA and RSA (default)
|
276
|
+
* Key size: 4096
|
277
|
+
* Key validity: 0
|
278
|
+
* Real Name: `<your name>`
|
279
|
+
* Email: `<your email>`
|
280
|
+
* Passphrase: `<your passphrase>`
|
281
|
+
|
282
|
+
To obtain your key, run the following and take the part after the forward slash:
|
283
|
+
|
284
|
+
[source,bash]
|
285
|
+
----
|
286
|
+
gpg --list-keys | grep pub
|
287
|
+
----
|
288
|
+
|
289
|
+
Add your key to your global Git configuration in the `[user]` section. Example:
|
290
|
+
|
291
|
+
....
|
292
|
+
[user]
|
293
|
+
signingkey = <your GPG key>
|
294
|
+
....
|
295
|
+
|
296
|
+
Now, when publishing your gems with Gemsmith (i.e. `bundle exec rake publish`), signing of your Git
|
297
|
+
tag will happen automatically. You will be prompted for the GPG Passphrase each time but that is to
|
298
|
+
be expected.
|
299
|
+
|
300
|
+
=== Gem Certificates
|
301
|
+
|
302
|
+
To create a certificate for your gems, run the following:
|
303
|
+
|
304
|
+
[source,bash]
|
305
|
+
----
|
306
|
+
cd ~/.ssh
|
307
|
+
gem cert --build you@example.com
|
308
|
+
chmod 600 gem-*.pem
|
309
|
+
----
|
310
|
+
|
311
|
+
The resulting `.pem` key files can be referenced via the `:private_key:` and `:public_key:` keys
|
312
|
+
within the `$HOME/.gemsmithrc` file.
|
313
|
+
|
314
|
+
To learn more about gem certificates, read about RubyGems
|
315
|
+
link:https://guides.rubygems.org/security[Security].
|
316
|
+
|
317
|
+
== Private Gem Servers
|
318
|
+
|
319
|
+
By default, the following Rake task will publish your gem to link:https://rubygems.org[RubyGems]:
|
320
|
+
|
321
|
+
[source,bash]
|
322
|
+
----
|
323
|
+
bundle exec rake publish
|
324
|
+
----
|
325
|
+
|
326
|
+
You can change this behavior by adding metadata to your gemspec that will allow the Rake tasks,
|
327
|
+
mentioned above, to publish your gem to an alternate/private gem server instead. This can be done by
|
328
|
+
updating your gem specification and RubyGems credentials.
|
329
|
+
|
330
|
+
=== Gem Specification Metadata
|
331
|
+
|
332
|
+
Add the following metadata to your gemspec:
|
333
|
+
|
334
|
+
[source,ruby]
|
335
|
+
----
|
336
|
+
Gem::Specification.new do |spec|
|
337
|
+
spec.metadata = {
|
338
|
+
"allowed_push_key" => "example_key",
|
339
|
+
"allowed_push_host" => "https://gems.example.com"
|
340
|
+
}
|
341
|
+
end
|
342
|
+
----
|
343
|
+
|
344
|
+
The gemspec metadata keys and values _must_ be strings per the
|
345
|
+
link:https://guides.rubygems.org/specification-reference/#metadata[RubyGems Specification]. Each key
|
346
|
+
represents the following:
|
347
|
+
|
348
|
+
* `allowed_push_key`: Provides a reference (look up) to the key defined the RubyGems credentials
|
349
|
+
file so that sensitive credentials are not used within your gemspec.
|
350
|
+
* `allowed_push_host`: Provides the URL of the private gem server to push your gem to.
|
351
|
+
|
352
|
+
=== Gem Credentials
|
353
|
+
|
354
|
+
With your gem specification metadata established, you are ready to publish your gem to a public or
|
355
|
+
private server. If this is your first time publishing a gem and no gem credentials have been
|
356
|
+
configured, you'll be prompted for them. Gem credentials are stored in the RubyGems
|
357
|
+
`$HOME/.gem/credentials` file. From this point forward, future gem publishing will use your stored
|
358
|
+
credentials instead. Multiple credentials can be stored in the `$HOME/.gem/credentials` file.
|
359
|
+
Example:
|
360
|
+
|
361
|
+
[source,yaml]
|
362
|
+
----
|
363
|
+
:rubygems_api_key: 2a0b460650e67d9b85a60e183defa376
|
364
|
+
:example_key: "Basic dXNlcjpwYXNzd29yZA=="
|
365
|
+
----
|
366
|
+
|
367
|
+
Should you need to delete a credential (due to a bad login/password for example), you can open the
|
368
|
+
`$HOME/.gem/credentials` in your default editor and remove the line(s) you don't need. Upon next
|
369
|
+
publish of your gem, you'll be prompted for the missing credentials.
|
370
|
+
|
371
|
+
== Promotion
|
372
|
+
|
373
|
+
Once your gem is released, let the world know about your accomplishment by posting an update to
|
374
|
+
these sites:
|
375
|
+
|
376
|
+
* link:http://www.rubyflow.com[RubyFlow]
|
377
|
+
* link:https://ruby.libhunt.com[Ruby Library Hunt]
|
378
|
+
* link:http://rubydaily.org[RubyDaily]
|
379
|
+
* link:https://awesome-ruby.com[Awesome Ruby]
|
380
|
+
* link:https://www.ruby-toolbox.com[Ruby Toolbox]
|
381
|
+
* link:https://www.ruby-lang.org/en/community[Ruby Community]
|
382
|
+
|
383
|
+
== Troubleshooting
|
384
|
+
|
385
|
+
When running `bundle exec rake install` or `bundle exec rake publish` with modified, staged, or
|
386
|
+
uncommitted Git changes, the rake task will throw an error to this effect. When this occurs, it is
|
387
|
+
recommended that you commit your changes or link:https://git-scm.com/docs/git-stash[stash] them
|
388
|
+
before proceeding.
|
389
|
+
|
390
|
+
== Versioning
|
391
|
+
|
392
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
393
|
+
|
394
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
395
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
396
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
397
|
+
|
398
|
+
== Code of Conduct
|
399
|
+
|
400
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
401
|
+
participating in this project you agree to abide by its terms.
|
402
|
+
|
403
|
+
== Contributions
|
404
|
+
|
405
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
406
|
+
|
407
|
+
== License
|
408
|
+
|
409
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
410
|
+
|
411
|
+
== History
|
412
|
+
|
413
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
414
|
+
|
415
|
+
== Credits
|
416
|
+
|
417
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|