gemsmith 14.0.2 → 14.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +415 -0
- data/bin/gemsmith +1 -1
- data/lib/gemsmith/cli.rb +3 -3
- data/lib/gemsmith/generators/git.rb +1 -1
- data/lib/gemsmith/identity.rb +5 -19
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +5 -6
- data/lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt +5 -5
- data/lib/gemsmith/templates/%gem_name%/README.md.tt +14 -0
- 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 +22 -21
- 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: e2352b9c3ad52b98f62bc07e381e5b3e8e5028a732f0e306cf7209c7bb1f5ed1
|
4
|
+
data.tar.gz: e6df544b791fba1e20586094c729268596754a3e7d0c19b2336c31079c1808cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 135a12b992e05dadc73041c5607a5b3eda160ca92c591c7f4bfadf207423bb98f376a49f229ee492c7eb800680b3cb73a64dd500e2a8bc128ad404645d665c63
|
7
|
+
data.tar.gz: cae3dbfe35a5d87f0885c83d3ede181cf2596067b55626462116daf8eb07bf08e7df30407dd7adfc0ce66df6b6f1b08caa30d88af80aa7b3f1a8ce3ca6b1d42f
|
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,415 @@
|
|
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-cop[Git Cop].
|
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.html]
|
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.
|
115
|
+
# Default: true
|
116
|
+
[--git-hub], [--no-git-hub] # Add GitHub support.
|
117
|
+
# Default: true
|
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
|
+
[--security], [--no-security] # Add security support.
|
129
|
+
....
|
130
|
+
|
131
|
+
=== Rake
|
132
|
+
|
133
|
+
Once a gem skeleton has been created, the following tasks are available (i.e. `bundle exec rake
|
134
|
+
-T`):
|
135
|
+
|
136
|
+
....
|
137
|
+
rake build # Build example-0.1.0.gem package
|
138
|
+
rake bundle:audit # Updates the ruby-advisory-db then runs bundle-audit
|
139
|
+
rake clean # Clean gem artifacts
|
140
|
+
rake code_quality # Run code quality checks
|
141
|
+
rake git_cop # Run Git Cop
|
142
|
+
rake install # Install example-0.1.0.gem package
|
143
|
+
rake publish # Build, tag as 0.1.0 (unsigned), and push example-0.1.0.gem to RubyGems
|
144
|
+
rake reek # Check for code smells
|
145
|
+
rake rubocop # Run RuboCop
|
146
|
+
rake rubocop:auto_correct # Auto-correct RuboCop offenses
|
147
|
+
rake spec # Run RSpec code examples
|
148
|
+
rake toc # Update Table of Contents (README)
|
149
|
+
....
|
150
|
+
|
151
|
+
_NOTE: Some tasks might differ depending on what options you enabled/disabled during gem
|
152
|
+
generation._
|
153
|
+
|
154
|
+
When building/testing your gem locally, a typical workflow is:
|
155
|
+
|
156
|
+
. `bundle exec rake install`
|
157
|
+
. Test your gem locally.
|
158
|
+
. Repeat until satisfied.
|
159
|
+
|
160
|
+
When satified with your gem, builds are green, and ready to publish, run:
|
161
|
+
|
162
|
+
....
|
163
|
+
bundle exec rake publish
|
164
|
+
....
|
165
|
+
|
166
|
+
=== Configuration
|
167
|
+
|
168
|
+
This gem can be configured via a global configuration:
|
169
|
+
|
170
|
+
....
|
171
|
+
$HOME/.config/gemsmith/configuration.yml
|
172
|
+
....
|
173
|
+
|
174
|
+
It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment variables.
|
175
|
+
|
176
|
+
The default configuration is as follows:
|
177
|
+
|
178
|
+
[source,yaml]
|
179
|
+
----
|
180
|
+
:year: <current year>
|
181
|
+
:github_user: "<Git config GitHub user>",
|
182
|
+
:gem:
|
183
|
+
:label: "Undefined"
|
184
|
+
:name: "undefined"
|
185
|
+
:path: "undefined"
|
186
|
+
:class: "Undefined"
|
187
|
+
:platform: "Gem::Platform::RUBY"
|
188
|
+
:url: "https://github.com/<author>/<gem name>"
|
189
|
+
:license: "MIT"
|
190
|
+
:author:
|
191
|
+
:name: "<Git config user name>"
|
192
|
+
:email: "<Git config user email>"
|
193
|
+
:url: ""
|
194
|
+
:organization:
|
195
|
+
:name: ""
|
196
|
+
:url: ""
|
197
|
+
:versions:
|
198
|
+
:ruby: "<current Ruby version>"
|
199
|
+
:rails: "5.1"
|
200
|
+
:generate:
|
201
|
+
:bundler_audit: true
|
202
|
+
:circle_ci: false
|
203
|
+
:cli: false
|
204
|
+
:engine: false
|
205
|
+
:git_cop: true
|
206
|
+
:git_hub: true
|
207
|
+
:guard: true
|
208
|
+
:pry: true
|
209
|
+
:reek: true
|
210
|
+
:rspec: true
|
211
|
+
:rubocop: true
|
212
|
+
:simple_cov: true
|
213
|
+
:security: false
|
214
|
+
:publish:
|
215
|
+
:sign: false
|
216
|
+
----
|
217
|
+
|
218
|
+
Feel free to take this default configuration, modify, and save as your own custom
|
219
|
+
`configuration.yml`.
|
220
|
+
|
221
|
+
=== Existing Gems
|
222
|
+
|
223
|
+
If you have gems that were not originally crafted by Gemsmith, you can add Gemsmith support to them
|
224
|
+
by modifying the following files:
|
225
|
+
|
226
|
+
Add the following to your gem's `.gemspec` file:
|
227
|
+
|
228
|
+
[source,ruby]
|
229
|
+
----
|
230
|
+
spec.add_development_dependency "gemsmith"
|
231
|
+
----
|
232
|
+
|
233
|
+
Replace or add a modified version of the following to your gem's `Rakefile`:
|
234
|
+
|
235
|
+
[source,ruby]
|
236
|
+
----
|
237
|
+
# frozen_string_literal: true
|
238
|
+
|
239
|
+
begin
|
240
|
+
require "gemsmith/rake/setup"
|
241
|
+
rescue LoadError => error
|
242
|
+
puts error.message
|
243
|
+
end
|
244
|
+
----
|
245
|
+
|
246
|
+
_NOTE: Ensure `require "bundler/gem_tasks"` is removed as Gemsmith replaces Bundler functionality._
|
247
|
+
|
248
|
+
With those changes, you can leverage the benefits of Gemsmith within your existing gem.
|
249
|
+
|
250
|
+
== Tests
|
251
|
+
|
252
|
+
To test, run:
|
253
|
+
|
254
|
+
[source,bash]
|
255
|
+
----
|
256
|
+
bundle exec rake
|
257
|
+
----
|
258
|
+
|
259
|
+
== Security
|
260
|
+
|
261
|
+
=== Git Signing Key
|
262
|
+
|
263
|
+
To securely sign your Git tags, install and configure link:https://www.gnupg.org[GPG]:
|
264
|
+
|
265
|
+
[source,bash]
|
266
|
+
----
|
267
|
+
brew install gpg
|
268
|
+
gpg --gen-key
|
269
|
+
----
|
270
|
+
|
271
|
+
When creating your GPG key, choose these settings:
|
272
|
+
|
273
|
+
* Key kind: RSA and RSA (default)
|
274
|
+
* Key size: 4096
|
275
|
+
* Key validity: 0
|
276
|
+
* Real Name: `<your name>`
|
277
|
+
* Email: `<your email>`
|
278
|
+
* Passphrase: `<your passphrase>`
|
279
|
+
|
280
|
+
To obtain your key, run the following and take the part after the forward slash:
|
281
|
+
|
282
|
+
[source,bash]
|
283
|
+
----
|
284
|
+
gpg --list-keys | grep pub
|
285
|
+
----
|
286
|
+
|
287
|
+
Add your key to your global Git configuration in the `[user]` section. Example:
|
288
|
+
|
289
|
+
....
|
290
|
+
[user]
|
291
|
+
signingkey = <your GPG key>
|
292
|
+
....
|
293
|
+
|
294
|
+
Now, when publishing your gems with Gemsmith (i.e. `bundle exec rake publish`), signing of your Git
|
295
|
+
tag will happen automatically. You will be prompted for the GPG Passphrase each time but that is to
|
296
|
+
be expected.
|
297
|
+
|
298
|
+
=== Gem Certificates
|
299
|
+
|
300
|
+
To create a certificate for your gems, run the following:
|
301
|
+
|
302
|
+
[source,bash]
|
303
|
+
----
|
304
|
+
cd ~/.ssh
|
305
|
+
gem cert --build you@example.com
|
306
|
+
chmod 600 gem-*.pem
|
307
|
+
----
|
308
|
+
|
309
|
+
The resulting `.pem` key files can be referenced via the `:private_key:` and `:public_key:` keys
|
310
|
+
within the `$HOME/.gemsmithrc` file.
|
311
|
+
|
312
|
+
To learn more about gem certificates, read about RubyGems
|
313
|
+
link:https://guides.rubygems.org/security[Security].
|
314
|
+
|
315
|
+
== Private Gem Servers
|
316
|
+
|
317
|
+
By default, the following Rake task will publish your gem to link:https://rubygems.org[RubyGems]:
|
318
|
+
|
319
|
+
[source,bash]
|
320
|
+
----
|
321
|
+
bundle exec rake publish
|
322
|
+
----
|
323
|
+
|
324
|
+
You can change this behavior by adding metadata to your gemspec that will allow the Rake tasks,
|
325
|
+
mentioned above, to publish your gem to an alternate/private gem server instead. This can be done by
|
326
|
+
updating your gem specification and RubyGems credentials.
|
327
|
+
|
328
|
+
=== Gem Specification Metadata
|
329
|
+
|
330
|
+
Add the following metadata to your gemspec:
|
331
|
+
|
332
|
+
[source,ruby]
|
333
|
+
----
|
334
|
+
Gem::Specification.new do |spec|
|
335
|
+
spec.metadata = {
|
336
|
+
"allowed_push_key" => "example_key",
|
337
|
+
"allowed_push_host" => "https://gems.example.com"
|
338
|
+
}
|
339
|
+
end
|
340
|
+
----
|
341
|
+
|
342
|
+
The gemspec metadata keys and values _must_ be strings per the
|
343
|
+
link:https://guides.rubygems.org/specification-reference/#metadata[RubyGems Specification]. Each key
|
344
|
+
represents the following:
|
345
|
+
|
346
|
+
* `allowed_push_key`: Provides a reference (look up) to the key defined the RubyGems credentials
|
347
|
+
file so that sensitive credentials are not used within your gemspec.
|
348
|
+
* `allowed_push_host`: Provides the URL of the private gem server to push your gem to.
|
349
|
+
|
350
|
+
=== Gem Credentials
|
351
|
+
|
352
|
+
With your gem specification metadata established, you are ready to publish your gem to a public or
|
353
|
+
private server. If this is your first time publishing a gem and no gem credentials have been
|
354
|
+
configured, you'll be prompted for them. Gem credentials are stored in the RubyGems
|
355
|
+
`$HOME/.gem/credentials` file. From this point forward, future gem publishing will use your stored
|
356
|
+
credentials instead. Multiple credentials can be stored in the `$HOME/.gem/credentials` file.
|
357
|
+
Example:
|
358
|
+
|
359
|
+
[source,yaml]
|
360
|
+
----
|
361
|
+
:rubygems_api_key: 2a0b460650e67d9b85a60e183defa376
|
362
|
+
:example_key: "Basic dXNlcjpwYXNzd29yZA=="
|
363
|
+
----
|
364
|
+
|
365
|
+
Should you need to delete a credential (due to a bad login/password for example), you can open the
|
366
|
+
`$HOME/.gem/credentials` in your default editor and remove the line(s) you don't need. Upon next
|
367
|
+
publish of your gem, you'll be prompted for the missing credentials.
|
368
|
+
|
369
|
+
== Promotion
|
370
|
+
|
371
|
+
Once your gem is released, let the world know about your accomplishment by posting an update to
|
372
|
+
these sites:
|
373
|
+
|
374
|
+
* link:http://www.rubyflow.com[RubyFlow]
|
375
|
+
* link:https://ruby.libhunt.com[Ruby Library Hunt]
|
376
|
+
* link:http://rubydaily.org[RubyDaily]
|
377
|
+
* link:https://awesome-ruby.com[Awesome Ruby]
|
378
|
+
* link:https://www.ruby-toolbox.com[Ruby Toolbox]
|
379
|
+
* link:https://www.ruby-lang.org/en/community[Ruby Community]
|
380
|
+
|
381
|
+
== Troubleshooting
|
382
|
+
|
383
|
+
When running `bundle exec rake install` or `bundle exec rake publish` with modified, staged, or
|
384
|
+
uncommitted Git changes, the rake task will throw an error to this effect. When this occurs, it is
|
385
|
+
recommended that you commit your changes or link:https://git-scm.com/docs/git-stash[stash] them
|
386
|
+
before proceeding.
|
387
|
+
|
388
|
+
== Versioning
|
389
|
+
|
390
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
391
|
+
|
392
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
393
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
394
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
395
|
+
|
396
|
+
== Code of Conduct
|
397
|
+
|
398
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
399
|
+
participating in this project you agree to abide by its terms.
|
400
|
+
|
401
|
+
== Contributions
|
402
|
+
|
403
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
404
|
+
|
405
|
+
== License
|
406
|
+
|
407
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
408
|
+
|
409
|
+
== History
|
410
|
+
|
411
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
412
|
+
|
413
|
+
== Credits
|
414
|
+
|
415
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
|
data/bin/gemsmith
CHANGED
data/lib/gemsmith/cli.rb
CHANGED
@@ -19,7 +19,7 @@ module Gemsmith
|
|
19
19
|
using Refinements::Strings
|
20
20
|
using Refinements::Hashes
|
21
21
|
|
22
|
-
package_name Identity
|
22
|
+
package_name Identity::VERSION_LABEL
|
23
23
|
|
24
24
|
# Overwrites Thor's template source root.
|
25
25
|
def self.source_root
|
@@ -28,7 +28,7 @@ module Gemsmith
|
|
28
28
|
|
29
29
|
# rubocop:disable Metrics/MethodLength
|
30
30
|
def self.configuration
|
31
|
-
Runcom::Config.new "#{Identity
|
31
|
+
Runcom::Config.new "#{Identity::NAME}/configuration.yml",
|
32
32
|
defaults: {
|
33
33
|
year: Time.now.year,
|
34
34
|
github_user: Git.github_user,
|
@@ -213,7 +213,7 @@ module Gemsmith
|
|
213
213
|
desc "-v, [--version]", "Show gem version."
|
214
214
|
map %w[-v --version] => :version
|
215
215
|
def version
|
216
|
-
say Identity
|
216
|
+
say Identity::VERSION_LABEL
|
217
217
|
end
|
218
218
|
|
219
219
|
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
@@ -26,7 +26,7 @@ module Gemsmith
|
|
26
26
|
|
27
27
|
def create_repository
|
28
28
|
create_commit "Added gem skeleton",
|
29
|
-
"Built with [#{Identity
|
29
|
+
"Built with [#{Identity::LABEL}](#{Identity::URL}) #{Identity::VERSION}."
|
30
30
|
end
|
31
31
|
|
32
32
|
def create_commit subject, body
|
data/lib/gemsmith/identity.rb
CHANGED
@@ -3,24 +3,10 @@
|
|
3
3
|
module Gemsmith
|
4
4
|
# Gem identity information.
|
5
5
|
module Identity
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
"Gemsmith"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.version
|
15
|
-
"14.0.2"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.version_label
|
19
|
-
"#{label} #{version}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.url
|
23
|
-
"https://github.com/bkuhlmann/gemsmith"
|
24
|
-
end
|
6
|
+
NAME = "gemsmith"
|
7
|
+
LABEL = "Gemsmith"
|
8
|
+
VERSION = "14.1.0"
|
9
|
+
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
10
|
+
URL = "https://github.com/bkuhlmann/gemsmith"
|
25
11
|
end
|
26
12
|
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
require "<%= config.dig(:gem, :path) %>/identity"
|
1
|
+
require_relative "lib/<%= config.dig(:gem, :path) %>/identity"
|
3
2
|
|
4
3
|
Gem::Specification.new do |spec|
|
5
|
-
spec.name = <%= config.dig(:gem, :class) %>::Identity
|
6
|
-
spec.version = <%= config.dig(:gem, :class) %>::Identity
|
4
|
+
spec.name = <%= config.dig(:gem, :class) %>::Identity::NAME
|
5
|
+
spec.version = <%= config.dig(:gem, :class) %>::Identity::VERSION
|
7
6
|
spec.platform = <%= config.dig(:gem, :platform) %>
|
8
7
|
spec.authors = ["<%= config.dig(:author, :name) %>"]
|
9
8
|
spec.email = ["<%= config.dig(:author, :email) %>"]
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
33
32
|
<%- if config.dig(:generate, :bundler_audit) -%>
|
34
33
|
spec.add_development_dependency "bundler-audit", "~> 0.6"
|
35
34
|
<%- end -%>
|
36
|
-
spec.add_development_dependency "gemsmith", "~> <%= Gemsmith::Identity
|
35
|
+
spec.add_development_dependency "gemsmith", "~> <%= Gemsmith::Identity::VERSION[/\d+\.\d+/] %>"
|
37
36
|
<%- if config.dig(:generate, :git_cop) -%>
|
38
37
|
spec.add_development_dependency "git-cop", "~> 4.0"
|
39
38
|
<%- end -%>
|
@@ -46,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
46
45
|
<%- end -%>
|
47
46
|
spec.add_development_dependency "rake", "~> 13.0"
|
48
47
|
<%- if config.dig(:generate, :reek) -%>
|
49
|
-
spec.add_development_dependency "reek", "~>
|
48
|
+
spec.add_development_dependency "reek", "~> 6.0"
|
50
49
|
<%- end -%>
|
51
50
|
<%- if config.dig(:generate, :rspec) -%>
|
52
51
|
spec.add_development_dependency "<%= config.dig(:generate, :engine) ? "rspec-rails" : "rspec" %>", "~> 3.9"
|
@@ -1,12 +1,12 @@
|
|
1
1
|
inherit_from:
|
2
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.
|
3
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.
|
4
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.
|
2
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.4.0/configurations/rubocop/ruby.yml
|
3
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.4.0/configurations/rubocop/rake.yml
|
4
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.4.0/configurations/rubocop/performance.yml
|
5
5
|
<%- if config.dig(:generate, :rspec) -%>
|
6
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.
|
6
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.4.0/configurations/rubocop/rspec.yml
|
7
7
|
<%- end -%>
|
8
8
|
<%- if config.dig(:generate, :engine) -%>
|
9
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.
|
9
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/4.4.0/configurations/rubocop/rails.yml
|
10
10
|
<%- end -%>
|
11
11
|
|
12
12
|
<%- if config.dig(:generate, :cli) -%>
|
@@ -25,6 +25,8 @@
|
|
25
25
|
|
26
26
|
## Setup
|
27
27
|
|
28
|
+
### Production
|
29
|
+
|
28
30
|
To install, run:
|
29
31
|
|
30
32
|
gem install <%= config.dig(:gem, :name) %>
|
@@ -35,6 +37,18 @@ Add the following to your Gemfile:
|
|
35
37
|
gem "<%= config.dig(:gem, :name) %>"
|
36
38
|
<%- end -%>
|
37
39
|
|
40
|
+
### Development
|
41
|
+
|
42
|
+
To contribute, run:
|
43
|
+
|
44
|
+
git clone https://github.com/<%= config.dig(:github_user) %>/<%= config.dig(:gem, :name) %>.git
|
45
|
+
cd <%= config.dig(:gem, :name) %>
|
46
|
+
bin/setup
|
47
|
+
|
48
|
+
You can also use the IRB console for direct access to all objects:
|
49
|
+
|
50
|
+
bin/console
|
51
|
+
|
38
52
|
## Usage
|
39
53
|
|
40
54
|
<%- if config.dig(:generate, :rspec) -%>
|
@@ -4,5 +4,5 @@ require "<%= config.dig(:gem, :path) %>"
|
|
4
4
|
require "<%= config.dig(:gem, :path) %>/cli"
|
5
5
|
require "<%= config.dig(:gem, :path) %>/identity"
|
6
6
|
|
7
|
-
Process.setproctitle <%= config.dig(:gem, :class) %>::Identity
|
7
|
+
Process.setproctitle <%= config.dig(:gem, :class) %>::Identity::VERSION_LABEL
|
8
8
|
<%= config.dig(:gem, :class) %>::CLI.start
|
@@ -7,10 +7,10 @@ require "runcom"
|
|
7
7
|
class CLI < Thor
|
8
8
|
include Thor::Actions
|
9
9
|
|
10
|
-
package_name Identity
|
10
|
+
package_name Identity::VERSION_LABEL
|
11
11
|
|
12
12
|
def self.configuration
|
13
|
-
Runcom::Config.new "#{Identity
|
13
|
+
Runcom::Config.new "#{Identity::NAME}/configuration.yml"
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize args = [], options = {}, config = {}
|
@@ -45,7 +45,7 @@ require "runcom"
|
|
45
45
|
desc "-v, [--version]", "Show gem version."
|
46
46
|
map %w[-v --version] => :version
|
47
47
|
def version
|
48
|
-
say Identity
|
48
|
+
say Identity::VERSION_LABEL
|
49
49
|
end
|
50
50
|
|
51
51
|
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
@@ -1,20 +1,9 @@
|
|
1
1
|
<% render_namespace do %>
|
2
2
|
# Gem identity information.
|
3
3
|
module Identity
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def self.label
|
9
|
-
"<%= config.dig(:gem, :label) %>"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.version
|
13
|
-
"0.1.0"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.version_label
|
17
|
-
"#{label} #{version}"
|
18
|
-
end
|
4
|
+
NAME = "<%= config.dig(:gem, :name) %>"
|
5
|
+
LABEL = "<%= config.dig(:gem, :label) %>"
|
6
|
+
VERSION = "0.1.0"
|
7
|
+
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
19
8
|
end
|
20
9
|
<% end %>
|
@@ -19,7 +19,7 @@ RSpec.describe <%= config.dig(:gem, :class) %>::CLI do
|
|
19
19
|
shared_examples_for "a version command" do
|
20
20
|
it "prints version" do
|
21
21
|
result = -> { cli }
|
22
|
-
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity
|
22
|
+
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity::VERSION_LABEL}\n/
|
23
23
|
|
24
24
|
expect(result).to output(pattern).to_stdout
|
25
25
|
end
|
@@ -28,7 +28,7 @@ RSpec.describe <%= config.dig(:gem, :class) %>::CLI do
|
|
28
28
|
shared_examples_for "a help command" do
|
29
29
|
it "prints usage" do
|
30
30
|
result = -> { cli }
|
31
|
-
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity
|
31
|
+
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity::VERSION_LABEL}\scommands:\n/
|
32
32
|
|
33
33
|
expect(result).to output(pattern).to_stdout
|
34
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemsmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.0
|
4
|
+
version: 14.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
|
15
|
+
NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
|
24
|
+
XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
|
25
|
+
bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
|
26
|
+
Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
|
27
|
+
7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
|
28
|
+
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
29
|
+
QWc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2020-
|
31
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: milestoner
|
@@ -246,14 +246,14 @@ dependencies:
|
|
246
246
|
requirements:
|
247
247
|
- - "~>"
|
248
248
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
249
|
+
version: '6.0'
|
250
250
|
type: :development
|
251
251
|
prerelease: false
|
252
252
|
version_requirements: !ruby/object:Gem::Requirement
|
253
253
|
requirements:
|
254
254
|
- - "~>"
|
255
255
|
- !ruby/object:Gem::Version
|
256
|
-
version: '
|
256
|
+
version: '6.0'
|
257
257
|
- !ruby/object:Gem::Dependency
|
258
258
|
name: rspec
|
259
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,11 +331,11 @@ executables:
|
|
331
331
|
- gemsmith
|
332
332
|
extensions: []
|
333
333
|
extra_rdoc_files:
|
334
|
-
- README.
|
335
|
-
- LICENSE.
|
334
|
+
- README.adoc
|
335
|
+
- LICENSE.adoc
|
336
336
|
files:
|
337
|
-
- LICENSE.
|
338
|
-
- README.
|
337
|
+
- LICENSE.adoc
|
338
|
+
- README.adoc
|
339
339
|
- bin/gemsmith
|
340
340
|
- lib/gemsmith.rb
|
341
341
|
- lib/gemsmith/authenticators/basic.rb
|
@@ -407,13 +407,14 @@ files:
|
|
407
407
|
- lib/gemsmith/templates/%gem_name%/spec/rails_helper.rb.tt
|
408
408
|
- lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt
|
409
409
|
- lib/gemsmith/templates/%gem_name%/spec/support/shared_contexts/temp_dir.rb.tt
|
410
|
-
homepage: https://
|
410
|
+
homepage: https://www.alchemists.io/projects/gemsmith
|
411
411
|
licenses:
|
412
412
|
- Apache-2.0
|
413
413
|
metadata:
|
414
|
-
source_code_uri: https://github.com/bkuhlmann/gemsmith
|
415
|
-
changelog_uri: https://github.com/bkuhlmann/gemsmith/blob/master/CHANGES.md
|
416
414
|
bug_tracker_uri: https://github.com/bkuhlmann/gemsmith/issues
|
415
|
+
changelog_uri: https://www.alchemists.io/projects/gemsmith/changes.html
|
416
|
+
documentation_uri: https://www.alchemists.io/projects/gemsmith
|
417
|
+
source_code_uri: https://github.com/bkuhlmann/gemsmith
|
417
418
|
post_install_message:
|
418
419
|
rdoc_options: []
|
419
420
|
require_paths:
|
metadata.gz.sig
CHANGED
Binary file
|
data/README.md
DELETED
@@ -1,383 +0,0 @@
|
|
1
|
-
<p align="center">
|
2
|
-
<img src="gemsmith.png" alt="Gemsmith Icon"/>
|
3
|
-
</p>
|
4
|
-
|
5
|
-
# Gemsmith
|
6
|
-
|
7
|
-
[![Gem Version](https://badge.fury.io/rb/gemsmith.svg)](http://badge.fury.io/rb/gemsmith)
|
8
|
-
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/4fbf3375d2abb76a6f5d/maintainability)](https://codeclimate.com/github/bkuhlmann/gemsmith/maintainability)
|
9
|
-
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/4fbf3375d2abb76a6f5d/test_coverage)](https://codeclimate.com/github/bkuhlmann/gemsmith/test_coverage)
|
10
|
-
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/gemsmith.svg?style=svg)](https://circleci.com/gh/bkuhlmann/gemsmith)
|
11
|
-
|
12
|
-
A command line interface for smithing new Ruby gems.
|
13
|
-
|
14
|
-
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
15
|
-
|
16
|
-
## Table of Contents
|
17
|
-
|
18
|
-
- [Features](#features)
|
19
|
-
- [Screencasts](#screencasts)
|
20
|
-
- [Requirements](#requirements)
|
21
|
-
- [Setup](#setup)
|
22
|
-
- [Install](#install)
|
23
|
-
- [Configuration](#configuration)
|
24
|
-
- [Existing Gems](#existing-gems)
|
25
|
-
- [Usage](#usage)
|
26
|
-
- [Command Line Interface (CLI)](#command-line-interface-cli)
|
27
|
-
- [Rake](#rake)
|
28
|
-
- [Tests](#tests)
|
29
|
-
- [Security](#security)
|
30
|
-
- [Git Signing Key](#git-signing-key)
|
31
|
-
- [Gem Certificates](#gem-certificates)
|
32
|
-
- [Private Gem Servers](#private-gem-servers)
|
33
|
-
- [Gem Specification Metadata](#gem-specification-metadata)
|
34
|
-
- [Gem Credentials](#gem-credentials)
|
35
|
-
- [Promotion](#promotion)
|
36
|
-
- [Troubleshooting](#troubleshooting)
|
37
|
-
- [Versioning](#versioning)
|
38
|
-
- [Code of Conduct](#code-of-conduct)
|
39
|
-
- [Contributions](#contributions)
|
40
|
-
- [License](#license)
|
41
|
-
- [History](#history)
|
42
|
-
- [Credits](#credits)
|
43
|
-
|
44
|
-
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
45
|
-
|
46
|
-
## Features
|
47
|
-
|
48
|
-
- Builds a gem skeleton with enhanced Bundler functionality.
|
49
|
-
- Uses [Refinements](https://github.com/bkuhlmann/refinements) Ruby core library enhancements.
|
50
|
-
- Uses [Versionaire](https://github.com/bkuhlmann/versionaire) for semantic versioning.
|
51
|
-
- Uses [Runcom](https://github.com/bkuhlmann/runcom) for resource configuration management.
|
52
|
-
- Uses [Milestoner](https://github.com/bkuhlmann/milestoner) for consistent project/gem versioning.
|
53
|
-
- Uses [Pragmater](https://github.com/bkuhlmann/pragmater) for Ruby source pragma directives.
|
54
|
-
- Uses [Tocer](https://github.com/bkuhlmann/tocer) for README table of contents generation.
|
55
|
-
- Supports [Bundler Audit](https://github.com/rubysec/bundler-audit).
|
56
|
-
- Supports [Circle CI](https://circleci.com).
|
57
|
-
- Supports [Git Cop](https://github.com/bkuhlmann/git-cop).
|
58
|
-
- Supports [GitHub](https://github.com).
|
59
|
-
- Supports [Guard](https://github.com/guard/guard).
|
60
|
-
- Supports [Pry](http://pryrepl.org).
|
61
|
-
- Supports [Reek](https://github.com/troessner/reek).
|
62
|
-
- Supports [RSpec](http://rspec.info).
|
63
|
-
- Supports [Rubocop](https://github.com/rubocop-hq/rubocop).
|
64
|
-
- Supports [Rubocop RSpec](https://github.com/rubocop-hq/rubocop-rspec).
|
65
|
-
- Supports [Ruby on Rails](http://rubyonrails.org).
|
66
|
-
- Supports [RubyGems Security](http://guides.rubygems.org/security).
|
67
|
-
- Supports [SimpleCov](https://github.com/colszowka/simplecov).
|
68
|
-
- Supports [Thor](https://github.com/erikhuda/thor).
|
69
|
-
- Supports common settings and a structured layout for building gems.
|
70
|
-
- Supports publishing to public or private gem servers.
|
71
|
-
- Provides common documentation:
|
72
|
-
- [README](README.md)
|
73
|
-
- [CHANGES](CHANGES.md)
|
74
|
-
- [CONTRIBUTING](CONTRIBUTING.md)
|
75
|
-
- [CODE OF CONDUCT](CODE_OF_CONDUCT.md)
|
76
|
-
- [LICENSE](LICENSE.md)
|
77
|
-
- Aids in viewing source code of semantically versioned gems within your favorite editor.
|
78
|
-
- Aids in viewing documentation of semantically versioned within your default browser.
|
79
|
-
|
80
|
-
## Screencasts
|
81
|
-
|
82
|
-
[![asciicast](https://asciinema.org/a/277820.svg)](https://asciinema.org/a/277820)
|
83
|
-
|
84
|
-
## Requirements
|
85
|
-
|
86
|
-
1. A UNIX-based system.
|
87
|
-
1. [Ruby 2.7.x](https://www.ruby-lang.org).
|
88
|
-
1. [RubyGems](https://rubygems.org).
|
89
|
-
1. [Bundler](https://github.com/bundler/bundler).
|
90
|
-
|
91
|
-
## Setup
|
92
|
-
|
93
|
-
### Install
|
94
|
-
|
95
|
-
Type the following to install:
|
96
|
-
|
97
|
-
gem install gemsmith
|
98
|
-
|
99
|
-
### Configuration
|
100
|
-
|
101
|
-
This gem can be configured via a global configuration:
|
102
|
-
|
103
|
-
~/.config/gemsmith/configuration.yml
|
104
|
-
|
105
|
-
It can also be configured via [XDG](https://github.com/bkuhlmann/xdg) environment variables.
|
106
|
-
|
107
|
-
The default configuration is as follows:
|
108
|
-
|
109
|
-
:year: <current year>
|
110
|
-
:github_user: "<Git config GitHub user>",
|
111
|
-
:gem:
|
112
|
-
:label: "Undefined"
|
113
|
-
:name: "undefined"
|
114
|
-
:path: "undefined"
|
115
|
-
:class: "Undefined"
|
116
|
-
:platform: "Gem::Platform::RUBY"
|
117
|
-
:url: "https://github.com/<author>/<gem name>"
|
118
|
-
:license: "MIT"
|
119
|
-
:author:
|
120
|
-
:name: "<Git config user name>"
|
121
|
-
:email: "<Git config user email>"
|
122
|
-
:url: ""
|
123
|
-
:organization:
|
124
|
-
:name: ""
|
125
|
-
:url: ""
|
126
|
-
:versions:
|
127
|
-
:ruby: "<current Ruby version>"
|
128
|
-
:rails: "5.1"
|
129
|
-
:generate:
|
130
|
-
:bundler_audit: true
|
131
|
-
:circle_ci: false
|
132
|
-
:cli: false
|
133
|
-
:engine: false
|
134
|
-
:git_cop: true
|
135
|
-
:git_hub: true
|
136
|
-
:guard: true
|
137
|
-
:pry: true
|
138
|
-
:reek: true
|
139
|
-
:rspec: true
|
140
|
-
:rubocop: true
|
141
|
-
:simple_cov: true
|
142
|
-
:security: false
|
143
|
-
:publish:
|
144
|
-
:sign: false
|
145
|
-
|
146
|
-
Feel free to take this default configuration, modify, and save as your own custom
|
147
|
-
`configuration.yml`.
|
148
|
-
|
149
|
-
### Existing Gems
|
150
|
-
|
151
|
-
If you have gems that were not originally crafted by Gemsmith, you can add Gemsmith support to them
|
152
|
-
by modifying the following files:
|
153
|
-
|
154
|
-
Add the following to your gem's `*.gemspec` file:
|
155
|
-
|
156
|
-
spec.add_development_dependency "gemsmith"
|
157
|
-
|
158
|
-
Replace or add a modified version of the following to your gem's `Rakefile`:
|
159
|
-
|
160
|
-
# frozen_string_literal: true
|
161
|
-
|
162
|
-
begin
|
163
|
-
require "gemsmith/rake/setup"
|
164
|
-
rescue LoadError => error
|
165
|
-
puts error.message
|
166
|
-
end
|
167
|
-
|
168
|
-
*NOTE: Ensure `require "bundler/gem_tasks"` is removed as Gemsmith replaces Bundler functionality.*
|
169
|
-
|
170
|
-
With those changes, you can leverage the benefits of Gemsmith within your existing gem.
|
171
|
-
|
172
|
-
## Usage
|
173
|
-
|
174
|
-
### Command Line Interface (CLI)
|
175
|
-
|
176
|
-
From the command line, type: `gemsmith --help`
|
177
|
-
|
178
|
-
gemsmith -c, [--config] # Manage gem configuration.
|
179
|
-
gemsmith -g, [--generate=GEM] # Generate new gem.
|
180
|
-
gemsmith -h, [--help=COMMAND] # Show this message or get help for a command.
|
181
|
-
gemsmith -o, [--open=GEM] # Open a gem in default editor.
|
182
|
-
gemsmith -r, [--read=GEM] # Open a gem in default browser.
|
183
|
-
gemsmith -v, [--version] # Show gem version.
|
184
|
-
|
185
|
-
For more gem generation options, type: `gemsmith --help --generate`
|
186
|
-
|
187
|
-
[--bundler-audit], [--no-bundler-audit] # Add Bundler Audit support.
|
188
|
-
# Default: true
|
189
|
-
[--circle-ci], [--no-circle-ci] # Add Circle CI support.
|
190
|
-
[--cli], [--no-cli] # Add CLI support.
|
191
|
-
[--engine], [--no-engine] # Add Rails Engine support.
|
192
|
-
[--git-cop], [--no-git-cop] # Add Git Cop support.
|
193
|
-
# Default: true
|
194
|
-
[--git-hub], [--no-git-hub] # Add GitHub support.
|
195
|
-
# Default: true
|
196
|
-
[--guard], [--no-guard] # Add Guard support.
|
197
|
-
# Default: true
|
198
|
-
[--pry], [--no-pry] # Add Pry support.
|
199
|
-
# Default: true
|
200
|
-
[--reek], [--no-reek] # Add Reek support.
|
201
|
-
# Default: true
|
202
|
-
[--rspec], [--no-rspec] # Add RSpec support.
|
203
|
-
# Default: true
|
204
|
-
[--rubocop], [--no-rubocop] # Add Rubocop support.
|
205
|
-
# Default: true
|
206
|
-
[--security], [--no-security] # Add security support.
|
207
|
-
|
208
|
-
### Rake
|
209
|
-
|
210
|
-
Once a gem skeleton has been created, the following tasks are available (i.e. `bundle exec rake
|
211
|
-
-T`):
|
212
|
-
|
213
|
-
rake build # Build example-0.1.0.gem package
|
214
|
-
rake bundle:audit # Updates the ruby-advisory-db then runs bundle-audit
|
215
|
-
rake clean # Clean gem artifacts
|
216
|
-
rake code_quality # Run code quality checks
|
217
|
-
rake git_cop # Run Git Cop
|
218
|
-
rake install # Install example-0.1.0.gem package
|
219
|
-
rake publish # Build, tag as 0.1.0 (unsigned), and push example-0.1.0.gem to RubyGems
|
220
|
-
rake reek # Check for code smells
|
221
|
-
rake rubocop # Run RuboCop
|
222
|
-
rake rubocop:auto_correct # Auto-correct RuboCop offenses
|
223
|
-
rake spec # Run RSpec code examples
|
224
|
-
rake toc # Update Table of Contents (README)
|
225
|
-
|
226
|
-
*NOTE: Some tasks might differ depending on what options you enabled/disabled during gem
|
227
|
-
generation.*
|
228
|
-
|
229
|
-
When building/testing your gem locally, a typical workflow is:
|
230
|
-
|
231
|
-
1. `bundle exec rake install`
|
232
|
-
1. Test your gem locally.
|
233
|
-
1. Repeat until satisfied.
|
234
|
-
|
235
|
-
When satified with your gem, builds are green, and ready to publish, run:
|
236
|
-
|
237
|
-
bundle exec rake publish
|
238
|
-
|
239
|
-
## Tests
|
240
|
-
|
241
|
-
To test, run:
|
242
|
-
|
243
|
-
bundle exec rake
|
244
|
-
|
245
|
-
## Security
|
246
|
-
|
247
|
-
### Git Signing Key
|
248
|
-
|
249
|
-
To securely sign your Git tags, install and configure [GPG](https://www.gnupg.org):
|
250
|
-
|
251
|
-
brew install gpg
|
252
|
-
gpg --gen-key
|
253
|
-
|
254
|
-
When creating your GPG key, choose these settings:
|
255
|
-
|
256
|
-
- Key kind: RSA and RSA (default)
|
257
|
-
- Key size: 4096
|
258
|
-
- Key validity: 0
|
259
|
-
- Real Name: `<your name>`
|
260
|
-
- Email: `<your email>`
|
261
|
-
- Passphrase: `<your passphrase>`
|
262
|
-
|
263
|
-
To obtain your key, run the following and take the part after the forward slash:
|
264
|
-
|
265
|
-
gpg --list-keys | grep pub
|
266
|
-
|
267
|
-
Add your key to your global Git configuration in the `[user]` section. Example:
|
268
|
-
|
269
|
-
[user]
|
270
|
-
signingkey = <your GPG key>
|
271
|
-
|
272
|
-
Now, when publishing your gems with Gemsmith (i.e. `bundle exec rake publish`), signing of your Git
|
273
|
-
tag will happen automatically. You will be prompted for the GPG Passphrase each time but that is to
|
274
|
-
be expected.
|
275
|
-
|
276
|
-
### Gem Certificates
|
277
|
-
|
278
|
-
To create a certificate for your gems, run the following:
|
279
|
-
|
280
|
-
cd ~/.ssh
|
281
|
-
gem cert --build you@example.com
|
282
|
-
chmod 600 gem-*.pem
|
283
|
-
|
284
|
-
The resulting `*.pem` key files can be referenced via the `:private_key:` and `:public_key:` keys
|
285
|
-
within the `~/.gemsmithrc` file.
|
286
|
-
|
287
|
-
To learn more about gem certificates, read about RubyGems
|
288
|
-
[Security](http://guides.rubygems.org/security).
|
289
|
-
|
290
|
-
## Private Gem Servers
|
291
|
-
|
292
|
-
By default, the following Rake task will publish your gem to [RubyGems](https://rubygems.org):
|
293
|
-
|
294
|
-
bundle exec rake publish
|
295
|
-
|
296
|
-
You can change this behavior by adding metadata to your gemspec that will allow the Rake tasks,
|
297
|
-
mentioned above, to publish your gem to an alternate/private gem server instead. This can be done by
|
298
|
-
updating your gem specification and RubyGems credentials.
|
299
|
-
|
300
|
-
### Gem Specification Metadata
|
301
|
-
|
302
|
-
Add the following metadata to your gemspec:
|
303
|
-
|
304
|
-
Gem::Specification.new do |spec|
|
305
|
-
spec.metadata = {
|
306
|
-
"allowed_push_key" => "example_key",
|
307
|
-
"allowed_push_host" => "https://gems.example.com"
|
308
|
-
}
|
309
|
-
end
|
310
|
-
|
311
|
-
The gemspec metadata keys and values *must* be strings per the
|
312
|
-
[RubyGems Specification](http://guides.rubygems.org/specification-reference/#metadata). Each key
|
313
|
-
represents the following:
|
314
|
-
|
315
|
-
- `allowed_push_key`: Provides a reference (look up) to the key defined the RubyGems credentials
|
316
|
-
file so that sensitive credentials are not used within your gemspec.
|
317
|
-
- `allowed_push_host`: Provides the URL of the private gem server to push your gem to.
|
318
|
-
|
319
|
-
### Gem Credentials
|
320
|
-
|
321
|
-
With your gem specification metadata established, you are ready to publish your gem to a public or
|
322
|
-
private server. If this is your first time publishing a gem and no gem credentials have been
|
323
|
-
configured, you'll be prompted for them. Gem credentials are stored in the RubyGems
|
324
|
-
`~/.gem/credentials` file. From this point forward, future gem publishing will use your stored
|
325
|
-
credentials instead. Multiple credentials can be stored in the `~/.gem/credentials` file. Example:
|
326
|
-
|
327
|
-
---
|
328
|
-
:rubygems_api_key: 2a0b460650e67d9b85a60e183defa376
|
329
|
-
:example_key: "Basic dXNlcjpwYXNzd29yZA=="
|
330
|
-
|
331
|
-
Should you need to delete a credential (due to a bad login/password for example), you can open the
|
332
|
-
`~/.gem/credentials` in your default editor and remove the line(s) you don't need. Upon next publish
|
333
|
-
of your gem, you'll be prompted for the missing credentials.
|
334
|
-
|
335
|
-
## Promotion
|
336
|
-
|
337
|
-
Once your gem is released, let the world know about your accomplishment by posting an update to
|
338
|
-
these sites:
|
339
|
-
|
340
|
-
- [RubyFlow](http://www.rubyflow.com)
|
341
|
-
- [Ruby Library Hunt](https://ruby.libhunt.com)
|
342
|
-
- [RubyDaily](http://rubydaily.org)
|
343
|
-
- [Awesome Ruby](https://awesome-ruby.com)
|
344
|
-
- [Ruby Toolbox](https://www.ruby-toolbox.com)
|
345
|
-
- [Ruby Community](https://www.ruby-lang.org/en/community)
|
346
|
-
|
347
|
-
## Troubleshooting
|
348
|
-
|
349
|
-
When running `bundle exec rake install` or `bundle exec rake publish` with modified, staged, or
|
350
|
-
uncommitted Git changes, the rake task will throw an error to this effect. When this occurs, it is
|
351
|
-
recommended that you commit your changes or [stash](https://git-scm.com/docs/git-stash) them before
|
352
|
-
proceeding.
|
353
|
-
|
354
|
-
## Versioning
|
355
|
-
|
356
|
-
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
357
|
-
|
358
|
-
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
359
|
-
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
360
|
-
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
361
|
-
|
362
|
-
## Code of Conduct
|
363
|
-
|
364
|
-
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
365
|
-
participating in this project you agree to abide by its terms.
|
366
|
-
|
367
|
-
## Contributions
|
368
|
-
|
369
|
-
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
370
|
-
|
371
|
-
## License
|
372
|
-
|
373
|
-
Copyright 2011 [Alchemists](https://www.alchemists.io).
|
374
|
-
Read [LICENSE](LICENSE.md) for details.
|
375
|
-
|
376
|
-
## History
|
377
|
-
|
378
|
-
Read [CHANGES](CHANGES.md) for details.
|
379
|
-
|
380
|
-
## Credits
|
381
|
-
|
382
|
-
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
383
|
-
[Alchemists](https://www.alchemists.io).
|