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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb78c42cc900eee4942327ad45879410de65014c8c50237244f57359d3dec392
4
- data.tar.gz: 3f10400690bf4f524253daa9a370213e784691898550e8c1c6b4e50a583b1091
3
+ metadata.gz: 239c568371d501376dcff5619e20b4cd8946690316580a534b9eb4e7f7207f83
4
+ data.tar.gz: 04f1a037a219e2e95f2d04167488f2e8bbba179ec5f762cd857d99bca136ff7b
5
5
  SHA512:
6
- metadata.gz: bb6f2a7df992c20ba3534f0baa868ae2f7bca4aae9ca8ebe30b0267ff9c6438d64c09825b0824eaf0552970b051f77f78e48dcfdb13b4b19256c4471d37ca32d
7
- data.tar.gz: a8cef2c6beb8724976e6f670c428c8f42a95c46974d364f7fea88c382f89bba7038173d5f2823a19bf4a2fadacd2b91feceb2dee0779cbbe01768f2674e2acc6
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
- print_cli_and_rails_engine_option_error && return if options.cli? && options.rails?
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
 
@@ -39,6 +39,10 @@ module Gemsmith
39
39
  def gem_root
40
40
  File.join cli.destination_root, gem_name
41
41
  end
42
+
43
+ def template path
44
+ cli.template path, configuration
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -6,7 +6,7 @@ module Gemsmith
6
6
  class CircleCI < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :circle_ci)
9
- cli.template "%gem_name%/circle.yml.tt", configuration
9
+ template "%gem_name%/circle.yml.tt"
10
10
  end
11
11
  end
12
12
  end
@@ -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
- cli.template "%gem_name%/bin/%gem_name%.tt", configuration
12
- cli.template "%gem_name%/lib/%gem_path%/cli.rb.tt", configuration
13
- cli.template "%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt", configuration
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
@@ -6,8 +6,7 @@ module Gemsmith
6
6
  class CodeClimate < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :code_climate)
9
-
10
- cli.template "%gem_name%/.codeclimate.yml.tt", configuration
9
+ template "%gem_name%/.codeclimate.yml.tt"
11
10
  end
12
11
  end
13
12
  end
@@ -7,11 +7,11 @@ module Gemsmith
7
7
  # Generates documentation support.
8
8
  class Documentation < Base
9
9
  def create_files
10
- cli.template "%gem_name%/README.md.tt", configuration
11
- cli.template "%gem_name%/CONTRIBUTING.md.tt", configuration
12
- cli.template "%gem_name%/CODE_OF_CONDUCT.md.tt", configuration
13
- cli.template "%gem_name%/LICENSE.md.tt", configuration
14
- cli.template "%gem_name%/CHANGES.md.tt", configuration
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
- cli.template "%gem_name%/bin/setup.tt", configuration
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
- # rubocop:enable Metrics/AbcSize
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
@@ -5,7 +5,7 @@ module Gemsmith
5
5
  # Generates Git support.
6
6
  class Git < Base
7
7
  def create_ignore_file
8
- cli.template "%gem_name%/.gitignore.tt", configuration
8
+ template "%gem_name%/.gitignore.tt"
9
9
  end
10
10
 
11
11
  # :reek:TooManyStatements
@@ -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
- cli.template "%gem_name%/.github/ISSUE_TEMPLATE.md.tt", configuration
10
- cli.template "%gem_name%/.github/PULL_REQUEST_TEMPLATE.md.tt", configuration
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
@@ -6,7 +6,7 @@ module Gemsmith
6
6
  class Guard < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :guard)
9
- cli.template "%gem_name%/Guardfile.tt", configuration
9
+ template "%gem_name%/Guardfile.tt"
10
10
  end
11
11
  end
12
12
  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
- cli.template "#{LIB_ROOT}/%gem_path%/engine.rb.tt", configuration
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
- cli.template "#{generator_root}/install/install_generator.rb.tt", configuration
26
- cli.template "#{generator_root}/install/USAGE.tt", configuration
27
- cli.template "#{generator_root}/upgrade/upgrade_generator.rb.tt", configuration
28
- cli.template "#{generator_root}/upgrade/USAGE.tt", configuration
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 configuration.dig(:generate, :rails)
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 " \
@@ -19,7 +19,7 @@ module Gemsmith
19
19
  end
20
20
 
21
21
  def run
22
- cli.template "%gem_name%/Rakefile.tt", configuration
22
+ template "%gem_name%/Rakefile.tt"
23
23
  append_code_quality_task
24
24
  append_default_task
25
25
  end
@@ -9,7 +9,7 @@ module Gemsmith
9
9
 
10
10
  cli.uncomment_lines "#{gem_name}/Rakefile", /require.+reek.+/
11
11
  cli.uncomment_lines "#{gem_name}/Rakefile", /Reek.+/
12
- cli.template "%gem_name%/.reek.tt", configuration
12
+ template "%gem_name%/.reek.tt"
13
13
  end
14
14
  end
15
15
  end
@@ -23,14 +23,14 @@ module Gemsmith
23
23
  end
24
24
 
25
25
  def install_templates
26
- cli.template "#{rspec_root}/spec_helper.rb.tt", configuration
26
+ template "#{rspec_root}/spec_helper.rb.tt"
27
27
  install_rails_helper
28
- cli.template "#{rspec_root}/support/shared_contexts/temp_dir.rb.tt", configuration
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
- cli.template("#{rspec_root}/rails_helper.rb.tt", configuration)
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
- cli.template "%gem_name%/.rubocop.yml.tt", configuration
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
@@ -5,7 +5,7 @@ module Gemsmith
5
5
  # Generates Ruby support.
6
6
  class Ruby < Base
7
7
  def run
8
- cli.template "%gem_name%/.ruby-version.tt", configuration
8
+ template "%gem_name%/.ruby-version.tt"
9
9
  end
10
10
  end
11
11
  end
@@ -12,7 +12,7 @@ module Gemsmith
12
12
  end
13
13
 
14
14
  def self.version
15
- "11.2.0"
15
+ "11.3.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.append File.expand_path("../lib", __FILE__)
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.7"
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"
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.0.0/configurations/rubocop/ruby.yml
3
- <%- if config.dig(:generate, :rails) -%>
4
- - https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.0.0/configurations/rubocop/rails.yml
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 -%>
@@ -8,7 +8,7 @@ SimpleCov.start
8
8
  require "pry"
9
9
  require "pry-byebug"
10
10
  <%- end -%>
11
- <%- unless config.dig(:generate, :rails) -%>
11
+ <%- unless config.dig(:generate, :engine) || config.dig(:generate, :rails) -%>
12
12
  require "<%= config.dig(:gem, :path) %>"
13
13
  <%- end -%>
14
14
 
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.2.0
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-04 00:00:00.000000000 Z
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.52'
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.52'
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.7'
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.7'
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