gemsmith 11.2.0 → 11.3.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/README.md +3 -1
- data/lib/gemsmith/cli.rb +11 -2
- data/lib/gemsmith/generators/base.rb +4 -0
- data/lib/gemsmith/generators/circle_ci.rb +1 -1
- data/lib/gemsmith/generators/cli.rb +3 -5
- data/lib/gemsmith/generators/code_climate.rb +1 -2
- data/lib/gemsmith/generators/documentation.rb +5 -5
- data/lib/gemsmith/generators/gem.rb +11 -8
- data/lib/gemsmith/generators/git.rb +1 -1
- data/lib/gemsmith/generators/git_hub.rb +2 -2
- data/lib/gemsmith/generators/guard.rb +1 -1
- data/lib/gemsmith/generators/rails.rb +11 -9
- data/lib/gemsmith/generators/rake.rb +1 -1
- data/lib/gemsmith/generators/reek.rb +1 -1
- data/lib/gemsmith/generators/rspec.rb +4 -4
- data/lib/gemsmith/generators/rubocop.rb +1 -1
- data/lib/gemsmith/generators/ruby.rb +1 -1
- data/lib/gemsmith/identity.rb +1 -1
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +6 -6
- data/lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt +3 -3
- data/lib/gemsmith/templates/%gem_name%/Guardfile.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/README.md.tt +2 -2
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%.rb.tt +1 -1
- data/lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt +1 -1
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 239c568371d501376dcff5619e20b4cd8946690316580a534b9eb4e7f7207f83
|
4
|
+
data.tar.gz: 04f1a037a219e2e95f2d04167488f2e8bbba179ec5f762cd857d99bca136ff7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad48caf292a01a67602e4b93c541a5511fc6014139605938a81f3801ac3f46eb66c7e0f999481cf13e39479ffe620c19137056e38e6700ad5e22b950fd84220
|
7
|
+
data.tar.gz: ddfd1d4c260cd1335f3574b4eabd270b8f41ec8d2ce1f8d5f5b2ac2e1ffdff0cecbc9085d0d967bbdcfc6697daabbf57c705b92ff764fcd3b57128db60b85030
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -127,6 +127,7 @@ The default configuration is as follows:
|
|
127
127
|
:circle_ci: false
|
128
128
|
:cli: false
|
129
129
|
:code_climate: false
|
130
|
+
:engine: false
|
130
131
|
:git_cop: true
|
131
132
|
:git_hub: true
|
132
133
|
:guard: true
|
@@ -185,6 +186,7 @@ For more gem generation options, type: `gemsmith --help --generate`
|
|
185
186
|
[--circle-ci], [--no-circle-ci] # Add Circle CI support.
|
186
187
|
[--cli], [--no-cli] # Add CLI support.
|
187
188
|
[--code-climate], [--no-code-climate] # Add Code Climate support.
|
189
|
+
[--engine], [--no-engine] # Add Rails Engine support.
|
188
190
|
[--git-cop], [--no-git-cop] # Add Git Cop support.
|
189
191
|
# Default: true
|
190
192
|
[--git-hub], [--no-git-hub] # Add GitHub support.
|
@@ -193,7 +195,7 @@ For more gem generation options, type: `gemsmith --help --generate`
|
|
193
195
|
# Default: true
|
194
196
|
[--pry], [--no-pry] # Add Pry support.
|
195
197
|
# Default: true
|
196
|
-
[--rails], [--no-rails] # Add Rails support.
|
198
|
+
[--rails], [--no-rails] # DEPRECATED (Use --engine instead). Add Rails support.
|
197
199
|
[--reek], [--no-reek] # Add Reek support.
|
198
200
|
# Default: true
|
199
201
|
[--rspec], [--no-rspec] # Add RSpec support.
|
data/lib/gemsmith/cli.rb
CHANGED
@@ -63,6 +63,7 @@ module Gemsmith
|
|
63
63
|
guard: true,
|
64
64
|
pry: true,
|
65
65
|
rails: false,
|
66
|
+
engine: false,
|
66
67
|
reek: true,
|
67
68
|
rspec: true,
|
68
69
|
rubocop: true,
|
@@ -126,6 +127,10 @@ module Gemsmith
|
|
126
127
|
desc: "Add Code Climate support.",
|
127
128
|
type: :boolean,
|
128
129
|
default: configuration.to_h.dig(:generate, :code_climate)
|
130
|
+
method_option :engine,
|
131
|
+
desc: "Add Rails Engine support.",
|
132
|
+
type: :boolean,
|
133
|
+
default: configuration.to_h.dig(:generate, :engine)
|
129
134
|
method_option :git_cop,
|
130
135
|
desc: "Add Git Cop support.",
|
131
136
|
type: :boolean,
|
@@ -143,7 +148,7 @@ module Gemsmith
|
|
143
148
|
type: :boolean,
|
144
149
|
default: configuration.to_h.dig(:generate, :pry)
|
145
150
|
method_option :rails,
|
146
|
-
desc: "Add Rails support.",
|
151
|
+
desc: "DEPRECATED (Use --engine instead). Add Rails support.",
|
147
152
|
type: :boolean,
|
148
153
|
default: configuration.to_h.dig(:generate, :rails)
|
149
154
|
method_option :reek,
|
@@ -165,7 +170,11 @@ module Gemsmith
|
|
165
170
|
# rubocop:disable Metrics/AbcSize
|
166
171
|
# :reek:TooManyStatements
|
167
172
|
def generate name
|
168
|
-
|
173
|
+
rails = options.rails?
|
174
|
+
warn "[DEPRECATION]: --rails is deprecated, use --engine instead." if rails
|
175
|
+
print_cli_and_rails_engine_option_error && return if options.cli? && (
|
176
|
+
rails || options.engine?
|
177
|
+
)
|
169
178
|
|
170
179
|
say_status :info, "Generating gem...", :green
|
171
180
|
|
@@ -4,16 +4,14 @@ module Gemsmith
|
|
4
4
|
module Generators
|
5
5
|
# Generates Command Line Interface (CLI) support.
|
6
6
|
class CLI < Base
|
7
|
-
# rubocop:disable Metrics/AbcSize
|
8
7
|
def run
|
9
8
|
return unless configuration.dig(:generate, :cli)
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
template "%gem_name%/bin/%gem_name%.tt"
|
11
|
+
template "%gem_name%/lib/%gem_path%/cli.rb.tt"
|
12
|
+
template "%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt"
|
14
13
|
cli.chmod "#{gem_name}/bin/#{gem_name}", 0o755
|
15
14
|
end
|
16
|
-
# rubocop:enable Metrics/AbcSize
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -7,11 +7,11 @@ module Gemsmith
|
|
7
7
|
# Generates documentation support.
|
8
8
|
class Documentation < Base
|
9
9
|
def create_files
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
template "%gem_name%/README.md.tt"
|
11
|
+
template "%gem_name%/CONTRIBUTING.md.tt"
|
12
|
+
template "%gem_name%/CODE_OF_CONDUCT.md.tt"
|
13
|
+
template "%gem_name%/LICENSE.md.tt"
|
14
|
+
template "%gem_name%/CHANGES.md.tt"
|
15
15
|
end
|
16
16
|
|
17
17
|
def update_readme
|
@@ -4,17 +4,20 @@ module Gemsmith
|
|
4
4
|
module Generators
|
5
5
|
# Generates default gem support.
|
6
6
|
class Gem < Base
|
7
|
-
# rubocop:disable Metrics/AbcSize
|
8
|
-
# :reek:TooManyStatements
|
9
7
|
def run
|
10
|
-
|
11
|
-
cli.template "%gem_name%/Gemfile.tt", configuration
|
12
|
-
cli.template "%gem_name%/%gem_name%.gemspec.tt", configuration
|
13
|
-
cli.template "#{lib_gem_root}.rb.tt", configuration
|
14
|
-
cli.template "#{lib_gem_root}/identity.rb.tt", configuration
|
8
|
+
create_files
|
15
9
|
cli.chmod "#{configuration.dig(:gem, :name)}/bin/setup", 0o755
|
16
10
|
end
|
17
|
-
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def create_files
|
15
|
+
template "%gem_name%/bin/setup.tt"
|
16
|
+
template "%gem_name%/Gemfile.tt"
|
17
|
+
template "%gem_name%/%gem_name%.gemspec.tt"
|
18
|
+
template "#{lib_gem_root}.rb.tt"
|
19
|
+
template "#{lib_gem_root}/identity.rb.tt"
|
20
|
+
end
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
@@ -6,8 +6,8 @@ module Gemsmith
|
|
6
6
|
class GitHub < Base
|
7
7
|
def run
|
8
8
|
return unless configuration.dig(:generate, :git_hub)
|
9
|
-
|
10
|
-
|
9
|
+
template "%gem_name%/.github/ISSUE_TEMPLATE.md.tt"
|
10
|
+
template "%gem_name%/.github/PULL_REQUEST_TEMPLATE.md.tt"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Gemsmith
|
4
4
|
module Generators
|
5
|
-
# Generates Ruby on Rails support.
|
5
|
+
# Generates Ruby on Rails Engine support.
|
6
6
|
class Rails < Base
|
7
7
|
def rails?
|
8
8
|
cli.run "command -v rails > /dev/null"
|
@@ -15,19 +15,17 @@ module Gemsmith
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def create_engine
|
18
|
-
|
18
|
+
template "#{LIB_ROOT}/%gem_path%/engine.rb.tt"
|
19
19
|
cli.run "rails plugin new --skip #{configuration.dig :gem, :name} #{engine_options}"
|
20
20
|
end
|
21
21
|
|
22
|
-
# rubocop:disable Metrics/AbcSize
|
23
22
|
def create_generator_files
|
24
23
|
cli.empty_directory "#{generator_root}/templates"
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
template "#{generator_root}/install/install_generator.rb.tt"
|
25
|
+
template "#{generator_root}/install/USAGE.tt"
|
26
|
+
template "#{generator_root}/upgrade/upgrade_generator.rb.tt"
|
27
|
+
template "#{generator_root}/upgrade/USAGE.tt"
|
29
28
|
end
|
30
|
-
# rubocop:enable Metrics/AbcSize
|
31
29
|
|
32
30
|
def stub_assets
|
33
31
|
cli.run %(printf "%s" > "#{gem_name}/app/assets/javascripts/#{gem_path}/application.js")
|
@@ -45,7 +43,7 @@ module Gemsmith
|
|
45
43
|
|
46
44
|
# :reek:TooManyStatements
|
47
45
|
def run
|
48
|
-
return unless
|
46
|
+
return unless runnable?
|
49
47
|
|
50
48
|
install_rails
|
51
49
|
create_engine
|
@@ -56,6 +54,10 @@ module Gemsmith
|
|
56
54
|
|
57
55
|
private
|
58
56
|
|
57
|
+
def runnable?
|
58
|
+
configuration.dig(:generate, :engine) || configuration.dig(:generate, :rails)
|
59
|
+
end
|
60
|
+
|
59
61
|
def engine_options
|
60
62
|
"--skip-git " \
|
61
63
|
"--skip-bundle " \
|
@@ -23,14 +23,14 @@ module Gemsmith
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def install_templates
|
26
|
-
|
26
|
+
template "#{rspec_root}/spec_helper.rb.tt"
|
27
27
|
install_rails_helper
|
28
|
-
|
28
|
+
template "#{rspec_root}/support/shared_contexts/temp_dir.rb.tt"
|
29
29
|
end
|
30
30
|
|
31
31
|
def install_rails_helper
|
32
|
-
return unless configuration.dig(:generate, :rails)
|
33
|
-
|
32
|
+
return unless configuration.dig(:generate, :engine) || configuration.dig(:generate, :rails)
|
33
|
+
template "#{rspec_root}/rails_helper.rb.tt"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -9,7 +9,7 @@ module Gemsmith
|
|
9
9
|
|
10
10
|
cli.uncomment_lines "#{gem_name}/Rakefile", /require.+rubocop.+/
|
11
11
|
cli.uncomment_lines "#{gem_name}/Rakefile", /RuboCop.+/
|
12
|
-
|
12
|
+
template "%gem_name%/.rubocop.yml.tt"
|
13
13
|
cli.run "bundle exec rubocop --auto-correct #{gem_name} > /dev/null"
|
14
14
|
end
|
15
15
|
end
|
data/lib/gemsmith/identity.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$LOAD_PATH.append File.expand_path("
|
1
|
+
$LOAD_PATH.append File.expand_path("lib", __dir__)
|
2
2
|
require "<%= config.dig(:gem, :path) %>/identity"
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
<%- end -%>
|
18
18
|
|
19
19
|
spec.required_ruby_version = "~> <%= config.dig(:versions, :ruby)[/\d+\.\d+/] %>"
|
20
|
-
<%- if config.dig(:generate, :rails) -%>
|
20
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
21
21
|
spec.add_dependency "rails", "~> <%= config.dig(:versions, :rails) %>"
|
22
22
|
<%- end -%>
|
23
23
|
<%- if config.dig(:generate, :cli) -%>
|
@@ -43,16 +43,16 @@ Gem::Specification.new do |spec|
|
|
43
43
|
<%- end -%>
|
44
44
|
spec.add_development_dependency "rake", "~> 12.3"
|
45
45
|
<%- if config.dig(:generate, :reek) -%>
|
46
|
-
spec.add_development_dependency "reek", "~> 4.
|
46
|
+
spec.add_development_dependency "reek", "~> 4.8"
|
47
47
|
<%- end -%>
|
48
48
|
<%- if config.dig(:generate, :rspec) -%>
|
49
|
-
spec.add_development_dependency "<%= config.dig(:generate, :rails) ? "rspec-rails" : "rspec" %>", "~> 3.7"
|
49
|
+
spec.add_development_dependency "<%= config.dig(:generate, :engine) || config.dig(:generate, :rails) ? "rspec-rails" : "rspec" %>", "~> 3.7"
|
50
50
|
<%- end -%>
|
51
51
|
<%- if config.dig(:generate, :rubocop) -%>
|
52
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
52
|
+
spec.add_development_dependency "rubocop", "~> 0.53"
|
53
53
|
<%- end -%>
|
54
54
|
|
55
|
-
<%- if config.dig(:generate, :rails) -%>
|
55
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
56
56
|
spec.files = Dir["app/**/*", "bin/**/*", "config/**/*", "lib/**/*", "vendor/**/*"]
|
57
57
|
<%- else -%>
|
58
58
|
spec.files = Dir["lib/**/*"]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
inherit_from:
|
2
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.
|
3
|
-
<%- if config.dig(:generate, :rails) -%>
|
4
|
-
- https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.
|
2
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.1.0/configurations/rubocop/ruby.yml
|
3
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
4
|
+
- https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.1.0/configurations/rubocop/rails.yml
|
5
5
|
<%- end -%>
|
@@ -2,7 +2,7 @@ guard :rspec, cmd: "bundle exec rspec --format documentation" do
|
|
2
2
|
watch(%r(^spec/.+_spec\.rb$))
|
3
3
|
watch(%r(^lib/(.+)\.rb$)) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
4
4
|
watch("spec/spec_helper.rb") { "spec" }
|
5
|
-
<%- if config.dig(:generate, :rails) -%>
|
5
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
6
6
|
|
7
7
|
# Rails
|
8
8
|
watch(%r(^app/(.+)\.rb$)) { |m| "spec/#{m[1]}_spec.rb" }
|
@@ -20,8 +20,8 @@
|
|
20
20
|
## Requirements
|
21
21
|
|
22
22
|
0. [Ruby <%= config.dig(:versions, :ruby) %>](https://www.ruby-lang.org)
|
23
|
-
<%- if config.dig(:generate, :rails) -%>
|
24
|
-
0. [Ruby on Rails](http://rubyonrails.org)
|
23
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
24
|
+
0. [Ruby on Rails](http://rubyonrails.org)
|
25
25
|
<%- end -%>
|
26
26
|
|
27
27
|
## Setup
|
@@ -2,6 +2,6 @@ require "<%= config.dig(:gem, :path) %>/identity"
|
|
2
2
|
<%- if config.dig(:generate, :cli) -%>
|
3
3
|
require "<%= config.dig(:gem, :path) %>/cli"
|
4
4
|
<%- end -%>
|
5
|
-
<%- if config.dig(:generate, :rails) -%>
|
5
|
+
<%- if config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
|
6
6
|
require "<%= config.dig(:gem, :path) %>/engine"
|
7
7
|
<%- 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: 11.
|
4
|
+
version: 11.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
4Zrsxi713z6sndd9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
|
30
30
|
b4jw5t40FKyNUvLPPXYAvQALBtk=
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2018-03-
|
32
|
+
date: 2018-03-10 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.53'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.53'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: runcom
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -317,14 +317,14 @@ dependencies:
|
|
317
317
|
requirements:
|
318
318
|
- - "~>"
|
319
319
|
- !ruby/object:Gem::Version
|
320
|
-
version: '4.
|
320
|
+
version: '4.8'
|
321
321
|
type: :development
|
322
322
|
prerelease: false
|
323
323
|
version_requirements: !ruby/object:Gem::Requirement
|
324
324
|
requirements:
|
325
325
|
- - "~>"
|
326
326
|
- !ruby/object:Gem::Version
|
327
|
-
version: '4.
|
327
|
+
version: '4.8'
|
328
328
|
- !ruby/object:Gem::Dependency
|
329
329
|
name: rspec
|
330
330
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|