gemsmith 8.2.0 → 9.0.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
  SHA1:
3
- metadata.gz: 789e4603ef1a279accc50fae9d0b07f92c75e454
4
- data.tar.gz: acd7977976268ac612fca91693113bc2364acb7b
3
+ metadata.gz: b08284244aeaddea3f3d3b8b96080bc3e836b950
4
+ data.tar.gz: 1c5ffe0e06e10034acee7795a8bf8586325c783d
5
5
  SHA512:
6
- metadata.gz: 8790821afac91ddb715151e18f3a8f94f8b20c11fce89e53fda64bbcdd893b0b688757d1e3ce2bf584aa78b2fefdb3b0551b26a976386188c857e3b47fe31149
7
- data.tar.gz: 3aa6b05408afe61b0cfd61db64e15022a28babdaa511e704d8540b8712ad387aa99b1b891f8af5882ae81cc7496e26b46141c1215dd0b2eed1d4c020c0f5cc7f
6
+ metadata.gz: ba6952350cd01cbbf932a83ab3afefb4221a9540b8807109b12fc995c13e22763bf4d59532bbd8047463962f1c492a1627d628a0f02776fca5327eeb4eec2316
7
+ data.tar.gz: c7b95301f395bc829f2949aea66f9226a40012a30ded74e47b749328717ae3e24218a099f3304c4b516deed99cd00ef77ca6f8a0f4864f57911d96150c5ba486
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -79,7 +79,7 @@ A command line interface for smithing new Ruby gems.
79
79
  # Requirements
80
80
 
81
81
  0. A UNIX-based system.
82
- 0. [Ruby 2.3.x](https://www.ruby-lang.org).
82
+ 0. [Ruby 2.4.x](https://www.ruby-lang.org).
83
83
  0. [RubyGems](https://rubygems.org).
84
84
  0. [Bundler](https://github.com/bundler/bundler).
85
85
 
data/lib/gemsmith/cli.rb CHANGED
@@ -162,14 +162,14 @@ module Gemsmith
162
162
  type: :boolean,
163
163
  default: configuration.to_h.dig(:generate, :patreon)
164
164
  def generate name
165
- say
165
+ print_cli_and_rails_engine_option_error && return if options.cli? && options.rails?
166
+
166
167
  info "Generating gem..."
167
168
 
168
169
  setup_configuration name: name, options: options.to_h
169
170
  self.class.generators.each { |generator| generator.run self, configuration: configuration }
170
171
 
171
172
  info "Gem generation finished."
172
- say
173
173
  end
174
174
 
175
175
  desc "-o, [--open=GEM]", "Open a gem in default editor."
@@ -232,5 +232,10 @@ module Gemsmith
232
232
  generate: options.symbolize_keys
233
233
  )
234
234
  end
235
+
236
+ def print_cli_and_rails_engine_option_error
237
+ error "Generating a gem with CLI and Rails Engine functionality is not allowed. " \
238
+ "Build separate gems for improved separation of concerns and design."
239
+ end
235
240
  end
236
241
  end
@@ -24,7 +24,9 @@ module Gemsmith
24
24
  [Authenticators::RubyGems, Authenticators::Basic]
25
25
  end
26
26
 
27
- def initialize key: self.class.default_key, url: self.class.default_url, shell: Bundler::UI::Shell.new
27
+ def initialize key: self.class.default_key,
28
+ url: self.class.default_url,
29
+ shell: Bundler::UI::Shell.new
28
30
  @key = key
29
31
  @url = url
30
32
  @shell = shell
@@ -4,7 +4,8 @@ require "versionaire"
4
4
 
5
5
  module Gemsmith
6
6
  module Gem
7
- # Defines a gem requirement. This is a partial, cleaner implementation of the RubyGems `Gem::Requirement` object.
7
+ # Defines a gem requirement. This is a partial, cleaner implementation of the RubyGems
8
+ # `Gem::Requirement` object.
8
9
  class Requirement
9
10
  def self.operators
10
11
  [">", ">=", "=", "!=", "<", "<=", "~>"]
@@ -20,7 +21,8 @@ module Gemsmith
20
21
  operator, version = object.split " "
21
22
  new operator: operator, raw_version: version
22
23
  else
23
- fail Errors::RequirementConversion, %(Invalid string conversion. Use: "<operator> <version>".)
24
+ fail Errors::RequirementConversion,
25
+ %(Invalid string conversion. Use: "<operator> <version>".)
24
26
  end
25
27
  end
26
28
 
@@ -42,7 +44,9 @@ module Gemsmith
42
44
 
43
45
  def validate!
44
46
  return true if self.class.operators.include?(operator)
45
- fail Errors::RequirementOperator, %(Invalid gem requirement operator. Use: #{self.class.operators.join ", "}.)
47
+
48
+ fail Errors::RequirementOperator,
49
+ %(Invalid gem requirement operator. Use: #{self.class.operators.join ", "}.)
46
50
  end
47
51
  end
48
52
  end
@@ -32,6 +32,10 @@ module Gemsmith
32
32
  def gem_name
33
33
  configuration.dig :gem, :name
34
34
  end
35
+
36
+ def gem_path
37
+ configuration.dig :gem, :path
38
+ end
35
39
  end
36
40
  end
37
41
  end
@@ -10,7 +10,7 @@ module Gemsmith
10
10
 
11
11
  def install_rails
12
12
  return if rails?
13
- return unless cli.yes?("Ruby on Rails is not installed. Would you like to install it (y/n)?")
13
+ return unless cli.yes?("Ruby on Rails is not installed. Would you like it installed (y/n)?")
14
14
  cli.run "gem install rails"
15
15
  end
16
16
 
@@ -32,23 +32,12 @@ module Gemsmith
32
32
  cli.template "%gem_name%/gemfiles/rails-%rails_version%.x.gemfile.tt", configuration
33
33
  end
34
34
 
35
- def add_comments
36
- file = "%gem_name%/app/controllers/%gem_path%/application_controller.rb"
37
- comment = "#{indentation}# The application controller.\n"
38
- cli.insert_into_file file, comment, before: /.+class.+/
39
-
40
- file = "%gem_name%/app/mailers/%gem_path%/application_mailer.rb"
41
- comment = "#{indentation}# The application mailer.\n"
42
- cli.insert_into_file file, comment, before: /.+class.+/
43
-
44
- file = "%gem_name%/app/models/%gem_path%/application_record.rb"
45
- comment = "#{indentation}# The application record.\n"
46
- cli.insert_into_file file, comment, before: /.+class.+/
35
+ def stub_assets
36
+ cli.run %(printf "%s" > "#{gem_name}/app/assets/javascripts/#{gem_path}/application.js")
37
+ cli.run %(printf "%s" > "#{gem_name}/app/assets/stylesheets/#{gem_path}/application.css")
47
38
  end
48
39
 
49
40
  def remove_files
50
- gem_path = configuration.dig :gem, :path
51
-
52
41
  cli.remove_file "#{gem_name}/app/helpers/#{gem_path}/application_helper.rb", configuration
53
42
  cli.remove_file "#{gem_name}/lib/#{gem_path}/version.rb", configuration
54
43
  cli.remove_file "#{gem_name}/MIT-LICENSE", configuration
@@ -62,7 +51,7 @@ module Gemsmith
62
51
  create_engine
63
52
  create_generator_files
64
53
  create_travis_gemfiles
65
- add_comments
54
+ stub_assets
66
55
  remove_files
67
56
  end
68
57
 
@@ -33,7 +33,8 @@ module Gemsmith
33
33
 
34
34
  def configure_rakefile
35
35
  return if default_tasks.empty?
36
- cli.append_to_file "%gem_name%/Rakefile", %(\ntask default: %w[#{default_tasks.join(" ")}]\n)
36
+ cli.append_to_file "%gem_name%/Rakefile",
37
+ %(\ntask default: %w[#{default_tasks.join(" ")}]\n)
37
38
  end
38
39
  end
39
40
  end
@@ -24,7 +24,11 @@ module Gemsmith
24
24
 
25
25
  def install_templates
26
26
  cli.template "#{rspec_root}/spec_helper.rb.tt", configuration
27
- cli.template("#{rspec_root}/rails_helper.rb.tt", configuration) if configuration.dig(:generate, :rails)
27
+
28
+ if configuration.dig(:generate, :rails)
29
+ cli.template("#{rspec_root}/rails_helper.rb.tt", configuration)
30
+ end
31
+
28
32
  cli.template "#{rspec_root}/support/shared_contexts/temp_dir.rb.tt", configuration
29
33
  end
30
34
  end
@@ -10,7 +10,7 @@ module Gemsmith
10
10
  cli.uncomment_lines "#{gem_name}/Rakefile", /require.+rubocop.+/
11
11
  cli.uncomment_lines "#{gem_name}/Rakefile", /RuboCop.+/
12
12
  cli.template "%gem_name%/.rubocop.yml.tt", configuration
13
- cli.run "rubocop --auto-correct > /dev/null"
13
+ cli.run "rubocop --auto-correct #{gem_name} > /dev/null"
14
14
  end
15
15
  end
16
16
  end
@@ -8,7 +8,11 @@ module Gemsmith
8
8
 
9
9
  def print_gems gems
10
10
  say "Multiple versions found:\n\n"
11
- gems.each.with_index { |spec, index| say "#{index + 1}. #{spec.name} #{spec.version.version}" }
11
+
12
+ gems.each.with_index do |spec, index|
13
+ say "#{index + 1}. #{spec.name} #{spec.version.version}"
14
+ end
15
+
12
16
  say "q. Quit.\n\n"
13
17
  end
14
18
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Gemsmith
4
4
  module Helpers
5
- # Provides helper methods for use by the Thor CLI. These methods are necessary to resolve %% file
6
- # and folder variables and render dynamic content within the Thor ERB *templates* structure.
5
+ # Provides Thor CLI helper methods. These methods are necessary to resolve %% file and folder
6
+ # variables and render dynamic content within the Thor ERB *templates* structure.
7
7
  module Template
8
8
  def gem_name
9
9
  configuration.dig :gem, :name
@@ -12,7 +12,7 @@ module Gemsmith
12
12
  end
13
13
 
14
14
  def self.version
15
- "8.2.0"
15
+ "9.0.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -31,7 +31,8 @@ module Gemsmith
31
31
  end
32
32
 
33
33
  def push
34
- creds = credentials.new key: gem_spec.allowed_push_key.to_sym, url: gem_spec.allowed_push_host
34
+ creds = credentials.new key: gem_spec.allowed_push_key.to_sym,
35
+ url: gem_spec.allowed_push_host
35
36
  creds.create
36
37
 
37
38
  options = %(--key "#{translate_key creds.key}" --host "#{gem_spec.allowed_push_host}")
@@ -62,7 +63,8 @@ module Gemsmith
62
63
  if status
63
64
  shell.confirm "Pushed #{gem_spec.package_file_name} to #{gem_spec.allowed_push_host}."
64
65
  else
65
- shell.error "Failed pushing #{gem_spec.package_file_name} to #{gem_spec.allowed_push_host}. " \
66
+ shell.error "Failed pushing #{gem_spec.package_file_name} to " \
67
+ "#{gem_spec.allowed_push_host}. " \
66
68
  "Check gemspec and gem credential settings."
67
69
  end
68
70
 
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  end
19
19
  <%- end -%>
20
20
 
21
+ spec.required_ruby_version = "~> <%= config.dig(:versions, :ruby)[/\d{1}\.\d{1}/] %>"
21
22
  <%- if config.dig(:generate, :cli) -%>
22
23
  spec.add_dependency "thor", "~> 0.19"
23
24
  spec.add_dependency "thor_plus", "~> 4.1"
@@ -43,7 +44,7 @@ Gem::Specification.new do |spec|
43
44
  spec.add_development_dependency "reek", "~> 4.5"
44
45
  <%- end -%>
45
46
  <%- if config.dig(:generate, :rubocop) -%>
46
- spec.add_development_dependency "rubocop", "~> 0.46"
47
+ spec.add_development_dependency "rubocop", "~> 0.47"
47
48
  <%- end -%>
48
49
  <%- if config.dig(:generate, :scss_lint) -%>
49
50
  spec.add_development_dependency "scss_lint", "~> 0.50"
@@ -52,7 +53,11 @@ Gem::Specification.new do |spec|
52
53
  spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0"
53
54
  <%- end -%>
54
55
 
56
+ <%- if config.dig(:generate, :rails) -%>
57
+ spec.files = Dir["app/**/*", "bin/**/*", "config/**/*", "lib/**/*", "vendor/**/*"]
58
+ <%- else -%>
55
59
  spec.files = Dir["lib/**/*"]
60
+ <%- end -%>
56
61
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
57
62
  <%- if config.dig(:generate, :cli) -%>
58
63
  spec.executables << "<%= config.dig(:gem, :name) %>"
@@ -11,6 +11,8 @@ Style/AndOr:
11
11
  EnforcedStyle: conditionals
12
12
  Style/CaseIndentation:
13
13
  IndentOneStep: true
14
+ Style/Documentation:
15
+ Enabled: false
14
16
  Style/EmptyMethod:
15
17
  EnforcedStyle: expanded
16
18
  Style/MethodDefParentheses:
@@ -43,4 +45,6 @@ Metrics/BlockLength:
43
45
  - "**/*.gemspec"
44
46
  - "spec/**/*"
45
47
  Metrics/LineLength:
46
- Max: 120
48
+ Max: 100
49
+ Metrics/ParameterLists:
50
+ Max: 3
@@ -3,6 +3,7 @@ language: ruby
3
3
  gemfile:
4
4
  - gemfiles/rails-<%= config.dig(:versions, :rails) %>.x.gemfile
5
5
  <%- end -%>
6
+ before_install: gem update --system && gem update && gem cleanup
6
7
  <%- if config.dig(:generate, :code_climate) -%>
7
8
  after_script: bundle exec codeclimate-test-reporter
8
9
  <%- end -%>
@@ -11,7 +11,9 @@ require "pry-state"
11
11
  <%- end -%>
12
12
  <%- unless config.dig(:generate, :rails) -%>require "<%= config.dig(:gem, :path) %>"<%- end -%>
13
13
 
14
- Dir[File.join(File.dirname(__FILE__), "support/shared_contexts/**/*.rb")].each { |file| require file }
14
+ Dir[File.join(File.dirname(__FILE__), "support/shared_contexts/**/*.rb")].each do |file|
15
+ require file
16
+ end
15
17
 
16
18
  RSpec.configure do |config|
17
19
  config.order = "random"
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: 8.2.0
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -30,8 +30,22 @@ cert_chain:
30
30
  n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
31
31
  3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
32
32
  -----END CERTIFICATE-----
33
- date: 2016-12-18 00:00:00.000000000 Z
33
+ date: 2017-01-22 00:00:00.000000000 Z
34
34
  dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: bundler
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.14'
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.14'
35
49
  - !ruby/object:Gem::Dependency
36
50
  name: thor
37
51
  requirement: !ruby/object:Gem::Requirement
@@ -52,98 +66,98 @@ dependencies:
52
66
  requirements:
53
67
  - - "~>"
54
68
  - !ruby/object:Gem::Version
55
- version: '4.1'
69
+ version: '5.0'
56
70
  type: :runtime
57
71
  prerelease: false
58
72
  version_requirements: !ruby/object:Gem::Requirement
59
73
  requirements:
60
74
  - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '4.1'
76
+ version: '5.0'
63
77
  - !ruby/object:Gem::Dependency
64
78
  name: refinements
65
79
  requirement: !ruby/object:Gem::Requirement
66
80
  requirements:
67
81
  - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: '3.1'
83
+ version: '4.0'
70
84
  type: :runtime
71
85
  prerelease: false
72
86
  version_requirements: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: '3.1'
90
+ version: '4.0'
77
91
  - !ruby/object:Gem::Dependency
78
92
  name: versionaire
79
93
  requirement: !ruby/object:Gem::Requirement
80
94
  requirements:
81
95
  - - "~>"
82
96
  - !ruby/object:Gem::Version
83
- version: '2.1'
97
+ version: '3.0'
84
98
  type: :runtime
85
99
  prerelease: false
86
100
  version_requirements: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: '2.1'
104
+ version: '3.0'
91
105
  - !ruby/object:Gem::Dependency
92
106
  name: runcom
93
107
  requirement: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: '0.3'
111
+ version: '0.5'
98
112
  type: :runtime
99
113
  prerelease: false
100
114
  version_requirements: !ruby/object:Gem::Requirement
101
115
  requirements:
102
116
  - - "~>"
103
117
  - !ruby/object:Gem::Version
104
- version: '0.3'
118
+ version: '0.5'
105
119
  - !ruby/object:Gem::Dependency
106
120
  name: milestoner
107
121
  requirement: !ruby/object:Gem::Requirement
108
122
  requirements:
109
123
  - - "~>"
110
124
  - !ruby/object:Gem::Version
111
- version: '4.1'
125
+ version: '5.0'
112
126
  type: :runtime
113
127
  prerelease: false
114
128
  version_requirements: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - "~>"
117
131
  - !ruby/object:Gem::Version
118
- version: '4.1'
132
+ version: '5.0'
119
133
  - !ruby/object:Gem::Dependency
120
134
  name: pragmater
121
135
  requirement: !ruby/object:Gem::Requirement
122
136
  requirements:
123
137
  - - "~>"
124
138
  - !ruby/object:Gem::Version
125
- version: '2.1'
139
+ version: '3.0'
126
140
  type: :runtime
127
141
  prerelease: false
128
142
  version_requirements: !ruby/object:Gem::Requirement
129
143
  requirements:
130
144
  - - "~>"
131
145
  - !ruby/object:Gem::Version
132
- version: '2.1'
146
+ version: '3.0'
133
147
  - !ruby/object:Gem::Dependency
134
148
  name: tocer
135
149
  requirement: !ruby/object:Gem::Requirement
136
150
  requirements:
137
151
  - - "~>"
138
152
  - !ruby/object:Gem::Version
139
- version: '3.1'
153
+ version: '4.0'
140
154
  type: :runtime
141
155
  prerelease: false
142
156
  version_requirements: !ruby/object:Gem::Requirement
143
157
  requirements:
144
158
  - - "~>"
145
159
  - !ruby/object:Gem::Version
146
- version: '3.1'
160
+ version: '4.0'
147
161
  - !ruby/object:Gem::Dependency
148
162
  name: rake
149
163
  requirement: !ruby/object:Gem::Requirement
@@ -318,14 +332,14 @@ dependencies:
318
332
  requirements:
319
333
  - - "~>"
320
334
  - !ruby/object:Gem::Version
321
- version: '0.46'
335
+ version: '0.47'
322
336
  type: :development
323
337
  prerelease: false
324
338
  version_requirements: !ruby/object:Gem::Requirement
325
339
  requirements:
326
340
  - - "~>"
327
341
  - !ruby/object:Gem::Version
328
- version: '0.46'
342
+ version: '0.47'
329
343
  - !ruby/object:Gem::Dependency
330
344
  name: codeclimate-test-reporter
331
345
  requirement: !ruby/object:Gem::Requirement
@@ -435,7 +449,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
435
449
  requirements:
436
450
  - - "~>"
437
451
  - !ruby/object:Gem::Version
438
- version: '2.3'
452
+ version: '2.4'
439
453
  required_rubygems_version: !ruby/object:Gem::Requirement
440
454
  requirements:
441
455
  - - ">="
@@ -443,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
443
457
  version: '0'
444
458
  requirements: []
445
459
  rubyforge_project:
446
- rubygems_version: 2.6.8
460
+ rubygems_version: 2.6.9
447
461
  signing_key:
448
462
  specification_version: 4
449
463
  summary: A command line interface for smithing new Ruby gems.
metadata.gz.sig CHANGED
Binary file