gemsmith 18.0.2 → 18.2.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: badab9b933b3cc8009dcce38b6c849c38e7b6d90fb849bda9ba3426e9d8c76fe
4
- data.tar.gz: 48386d0058700e7ab46b0ce1189b8264f7c0dcf75f4e2d11b0a702c5bb82a858
3
+ metadata.gz: f46e60199854be3dd1eb4bb2c19964558efd399abdd5ee92fb6f0301bcf29478
4
+ data.tar.gz: aef41826ceceaefae5047debd54054ef9d50ca132f782664df3cd3afc56092de
5
5
  SHA512:
6
- metadata.gz: 3dcd01d2e1c468062c19c060e080140eb6fd5da9dbbc408bdd0a4bdaa2db6e45e7bfdf066d94719380410a3f96d268a38632ff67bd01f4bfe07cc7fa1899e063
7
- data.tar.gz: e43ce7b51bb41176925c911f80d40e8c88d464ce84e7effdf03ef4f0d1a09dc40737bf605aefa3db816e8fed511a7a56cef94b82b06f9ee1c90845b58ae6b4a5
6
+ metadata.gz: 8d1f47132e8b86cdca3e6203dbee344a47552f02c24bc30ce77bbdecc2d86c17819367da4bcdd63d9c5cabf49c926d2c188644136931bceb294844e93bfc59da
7
+ data.tar.gz: e99a9467c8e2fd71fd356fc3b9abcae35f60d35b2171b61f6bdd8d550fe34b0581de78261259ec379c24b454c5d67c5dd830fe1c12e6d3c0e2881a29fabd0b6c
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -25,15 +25,6 @@ toc::[]
25
25
  . link:https://www.ruby-lang.org[Ruby].
26
26
  . link:https://rubygems.org[RubyGems].
27
27
 
28
- == Setup
29
-
30
- To install, run:
31
-
32
- [source,bash]
33
- ----
34
- gem install gemsmith
35
- ----
36
-
37
28
  == Upgrade
38
29
 
39
30
  If upgrading from 17.0.0 to 18.0.0, you'll want to be aware of the following changes:
@@ -43,6 +34,15 @@ If upgrading from 17.0.0 to 18.0.0, you'll want to be aware of the following cha
43
34
  ability to sign tags has been removed (this happens dynamically based on your Git configuration
44
35
  which gives you more flexibility).
45
36
 
37
+ == Setup
38
+
39
+ To install, run:
40
+
41
+ [source,bash]
42
+ ----
43
+ gem install gemsmith
44
+ ----
45
+
46
46
  == Usage
47
47
 
48
48
  === Command Line Interface (CLI)
@@ -71,6 +71,7 @@ BUILD OPTIONS:
71
71
  --[no-]console Add console script. Default: true.
72
72
  --[no-]contributions Add contributions documentation. Default: true.
73
73
  --[no-]debug Add Debug gem. Default: true.
74
+ --[no-]funding Add GitHub funding configuration. Default: false.
74
75
  --[no-]git Add Git. Default: true.
75
76
  --[no-]git_hub Add GitHub templates. Default: false.
76
77
  --[no-]git-lint Add Git Lint gem. Default: true.
@@ -221,6 +222,20 @@ the following:
221
222
  Feel free to take the combined Rubysmith + Gemsmith configuration, modify, and save as your own
222
223
  custom `configuration.yml`.
223
224
 
225
+ It is recommended that you provide URLs for your project which would be all keys found in this
226
+ section:
227
+
228
+ [source,yaml]
229
+ ----
230
+ :project:
231
+ :url:
232
+ # Add sub-key values here.
233
+ ----
234
+
235
+ When these values exist, you'll benefit from having this information added to your generated
236
+ `gemspec` and project documentation. Otherwise -- if these values are empty -- they are removed from
237
+ new gem generation.
238
+
224
239
  === Workflows
225
240
 
226
241
  When building/testing your gem locally, a typical workflow is:
@@ -290,8 +305,8 @@ gem cert --build you@example.com
290
305
  chmod 600 gem-*.pem
291
306
  ----
292
307
 
293
- The resulting `*.pem` key files can be referenced via the `signing_key` and `cert_chain` of your
294
- `*.gemspec` which Gemsmith provides for you via the `--security` build option. Example:
308
+ The resulting `.pem` key files can be referenced via the `signing_key` and `cert_chain` of your
309
+ `.gemspec` which Gemsmith provides for you via the `--security` build option. Example:
295
310
 
296
311
  [source,ruby]
297
312
  ----
@@ -323,7 +338,7 @@ specification and RubyGems credentials.
323
338
 
324
339
  === Gem Specification Metadata
325
340
 
326
- Add the following metadata to your gemspec:
341
+ Add the following gemspec metadata to privately publish new versions of your gem:
327
342
 
328
343
  [source,ruby]
329
344
  ----
@@ -332,7 +347,7 @@ Gem::Specification.new do |spec|
332
347
  end
333
348
  ----
334
349
 
335
- 💡 The gemspec metadata _must_ be strings per the
350
+ 💡 The gemspec metadata (i.e. keys and values) _must_ be strings per the
336
351
  link:https://guides.rubygems.org/specification-reference/#metadata[RubyGems Specification].
337
352
 
338
353
  Use of the `allowed_push_host` key provides two important capabilities:
@@ -360,19 +375,19 @@ https://private.example.com: Basic dXNlcjpwYXNzd29yZA==
360
375
 
361
376
  Notice how the first line contains credentials for the public RubyGems server while the second line
362
377
  is for our private example server. You'll also notice that the key is not a symbol but a URL string
363
- to our private server. This is important as this is how we link our gem specification metadata to
364
- our private credentials. To illustrate further, here are both files truncated and shown together:
378
+ to our private server. This is important because this is how we link our gem specification metadata
379
+ to our private credentials. To illustrate further, here are both files truncated and shown together:
365
380
 
366
381
  ....
367
- # Gem specification metadata which defines the private host to publish to.
382
+ # Gem Specification: The metadata which defines the private host to publish to.
368
383
  spec.metadata = {"allowed_push_host" => "https://private.example.com"}
369
384
 
370
- # Gem credentials where the URL value above becomes the key which enables authentication.
385
+ # Gem Credentials: The URL value -- shown above -- which becomes the key for enabling authentication.
371
386
  https://private.example.com: Basic dXNlcjpwYXNzd29yZA==
372
387
  ....
373
388
 
374
- When the above are linked together like this, you enable Gemsmith to publish your gem using only the
375
- following command:
389
+ When the above are linked together, you enable Gemsmith to publish your gem using only the following
390
+ command:
376
391
 
377
392
  [source,bash]
378
393
  ----
@@ -380,8 +395,9 @@ gemsmith --publish
380
395
  ----
381
396
 
382
397
  This is especially powerful when publishing to
383
- link:https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry[GitHub's
384
- Packages registory] which would look like this when properly configured (truncated for brevity):
398
+ link:https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry[GitHub
399
+ Packages] which would look like this when properly configured (truncated for brevity while using
400
+ fake data):
385
401
 
386
402
  ....
387
403
  # Gem specification
@@ -395,6 +411,105 @@ Lastly, should you need to delete a credential (due to a bad login/password for
395
411
  open the `$HOME/.gem/credentials` in your default editor and remove the line(s) you don't need. Upon
396
412
  next publish of your gem, you'll be prompted for the missing credentials.
397
413
 
414
+ === Bundler Configuration
415
+
416
+ So far, I've shown how to privately _publish_ a gem but now we need to teach Bundler how to install
417
+ the gem as dependency within your upstream project. For demonstration purposes, I'm going to assume
418
+ you are using GitHub Packages as your private gem server. You should be able to quickly translate
419
+ this documentation if using an alternate private gem server, though.
420
+
421
+ The first step is to create your own GitHub Personal Access Token (PAT) which is fast to do by
422
+ following GitHub's own
423
+ link:https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token[documentation].
424
+ At a minimum, you'll need to enable _repo_ and _packages_ scopes with read/write access.
425
+
426
+ With your PAT in hand, you'll need to ensure link:https://bundler.io[Bundler] can authenticate to
427
+ the private GitHub Packages gem server by running the following:
428
+
429
+ [source,bash]
430
+ ----
431
+ bundle config set --global rubygems.pkg.github.com <your GitHub handle>:<PAT>
432
+ # Example: bundle config set --global rubygems.pkg.github.com jdoe:ghp_c5b8d394abefebbf45c7b27b379c74978923
433
+ ----
434
+
435
+ 💡 Using Bundler's `--global` flag ensures you only have to define these credentials once for _all_
436
+ projects which reduces maintenance burden on you. The path to this global configuration can be found
437
+ here: `$HOME/.config/bundler/configuration.yml`.
438
+
439
+ Lastly, you can add this gem to your `Gemfile` as follows:
440
+
441
+ [source,ruby]
442
+ ----
443
+ source "https://rubygems.pkg.github.com/alchemists" do
444
+ gem "demo", "~> 0.0"
445
+ end
446
+ ----
447
+
448
+ At this point -- if you run `bundle install` -- you should see the following in your console:
449
+
450
+ ....
451
+ Fetching gem metadata from https://rubygems.pkg.github.com/alchemists/...
452
+ Resolving dependencies...Fetching gem metadata from https://rubygems.org/.....
453
+ ....
454
+
455
+ If so, you're all set!
456
+
457
+ === GitHub Actions/Packages Automation
458
+
459
+ Earlier, I hinted at using GitHub Packages but what if you could automate the entire publishing
460
+ process? Well, good news, you can by using GitHub Actions to publish your packages. Here's the YAML
461
+ necessary to accomplish this endeavor:
462
+
463
+ ``` yaml
464
+ name: Gemsmith
465
+
466
+ on:
467
+ push:
468
+ branches: main
469
+
470
+ jobs:
471
+ build:
472
+ runs-on: ubuntu-latest
473
+ container:
474
+ image: ruby:latest
475
+ permissions:
476
+ contents: write
477
+ packages: write
478
+
479
+ steps:
480
+ - name: Checkout
481
+ uses: actions/checkout@v3
482
+ with:
483
+ fetch-depth: '0'
484
+ ref: ${{github.head_ref}}
485
+ - name: Setup
486
+ run: |
487
+ git config user.email "engineering@example.com"
488
+ git config user.name "Gemsmith Publisher"
489
+ mkdir -p $HOME/.gem
490
+ printf "%s\n" "https://rubygems.pkg.github.com/example: Bearer ${{secrets.GITHUB_TOKEN}}" > $HOME/.gem/credentials
491
+ chmod 0600 $HOME/.gem/credentials
492
+ - name: Install
493
+ run: gem install gemsmith
494
+ - name: Publish
495
+ run: |
496
+ if git describe --tags --abbrev=0 > /dev/null 2>&1; then
497
+ gemsmith --publish
498
+ else
499
+ printf "%s\n" "First gem version must be manually created. Skipping."
500
+ fi
501
+ ```
502
+
503
+ The above will ensure the following:
504
+
505
+ * Only the first version requires manual publishing (hence the check for existing Git tags).
506
+ * Duplicate versions are always skipped.
507
+ * Only when a new version is detected (by changing your gemspec version) and you are on the `main`
508
+ branch will a new version be automatically published.
509
+
510
+ This entire workflow is explained in my
511
+ link:https://www.alchemists.io/talks/ruby_git_hub_packages[talk] on this exact subject too.
512
+
398
513
  == Promotion
399
514
 
400
515
  Once your gem is released, let the world know about your accomplishment by posting an update to
@@ -402,7 +517,6 @@ these sites:
402
517
 
403
518
  * link:https://rubyflow.com[RubyFlow]
404
519
  * link:https://ruby.libhunt.com[Ruby Library Hunt]
405
- * link:https://rubydaily.org[RubyDaily]
406
520
  * link:https://awesome-ruby.com[Awesome Ruby]
407
521
  * link:https://www.ruby-toolbox.com[Ruby Toolbox]
408
522
  * link:https://www.ruby-lang.org/en/community[Ruby Community]
data/gemsmith.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "gemsmith"
5
- spec.version = "18.0.2"
5
+ spec.version = "18.2.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://www.alchemists.io/projects/gemsmith"
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
13
13
  "bug_tracker_uri" => "https://github.com/bkuhlmann/gemsmith/issues",
14
14
  "changelog_uri" => "https://www.alchemists.io/projects/gemsmith/versions",
15
15
  "documentation_uri" => "https://www.alchemists.io/projects/gemsmith",
16
+ "funding_uri" => "https://github.com/sponsors/bkuhlmann",
16
17
  "label" => "Gemsmith",
17
18
  "rubygems_mfa_required" => "true",
18
19
  "source_code_uri" => "https://github.com/bkuhlmann/gemsmith"
@@ -22,16 +23,16 @@ Gem::Specification.new do |spec|
22
23
  spec.cert_chain = [Gem.default_cert_path]
23
24
 
24
25
  spec.required_ruby_version = "~> 3.1"
25
- spec.add_dependency "auto_injector", "~> 0.4"
26
- spec.add_dependency "cogger", "~> 0.0"
26
+ spec.add_dependency "auto_injector", "~> 0.5"
27
+ spec.add_dependency "cogger", "~> 0.1"
27
28
  spec.add_dependency "dry-container", "~> 0.9"
28
29
  spec.add_dependency "dry-monads", "~> 1.4"
29
30
  spec.add_dependency "milestoner", "~> 14.0"
30
- spec.add_dependency "refinements", "~> 9.2"
31
- spec.add_dependency "rubysmith", "~> 3.0"
32
- spec.add_dependency "runcom", "~> 8.2"
33
- spec.add_dependency "spek", "~> 0.2"
34
- spec.add_dependency "versionaire", "~> 10.0"
31
+ spec.add_dependency "refinements", "~> 9.4"
32
+ spec.add_dependency "rubysmith", "~> 3.2"
33
+ spec.add_dependency "runcom", "~> 8.4"
34
+ spec.add_dependency "spek", "~> 0.3"
35
+ spec.add_dependency "versionaire", "~> 10.3"
35
36
  spec.add_dependency "zeitwerk", "~> 2.5"
36
37
 
37
38
  spec.bindir = "exe"
@@ -20,6 +20,8 @@ module Gemsmith
20
20
 
21
21
  builder.call(config)
22
22
  .render
23
+ .replace(" \n", "")
24
+ .replace(" ", " ")
23
25
  .replace(" \n", "")
24
26
  .replace(" spec", " spec")
25
27
  .replace(/\}\s+s/m, "}\n\n s")
@@ -8,12 +8,25 @@ Gem::Specification.new do |spec|
8
8
  spec.license = "<%= configuration.license_label_version %>"
9
9
 
10
10
  spec.metadata = {
11
- "bug_tracker_uri" => "<%= configuration.computed_project_url_issues %>",
12
- "changelog_uri" => "<%= configuration.computed_project_url_versions %>",
13
- "documentation_uri" => "<%= configuration.computed_project_url_home %>",
11
+ <% unless configuration.computed_project_url_issues.empty? %>
12
+ "bug_tracker_uri" => "<%= configuration.computed_project_url_issues %>",
13
+ <% end %>
14
+ <% unless configuration.computed_project_url_versions.empty? %>
15
+ "changelog_uri" => "<%= configuration.computed_project_url_versions %>",
16
+ <% end %>
17
+ <% unless configuration.computed_project_url_home.empty? %>
18
+ "documentation_uri" => "<%= configuration.computed_project_url_home %>",
19
+ <% end %>
20
+ <% unless configuration.computed_project_url_funding.empty? %>
21
+ "funding_uri" => "<%= configuration.computed_project_url_funding %>",
22
+ <% end %>
14
23
  "label" => "<%= configuration.project_label %>",
15
- "rubygems_mfa_required" => "true",
16
- "source_code_uri" => "<%= configuration.computed_project_url_source %>"
24
+ <% if configuration.computed_project_url_source.empty? %>
25
+ "rubygems_mfa_required" => "true"
26
+ <% else %>
27
+ "rubygems_mfa_required" => "true",
28
+ "source_code_uri" => "<%= configuration.computed_project_url_source %>"
29
+ <% end %>
17
30
  }
18
31
 
19
32
  <% if configuration.build_security %>
@@ -23,19 +36,19 @@ Gem::Specification.new do |spec|
23
36
 
24
37
  spec.required_ruby_version = "~> <%= RUBY_VERSION[/\d+\.\d+/] %>"
25
38
  <% if configuration.build_cli %>
26
- spec.add_dependency "auto_injector", "~> 0.4"
39
+ spec.add_dependency "auto_injector", "~> 0.5"
27
40
  <% end %>
28
41
  <% if configuration.build_cli %>
29
42
  spec.add_dependency "dry-container", "~> 0.9"
30
43
  <% end %>
31
44
  <% if configuration.build_refinements %>
32
- spec.add_dependency "refinements", "~> 9.2"
45
+ spec.add_dependency "refinements", "~> 9.4"
33
46
  <% end %>
34
47
  <% if configuration.build_cli %>
35
- spec.add_dependency "runcom", "~> 8.2"
48
+ spec.add_dependency "runcom", "~> 8.4"
36
49
  <% end %>
37
50
  <% if configuration.build_cli %>
38
- spec.add_dependency "spek", "~> 0.2"
51
+ spec.add_dependency "spek", "~> 0.3"
39
52
  <% end %>
40
53
  <% if configuration.build_zeitwerk %>
41
54
  spec.add_dependency "zeitwerk", "~> 2.5"
data.tar.gz.sig CHANGED
Binary file
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: 18.0.2
4
+ version: 18.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
29
29
  RFE=
30
30
  -----END CERTIFICATE-----
31
- date: 2022-04-22 00:00:00.000000000 Z
31
+ date: 2022-05-07 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: auto_injector
@@ -36,28 +36,28 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.4'
39
+ version: '0.5'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.4'
46
+ version: '0.5'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cogger
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.0'
53
+ version: '0.1'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.0'
60
+ version: '0.1'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: dry-container
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -106,70 +106,70 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '9.2'
109
+ version: '9.4'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '9.2'
116
+ version: '9.4'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rubysmith
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '3.0'
123
+ version: '3.2'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '3.0'
130
+ version: '3.2'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: runcom
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '8.2'
137
+ version: '8.4'
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '8.2'
144
+ version: '8.4'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: spek
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '0.2'
151
+ version: '0.3'
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '0.2'
158
+ version: '0.3'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: versionaire
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '10.0'
165
+ version: '10.3'
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '10.0'
172
+ version: '10.3'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: zeitwerk
175
175
  requirement: !ruby/object:Gem::Requirement
@@ -261,6 +261,7 @@ metadata:
261
261
  bug_tracker_uri: https://github.com/bkuhlmann/gemsmith/issues
262
262
  changelog_uri: https://www.alchemists.io/projects/gemsmith/versions
263
263
  documentation_uri: https://www.alchemists.io/projects/gemsmith
264
+ funding_uri: https://github.com/sponsors/bkuhlmann
264
265
  label: Gemsmith
265
266
  rubygems_mfa_required: 'true'
266
267
  source_code_uri: https://github.com/bkuhlmann/gemsmith
@@ -279,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
280
  - !ruby/object:Gem::Version
280
281
  version: '0'
281
282
  requirements: []
282
- rubygems_version: 3.3.11
283
+ rubygems_version: 3.3.13
283
284
  signing_key:
284
285
  specification_version: 4
285
286
  summary: A command line interface for smithing Ruby gems.
metadata.gz.sig CHANGED
Binary file