gemsmith 9.6.0 → 10.0.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 +3 -0
- data.tar.gz.sig +0 -0
- data/README.md +75 -67
- data/lib/gemsmith.rb +2 -1
- data/lib/gemsmith/cli.rb +27 -17
- data/lib/gemsmith/credentials.rb +6 -3
- data/lib/gemsmith/gem/module_formatter.rb +7 -9
- data/lib/gemsmith/gem/requirement.rb +4 -2
- data/lib/gemsmith/gem/specification.rb +4 -0
- data/lib/gemsmith/generators/base.rb +4 -5
- data/lib/gemsmith/generators/bundler.rb +1 -1
- data/lib/gemsmith/generators/circle_ci.rb +13 -0
- data/lib/gemsmith/generators/cli.rb +1 -1
- data/lib/gemsmith/generators/gem.rb +1 -0
- data/lib/gemsmith/generators/git_cop.rb +13 -0
- data/lib/gemsmith/generators/pragma.rb +20 -17
- data/lib/gemsmith/generators/rails.rb +3 -8
- data/lib/gemsmith/generators/rake.rb +5 -1
- data/lib/gemsmith/helpers/cli.rb +7 -4
- data/lib/gemsmith/identity.rb +1 -5
- data/lib/gemsmith/rake/builder.rb +2 -6
- data/lib/gemsmith/rake/publisher.rb +12 -6
- data/lib/gemsmith/rake/tasks.rb +8 -3
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +7 -5
- data/lib/gemsmith/templates/%gem_name%/README.md.tt +15 -15
- data/lib/gemsmith/templates/%gem_name%/Rakefile.tt +1 -0
- data/lib/gemsmith/templates/%gem_name%/circle.yml.tt +11 -0
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/cli.rb.tt +6 -7
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/identity.rb.tt +1 -7
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/USAGE.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/install_generator.rb.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/USAGE.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/upgrade_generator.rb.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt +7 -22
- metadata +58 -36
- metadata.gz.sig +0 -0
- data/lib/gemsmith/generators/travis.rb +0 -13
- data/lib/gemsmith/templates/%gem_name%/.travis.yml.tt +0 -11
- data/lib/gemsmith/templates/%gem_name%/gemfiles/rails-%rails_version%.x.gemfile.tt +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc045c4ae1d57ae19dfab6dc5b8cab656b73350
|
4
|
+
data.tar.gz: 9848b73d3ab5110e1f022e089cd8abf382bdea36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea41d7745d67c0c8fd8a114a81dd60ffc092bd9413c267b133fbcaff8d82abd4b5c510e03415ffc945adcd37bcf7ff806fbb9cfa1a0ab590b08dfdea5340d2e7
|
7
|
+
data.tar.gz: a3514b43626d2be71b40790785ee552458b0cdd86039dfd1467ae1f25a190ceb0b82ac4e70a61cac1f6b4bea3e7dc7d1a66b0770addfddb0fb75b0b19893eb58
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/README.md
CHANGED
@@ -4,44 +4,44 @@
|
|
4
4
|
[![Code Climate GPA](https://codeclimate.com/github/bkuhlmann/gemsmith.svg)](https://codeclimate.com/github/bkuhlmann/gemsmith)
|
5
5
|
[![Code Climate Coverage](https://codeclimate.com/github/bkuhlmann/gemsmith/coverage.svg)](https://codeclimate.com/github/bkuhlmann/gemsmith)
|
6
6
|
[![Gemnasium Status](https://gemnasium.com/bkuhlmann/gemsmith.svg)](https://gemnasium.com/bkuhlmann/gemsmith)
|
7
|
-
[![
|
7
|
+
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/gemsmith.svg?style=svg)](https://circleci.com/gh/bkuhlmann/gemsmith)
|
8
8
|
[![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/bkuhlmann)
|
9
9
|
|
10
10
|
A command line interface for smithing new Ruby gems.
|
11
11
|
|
12
12
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
- [Features](#features)
|
17
|
-
- [Screencasts](#screencasts)
|
18
|
-
- [Requirements](#requirements)
|
19
|
-
- [Setup](#setup)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- [Usage](#usage)
|
24
|
-
|
25
|
-
|
26
|
-
- [Tests](#tests)
|
27
|
-
- [Security](#security)
|
28
|
-
|
29
|
-
|
30
|
-
- [Private Gem Servers](#private-gem-servers)
|
31
|
-
|
32
|
-
|
33
|
-
- [Promotion](#promotion)
|
34
|
-
- [Troubleshooting](#troubleshooting)
|
35
|
-
- [Versioning](#versioning)
|
36
|
-
- [Code of Conduct](#code-of-conduct)
|
37
|
-
- [Contributions](#contributions)
|
38
|
-
- [License](#license)
|
39
|
-
- [History](#history)
|
40
|
-
- [Credits](#credits)
|
14
|
+
## Table of Contents
|
15
|
+
|
16
|
+
- [Features](#features)
|
17
|
+
- [Screencasts](#screencasts)
|
18
|
+
- [Requirements](#requirements)
|
19
|
+
- [Setup](#setup)
|
20
|
+
- [Install](#install)
|
21
|
+
- [Configuration](#configuration)
|
22
|
+
- [Existing Gems](#existing-gems)
|
23
|
+
- [Usage](#usage)
|
24
|
+
- [Command Line Interface (CLI)](#command-line-interface-cli)
|
25
|
+
- [Rake](#rake)
|
26
|
+
- [Tests](#tests)
|
27
|
+
- [Security](#security)
|
28
|
+
- [Git Signing Key](#git-signing-key)
|
29
|
+
- [Gem Certificates](#gem-certificates)
|
30
|
+
- [Private Gem Servers](#private-gem-servers)
|
31
|
+
- [Gem Specification Metadata](#gem-specification-metadata)
|
32
|
+
- [Gem Credentials](#gem-credentials)
|
33
|
+
- [Promotion](#promotion)
|
34
|
+
- [Troubleshooting](#troubleshooting)
|
35
|
+
- [Versioning](#versioning)
|
36
|
+
- [Code of Conduct](#code-of-conduct)
|
37
|
+
- [Contributions](#contributions)
|
38
|
+
- [License](#license)
|
39
|
+
- [History](#history)
|
40
|
+
- [Credits](#credits)
|
41
41
|
|
42
42
|
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
43
43
|
|
44
|
-
|
44
|
+
## Features
|
45
45
|
|
46
46
|
- Builds a gem skeleton with enhanced Bundler functionality.
|
47
47
|
- Uses [Refinements](https://github.com/bkuhlmann/refinements) Ruby core library enhancements.
|
@@ -56,13 +56,14 @@ A command line interface for smithing new Ruby gems.
|
|
56
56
|
- Supports [Pry](http://pryrepl.org).
|
57
57
|
- Supports [Guard](https://github.com/guard/guard).
|
58
58
|
- Supports [RSpec](http://rspec.info).
|
59
|
+
- Supports [Git Cop](https://github.com/bkuhlmann/git-cop).
|
59
60
|
- Supports [Reek](https://github.com/troessner/reek).
|
60
61
|
- Supports [Rubocop](https://github.com/bbatsov/rubocop).
|
61
62
|
- Supports [SCSS Lint](https://github.com/brigade/scss-lint).
|
62
63
|
- Supports [GitHub](https://github.com).
|
63
64
|
- Supports [Code Climate](https://codeclimate.com).
|
64
65
|
- Supports [Gemnasium](https://gemnasium.com).
|
65
|
-
- Supports [
|
66
|
+
- Supports [Circle CI](https://circleci.com).
|
66
67
|
- Supports [Patreon](https://www.patreon.com).
|
67
68
|
- Supports common settings and a structured layout for building new gems.
|
68
69
|
- Supports publishing to public or private gem servers.
|
@@ -75,20 +76,20 @@ A command line interface for smithing new Ruby gems.
|
|
75
76
|
- Aids in viewing source code of semantically versioned gems within your favorite editor.
|
76
77
|
- Aids in viewing documentation of semantically versioned within your default browser.
|
77
78
|
|
78
|
-
|
79
|
+
## Screencasts
|
79
80
|
|
80
|
-
[![asciicast](https://asciinema.org/a/
|
81
|
+
[![asciicast](https://asciinema.org/a/125222.png)](https://asciinema.org/a/125222)
|
81
82
|
|
82
|
-
|
83
|
+
## Requirements
|
83
84
|
|
84
85
|
0. A UNIX-based system.
|
85
86
|
0. [Ruby 2.4.x](https://www.ruby-lang.org).
|
86
87
|
0. [RubyGems](https://rubygems.org).
|
87
88
|
0. [Bundler](https://github.com/bundler/bundler).
|
88
89
|
|
89
|
-
|
90
|
+
## Setup
|
90
91
|
|
91
|
-
|
92
|
+
### Install
|
92
93
|
|
93
94
|
For a secure install, type the following from the command line (recommended):
|
94
95
|
|
@@ -103,17 +104,21 @@ For an insecure install, type the following (not recommended):
|
|
103
104
|
|
104
105
|
gem install gemsmith
|
105
106
|
|
106
|
-
|
107
|
+
### Configuration
|
107
108
|
|
108
|
-
|
109
|
+
This gem can be configured via a global configuration:
|
109
110
|
|
110
|
-
~/.
|
111
|
+
~/.config/gemsmith/configuration.yml
|
111
112
|
|
112
|
-
|
113
|
+
It can also be configured via [XDG environment variables](https://github.com/bkuhlmann/runcom#xdg)
|
114
|
+
as provided by the [Runcom](https://github.com/bkuhlmann/runcom) gem.
|
115
|
+
|
116
|
+
The default configuration is as follows:
|
113
117
|
|
114
118
|
:year: <current year>
|
115
119
|
:github_user: "<Git config GitHub user>",
|
116
120
|
:gem:
|
121
|
+
:label: "Undefined"
|
117
122
|
:name: "undefined"
|
118
123
|
:path: "undefined"
|
119
124
|
:class: "Undefined"
|
@@ -129,13 +134,14 @@ The following defaults are used when no options are configured:
|
|
129
134
|
:url: ""
|
130
135
|
:versions:
|
131
136
|
:ruby: "<current Ruby version>"
|
132
|
-
:rails: "5.
|
137
|
+
:rails: "5.1"
|
133
138
|
:generate:
|
134
139
|
:cli: false
|
135
140
|
:rails: false
|
136
141
|
:security: true
|
137
142
|
:pry: true
|
138
143
|
:guard: true
|
144
|
+
:git_cop: true
|
139
145
|
:rspec: true
|
140
146
|
:reek: true
|
141
147
|
:rubocop: true
|
@@ -143,16 +149,15 @@ The following defaults are used when no options are configured:
|
|
143
149
|
:git_hub: false
|
144
150
|
:code_climate: false
|
145
151
|
:gemnasium: false
|
146
|
-
:
|
152
|
+
:circle_ci: false
|
147
153
|
:patreon: false
|
148
154
|
:publish:
|
149
155
|
:sign: false
|
150
156
|
|
151
|
-
|
152
|
-
|
153
|
-
customizable experience per gem if necessary.
|
157
|
+
Feel free to take this default configuration, modify, and save as your own custom
|
158
|
+
`configuration.yml`.
|
154
159
|
|
155
|
-
|
160
|
+
### Existing Gems
|
156
161
|
|
157
162
|
If you have gems that were not originally crafted by Gemsmith, you can add Gemsmith support to them
|
158
163
|
by modifying the following files:
|
@@ -175,9 +180,9 @@ Replace or add a modified version of the following to your gem's `Rakefile`:
|
|
175
180
|
|
176
181
|
With those changes, you can leverage the benefits of Gemsmith within your existing gem.
|
177
182
|
|
178
|
-
|
183
|
+
## Usage
|
179
184
|
|
180
|
-
|
185
|
+
### Command Line Interface (CLI)
|
181
186
|
|
182
187
|
From the command line, type: `gemsmith --help`
|
183
188
|
|
@@ -198,6 +203,8 @@ For more gem generation options, type: `gemsmith --help --generate`
|
|
198
203
|
# Default: true
|
199
204
|
[--guard], [--no-guard] # Add Guard support.
|
200
205
|
# Default: true
|
206
|
+
[--git-cop], [--no-git-cop] # Add Git Cop support.
|
207
|
+
# Default: true
|
201
208
|
[--rspec], [--no-rspec] # Add RSpec support.
|
202
209
|
# Default: true
|
203
210
|
[--reek], [--no-reek] # Add Reek support.
|
@@ -208,20 +215,21 @@ For more gem generation options, type: `gemsmith --help --generate`
|
|
208
215
|
[--git-hub], [--no-git-hub] # Add GitHub support.
|
209
216
|
[--code-climate], [--no-code-climate] # Add Code Climate support.
|
210
217
|
[--gemnasium], [--no-gemnasium] # Add Gemnasium support.
|
211
|
-
[--
|
218
|
+
[--circle-ci], [--no-circle-ci] # Add Circle CI support.
|
212
219
|
[--patreon], [--no-patreon] # Add Patreon support.
|
213
220
|
|
214
|
-
|
221
|
+
### Rake
|
215
222
|
|
216
223
|
Once a gem skeleton has been created, the following tasks are available (i.e. `bundle exec rake
|
217
224
|
-T`):
|
218
225
|
|
219
|
-
rake build # Build
|
226
|
+
rake build # Build example-0.1.0.gem package
|
220
227
|
rake clean # Clean gem artifacts
|
221
228
|
rake code_quality # Run code quality checks
|
222
229
|
rake doc # Update README (table of contents)
|
223
|
-
rake
|
224
|
-
rake
|
230
|
+
rake git_cop # Run Git Cop
|
231
|
+
rake install # Install example-0.1.0.gem package
|
232
|
+
rake publish # Build, tag as v0.1.0 (unsigned), and push example-0.1.0.gem to RubyGems
|
225
233
|
rake reek # Check for code smells
|
226
234
|
rake rubocop # Run RuboCop
|
227
235
|
rake rubocop:auto_correct # Auto-correct RuboCop offenses
|
@@ -237,15 +245,15 @@ When satified with your gem, builds are green, and ready to publish, run:
|
|
237
245
|
|
238
246
|
bundle exec rake publish
|
239
247
|
|
240
|
-
|
248
|
+
## Tests
|
241
249
|
|
242
250
|
To test, run:
|
243
251
|
|
244
252
|
bundle exec rake
|
245
253
|
|
246
|
-
|
254
|
+
## Security
|
247
255
|
|
248
|
-
|
256
|
+
### Git Signing Key
|
249
257
|
|
250
258
|
To securely sign your Git tags, install and configure [GPG](https://www.gnupg.org):
|
251
259
|
|
@@ -274,7 +282,7 @@ Now, when publishing your gems with Gemsmith (i.e. `bundle exec rake publish`),
|
|
274
282
|
tag will happen automatically. You will be prompted for the GPG Passphrase each time but that is to
|
275
283
|
be expected.
|
276
284
|
|
277
|
-
|
285
|
+
### Gem Certificates
|
278
286
|
|
279
287
|
To create a certificate for your gems, run the following:
|
280
288
|
|
@@ -291,7 +299,7 @@ To learn more about gem certificates, read the following:
|
|
291
299
|
- [A Practical Guide to Using Signed Ruby Gems - Part 1: Bundler](http://blog.meldium.com/home/2013/3/3/signed-rubygems-part)
|
292
300
|
- [A Practical Guide to Using Signed Ruby Gems - Part 2: Heroku](http://blog.meldium.com/home/2013/3/6/signed-gems-on-heroku)
|
293
301
|
|
294
|
-
|
302
|
+
## Private Gem Servers
|
295
303
|
|
296
304
|
By default, the following Rake task will publish your gem to [RubyGems](https://rubygems.org):
|
297
305
|
|
@@ -301,7 +309,7 @@ You can change this behavior by adding metadata to your gemspec that will allow
|
|
301
309
|
mentioned above, to publish your gem to an alternate/private gem server instead. This can be done by
|
302
310
|
updating your gem specification and RubyGems credentials.
|
303
311
|
|
304
|
-
|
312
|
+
### Gem Specification Metadata
|
305
313
|
|
306
314
|
Add the following metadata to your gemspec:
|
307
315
|
|
@@ -320,7 +328,7 @@ represents the following:
|
|
320
328
|
file so that sensitive credentials are not used within your gemspec.
|
321
329
|
- `allowed_push_host`: Provides the URL of the private gem server to push your gem to.
|
322
330
|
|
323
|
-
|
331
|
+
### Gem Credentials
|
324
332
|
|
325
333
|
With your gem specification metadata established, you are ready to publish your gem to a public or
|
326
334
|
private server. If this is your first time publishing a gem and no gem credentials have been
|
@@ -336,21 +344,21 @@ Should you need to delete a credential (due to a bad login/password for example)
|
|
336
344
|
`~/.gem/credentials` in your default editor and remove the line(s) you don't need. Upon next publish
|
337
345
|
of your gem, you'll be prompted for the missing credentials.
|
338
346
|
|
339
|
-
|
347
|
+
## Promotion
|
340
348
|
|
341
349
|
Once your gem is released, you might want to let the world know about your accomplishment:
|
342
350
|
|
343
351
|
- [How to Spread the Word About Your Code](https://hacks.mozilla.org/2013/05/how-to-spread-the-word-about-your-code)
|
344
352
|
- [RubyFlow](http://www.rubyflow.com)
|
345
353
|
|
346
|
-
|
354
|
+
## Troubleshooting
|
347
355
|
|
348
356
|
When running `bundle exec rake install` or `bundle exec rake publish` with modified, staged, or
|
349
357
|
uncommitted Git changes, the rake task will throw an error to this effect. When this occurs, it is
|
350
358
|
recommended that you commit your changes or [stash](https://git-scm.com/docs/git-stash) them before
|
351
359
|
proceeding.
|
352
360
|
|
353
|
-
|
361
|
+
## Versioning
|
354
362
|
|
355
363
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
356
364
|
|
@@ -358,25 +366,25 @@ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
|
358
366
|
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
359
367
|
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
360
368
|
|
361
|
-
|
369
|
+
## Code of Conduct
|
362
370
|
|
363
371
|
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
364
372
|
participating in this project you agree to abide by its terms.
|
365
373
|
|
366
|
-
|
374
|
+
## Contributions
|
367
375
|
|
368
376
|
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
369
377
|
|
370
|
-
|
378
|
+
## License
|
371
379
|
|
372
380
|
Copyright (c) 2011 [Alchemists](https://www.alchemists.io).
|
373
381
|
Read [LICENSE](LICENSE.md) for details.
|
374
382
|
|
375
|
-
|
383
|
+
## History
|
376
384
|
|
377
385
|
Read [CHANGES](CHANGES.md) for details.
|
378
386
|
|
379
|
-
|
387
|
+
## Credits
|
380
388
|
|
381
389
|
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
382
390
|
[Alchemists](https://www.alchemists.io).
|
data/lib/gemsmith.rb
CHANGED
@@ -13,11 +13,13 @@ require "gemsmith/gem/requirement"
|
|
13
13
|
require "gemsmith/gem/specification"
|
14
14
|
require "gemsmith/generators/base"
|
15
15
|
require "gemsmith/generators/bundler"
|
16
|
+
require "gemsmith/generators/circle_ci"
|
16
17
|
require "gemsmith/generators/cli"
|
17
18
|
require "gemsmith/generators/code_climate"
|
18
19
|
require "gemsmith/generators/documentation"
|
19
20
|
require "gemsmith/generators/gem"
|
20
21
|
require "gemsmith/generators/git"
|
22
|
+
require "gemsmith/generators/git_cop"
|
21
23
|
require "gemsmith/generators/git_hub"
|
22
24
|
require "gemsmith/generators/guard"
|
23
25
|
require "gemsmith/generators/pragma"
|
@@ -28,7 +30,6 @@ require "gemsmith/generators/rspec"
|
|
28
30
|
require "gemsmith/generators/rubocop"
|
29
31
|
require "gemsmith/generators/ruby"
|
30
32
|
require "gemsmith/generators/scss_lint"
|
31
|
-
require "gemsmith/generators/travis"
|
32
33
|
require "gemsmith/rake/builder"
|
33
34
|
require "gemsmith/rake/publisher"
|
34
35
|
require "gemsmith/rake/tasks"
|
data/lib/gemsmith/cli.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "thor"
|
4
4
|
require "thor/actions"
|
5
|
-
require "thor_plus/actions"
|
6
5
|
require "refinements/strings"
|
7
6
|
require "refinements/hashes"
|
8
7
|
require "runcom"
|
@@ -14,7 +13,6 @@ module Gemsmith
|
|
14
13
|
# rubocop:disable Metrics/ClassLength
|
15
14
|
class CLI < Thor
|
16
15
|
include Thor::Actions
|
17
|
-
include ThorPlus::Actions
|
18
16
|
include Helpers::CLI
|
19
17
|
include Helpers::Template
|
20
18
|
|
@@ -30,10 +28,11 @@ module Gemsmith
|
|
30
28
|
|
31
29
|
# rubocop:disable Metrics/MethodLength
|
32
30
|
def self.configuration
|
33
|
-
Runcom::Configuration.new
|
31
|
+
Runcom::Configuration.new project_name: Identity.name, defaults: {
|
34
32
|
year: Time.now.year,
|
35
33
|
github_user: Git.github_user,
|
36
34
|
gem: {
|
35
|
+
label: "Undefined",
|
37
36
|
name: "undefined",
|
38
37
|
path: "undefined",
|
39
38
|
class: "Undefined",
|
@@ -60,6 +59,7 @@ module Gemsmith
|
|
60
59
|
security: true,
|
61
60
|
pry: true,
|
62
61
|
guard: true,
|
62
|
+
git_cop: true,
|
63
63
|
rspec: true,
|
64
64
|
reek: true,
|
65
65
|
rubocop: true,
|
@@ -67,7 +67,7 @@ module Gemsmith
|
|
67
67
|
git_hub: false,
|
68
68
|
code_climate: false,
|
69
69
|
gemnasium: false,
|
70
|
-
|
70
|
+
circle_ci: false,
|
71
71
|
patreon: false
|
72
72
|
},
|
73
73
|
publish: {
|
@@ -85,12 +85,13 @@ module Gemsmith
|
|
85
85
|
Generators::Ruby,
|
86
86
|
Generators::Rails,
|
87
87
|
Generators::Rspec,
|
88
|
+
Generators::GitCop,
|
88
89
|
Generators::Reek,
|
89
90
|
Generators::Rubocop,
|
90
91
|
Generators::SCSSLint,
|
91
92
|
Generators::CodeClimate,
|
92
93
|
Generators::Guard,
|
93
|
-
Generators::
|
94
|
+
Generators::CircleCI,
|
94
95
|
Generators::Bundler,
|
95
96
|
Generators::GitHub,
|
96
97
|
Generators::Pragma,
|
@@ -126,6 +127,10 @@ module Gemsmith
|
|
126
127
|
desc: "Add Guard support.",
|
127
128
|
type: :boolean,
|
128
129
|
default: configuration.to_h.dig(:generate, :guard)
|
130
|
+
method_option :git_cop,
|
131
|
+
desc: "Add Git Cop support.",
|
132
|
+
type: :boolean,
|
133
|
+
default: configuration.to_h.dig(:generate, :git_cop)
|
129
134
|
method_option :rspec,
|
130
135
|
desc: "Add RSpec support.",
|
131
136
|
type: :boolean,
|
@@ -154,24 +159,25 @@ module Gemsmith
|
|
154
159
|
desc: "Add Gemnasium support.",
|
155
160
|
type: :boolean,
|
156
161
|
default: configuration.to_h.dig(:generate, :gemnasium)
|
157
|
-
method_option :
|
158
|
-
desc: "Add
|
162
|
+
method_option :circle_ci,
|
163
|
+
desc: "Add Circle CI support.",
|
159
164
|
type: :boolean,
|
160
|
-
default: configuration.to_h.dig(:generate, :
|
165
|
+
default: configuration.to_h.dig(:generate, :circle_ci)
|
161
166
|
method_option :patreon,
|
162
167
|
desc: "Add Patreon support.",
|
163
168
|
type: :boolean,
|
164
169
|
default: configuration.to_h.dig(:generate, :patreon)
|
165
170
|
# rubocop:disable Metrics/AbcSize
|
171
|
+
# :reek:TooManyStatements
|
166
172
|
def generate name
|
167
173
|
print_cli_and_rails_engine_option_error && return if options.cli? && options.rails?
|
168
174
|
|
169
|
-
info "Generating gem..."
|
175
|
+
say_status :info, "Generating gem...", :green
|
170
176
|
|
171
177
|
setup_configuration name: name, options: options.to_h
|
172
178
|
self.class.generators.each { |generator| generator.run self, configuration: configuration }
|
173
179
|
|
174
|
-
info "Gem generation finished."
|
180
|
+
say_status :info, "Gem generation finished.", :green
|
175
181
|
end
|
176
182
|
|
177
183
|
desc "-o, [--open=GEM]", "Open a gem in default editor."
|
@@ -183,10 +189,10 @@ module Gemsmith
|
|
183
189
|
desc "-r, [--read=GEM]", "Open a gem in default browser."
|
184
190
|
map %w[-r --read] => :read
|
185
191
|
def read name
|
186
|
-
error "Gem home page is not defined." unless process_gem(name, "visit")
|
192
|
+
say_status :error, "Gem home page is not defined.", :red unless process_gem(name, "visit")
|
187
193
|
end
|
188
194
|
|
189
|
-
desc "-c, [--config]",
|
195
|
+
desc "-c, [--config]", "Manage gem configuration."
|
190
196
|
map %w[-c --config] => :config
|
191
197
|
method_option :edit,
|
192
198
|
aliases: "-e",
|
@@ -197,10 +203,11 @@ module Gemsmith
|
|
197
203
|
desc: "Print gem configuration.",
|
198
204
|
type: :boolean, default: false
|
199
205
|
def config
|
200
|
-
path = self.class.configuration.
|
206
|
+
path = self.class.configuration.path
|
201
207
|
|
202
|
-
if options.edit? then `#{
|
203
|
-
elsif options.info?
|
208
|
+
if options.edit? then `#{ENV["EDITOR"]} #{path}`
|
209
|
+
elsif options.info?
|
210
|
+
path ? say(path) : say("Configuration doesn't exist.")
|
204
211
|
else help(:config)
|
205
212
|
end
|
206
213
|
end
|
@@ -224,6 +231,7 @@ module Gemsmith
|
|
224
231
|
def setup_configuration name:, options: {}
|
225
232
|
@configuration = self.class.configuration.to_h.merge(
|
226
233
|
gem: {
|
234
|
+
label: name.titleize,
|
227
235
|
name: name,
|
228
236
|
path: name.snakecase,
|
229
237
|
class: name.camelcase,
|
@@ -236,8 +244,10 @@ module Gemsmith
|
|
236
244
|
end
|
237
245
|
|
238
246
|
def print_cli_and_rails_engine_option_error
|
239
|
-
error
|
240
|
-
|
247
|
+
say_status :error,
|
248
|
+
"Generating a gem with CLI and Rails Engine functionality is not allowed. " \
|
249
|
+
"Build separate gems for improved separation of concerns and design.",
|
250
|
+
:red
|
241
251
|
end
|
242
252
|
end
|
243
253
|
end
|