gemsmith 8.0.0 → 8.1.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/lib/gemsmith.rb +34 -0
- data/lib/gemsmith/cli.rb +8 -40
- data/lib/gemsmith/credentials.rb +0 -2
- data/lib/gemsmith/helpers/cli.rb +51 -0
- data/lib/gemsmith/helpers/template.rb +30 -0
- data/lib/gemsmith/identity.rb +1 -1
- data/lib/gemsmith/rake/publisher.rb +3 -2
- data/lib/gemsmith/rake/tasks.rb +1 -0
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +2 -2
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%.rb.tt +3 -0
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/cli.rb.tt +2 -3
- data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt +0 -1
- metadata +18 -18
- metadata.gz.sig +0 -0
- data/lib/gemsmith/cli_helpers.rb +0 -46
- data/lib/gemsmith/template_helper.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a96c9154c4fb90efc956a37d51aec117517651
|
4
|
+
data.tar.gz: 0205e0b2cf6c1e918b3bbd2af0604b57731064d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1662d27ce0745b77682b287b9648de230f5262bb3771608667d38be3eecbad38f38530a7012d823353afc7ea826f88dec28bb2122a995de86d2245f9be772560
|
7
|
+
data.tar.gz: e1d2fab655c0e0103b78f21f130de0a8144df440142a14cea914471188766f9769831a2b6dabc6dcf3b56b868beacd176d190158799efad2aa96d41bec8ac6bc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/gemsmith.rb
CHANGED
@@ -1,3 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "gemsmith/identity"
|
4
|
+
require "gemsmith/git"
|
5
|
+
require "gemsmith/credentials"
|
6
|
+
require "gemsmith/authenticators/basic"
|
7
|
+
require "gemsmith/authenticators/ruby_gems"
|
8
|
+
require "gemsmith/errors/base"
|
9
|
+
require "gemsmith/errors/requirement_conversion"
|
10
|
+
require "gemsmith/errors/requirement_operator"
|
11
|
+
require "gemsmith/errors/specification"
|
12
|
+
require "gemsmith/gem/inspector"
|
13
|
+
require "gemsmith/gem/module_formatter"
|
14
|
+
require "gemsmith/gem/requirement"
|
15
|
+
require "gemsmith/gem/specification"
|
16
|
+
require "gemsmith/generators/base"
|
17
|
+
require "gemsmith/generators/bundler"
|
18
|
+
require "gemsmith/generators/cli"
|
19
|
+
require "gemsmith/generators/code_climate"
|
20
|
+
require "gemsmith/generators/documentation"
|
21
|
+
require "gemsmith/generators/gem"
|
22
|
+
require "gemsmith/generators/git"
|
23
|
+
require "gemsmith/generators/git_hub"
|
24
|
+
require "gemsmith/generators/guard"
|
25
|
+
require "gemsmith/generators/pragma"
|
26
|
+
require "gemsmith/generators/rails"
|
27
|
+
require "gemsmith/generators/rake"
|
28
|
+
require "gemsmith/generators/reek"
|
29
|
+
require "gemsmith/generators/rspec"
|
30
|
+
require "gemsmith/generators/rubocop"
|
31
|
+
require "gemsmith/generators/ruby"
|
32
|
+
require "gemsmith/generators/scss_lint"
|
33
|
+
require "gemsmith/generators/travis"
|
34
|
+
require "gemsmith/rake/builder"
|
35
|
+
require "gemsmith/rake/publisher"
|
36
|
+
require "gemsmith/rake/tasks"
|
37
|
+
require "gemsmith/cli"
|
data/lib/gemsmith/cli.rb
CHANGED
@@ -1,41 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "yaml"
|
4
3
|
require "thor"
|
5
4
|
require "thor/actions"
|
6
5
|
require "thor_plus/actions"
|
7
6
|
require "refinements/strings"
|
8
7
|
require "refinements/hashes"
|
9
8
|
require "runcom"
|
10
|
-
require "gemsmith/
|
11
|
-
require "gemsmith/
|
12
|
-
require "gemsmith/errors/requirement_operator"
|
13
|
-
require "gemsmith/errors/specification"
|
14
|
-
require "gemsmith/gem/inspector"
|
15
|
-
require "gemsmith/gem/module_formatter"
|
16
|
-
require "gemsmith/gem/requirement"
|
17
|
-
require "gemsmith/gem/specification"
|
18
|
-
require "gemsmith/generators/base"
|
19
|
-
require "gemsmith/generators/bundler"
|
20
|
-
require "gemsmith/generators/cli"
|
21
|
-
require "gemsmith/generators/code_climate"
|
22
|
-
require "gemsmith/generators/documentation"
|
23
|
-
require "gemsmith/generators/gem"
|
24
|
-
require "gemsmith/generators/git"
|
25
|
-
require "gemsmith/generators/git_hub"
|
26
|
-
require "gemsmith/generators/guard"
|
27
|
-
require "gemsmith/generators/pragma"
|
28
|
-
require "gemsmith/generators/rails"
|
29
|
-
require "gemsmith/generators/rake"
|
30
|
-
require "gemsmith/generators/reek"
|
31
|
-
require "gemsmith/generators/rspec"
|
32
|
-
require "gemsmith/generators/rubocop"
|
33
|
-
require "gemsmith/generators/ruby"
|
34
|
-
require "gemsmith/generators/scss_lint"
|
35
|
-
require "gemsmith/generators/travis"
|
36
|
-
require "gemsmith/cli_helpers"
|
37
|
-
require "gemsmith/template_helper"
|
38
|
-
require "gemsmith/git"
|
9
|
+
require "gemsmith/helpers/cli"
|
10
|
+
require "gemsmith/helpers/template"
|
39
11
|
|
40
12
|
module Gemsmith
|
41
13
|
# The Command Line Interface (CLI) for the gem.
|
@@ -43,13 +15,13 @@ module Gemsmith
|
|
43
15
|
class CLI < Thor
|
44
16
|
include Thor::Actions
|
45
17
|
include ThorPlus::Actions
|
46
|
-
include
|
47
|
-
include
|
18
|
+
include Helpers::CLI
|
19
|
+
include Helpers::Template
|
48
20
|
|
49
21
|
using Refinements::Strings
|
50
22
|
using Refinements::Hashes
|
51
23
|
|
52
|
-
package_name
|
24
|
+
package_name Identity.version_label
|
53
25
|
|
54
26
|
# Overwrites Thor's template source root.
|
55
27
|
def self.source_root
|
@@ -193,7 +165,7 @@ module Gemsmith
|
|
193
165
|
say
|
194
166
|
info "Generating gem..."
|
195
167
|
|
196
|
-
setup_configuration name: name, options: options
|
168
|
+
setup_configuration name: name, options: options.to_h
|
197
169
|
self.class.generators.each { |generator| generator.run self, configuration: configuration }
|
198
170
|
|
199
171
|
info "Gem generation finished."
|
@@ -234,7 +206,7 @@ module Gemsmith
|
|
234
206
|
desc "-v, [--version]", "Show gem version."
|
235
207
|
map %w[-v --version] => :version
|
236
208
|
def version
|
237
|
-
say
|
209
|
+
say Identity.version_label
|
238
210
|
end
|
239
211
|
|
240
212
|
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
@@ -248,10 +220,6 @@ module Gemsmith
|
|
248
220
|
attr_reader :configuration
|
249
221
|
|
250
222
|
def setup_configuration name:, options: {}
|
251
|
-
symbolized_options = options.reduce({}) do |new_options, (key, value)|
|
252
|
-
new_options.merge! key.to_sym => value
|
253
|
-
end
|
254
|
-
|
255
223
|
@configuration = self.class.configuration.to_h.merge(
|
256
224
|
gem: {
|
257
225
|
name: name,
|
@@ -261,7 +229,7 @@ module Gemsmith
|
|
261
229
|
url: Git.github_url(name),
|
262
230
|
license: "MIT"
|
263
231
|
},
|
264
|
-
generate:
|
232
|
+
generate: options.symbolize_keys
|
265
233
|
)
|
266
234
|
end
|
267
235
|
end
|
data/lib/gemsmith/credentials.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gemsmith
|
4
|
+
module Helpers
|
5
|
+
# Command Line Interface (CLI) helpers for the CLI class.
|
6
|
+
module CLI
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def print_gems gems
|
10
|
+
say "Multiple versions found:\n\n"
|
11
|
+
gems.each.with_index { |spec, index| say "#{index + 1}. #{spec.name} #{spec.version.version}" }
|
12
|
+
say "q. Quit.\n\n"
|
13
|
+
end
|
14
|
+
|
15
|
+
def pick_gem gems, name
|
16
|
+
answer = ask "Enter selection:"
|
17
|
+
return if answer == "q"
|
18
|
+
|
19
|
+
answer = answer.to_i
|
20
|
+
|
21
|
+
if (1..gems.size).cover?(answer)
|
22
|
+
Gem::Specification.find name, gems[answer - 1].version.version
|
23
|
+
else
|
24
|
+
error "Invalid option: #{answer}"
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def inspect_gem specification, method
|
30
|
+
return unless specification
|
31
|
+
Gem::Inspector.new.public_send method, Gem::Specification.new(specification.spec_file)
|
32
|
+
rescue Versionaire::Errors::Conversion => exception
|
33
|
+
error(exception.message)
|
34
|
+
end
|
35
|
+
|
36
|
+
def process_gem name, method
|
37
|
+
specs = Gem::Specification.find_all name
|
38
|
+
spec_count = specs.size
|
39
|
+
|
40
|
+
if spec_count == 1
|
41
|
+
inspect_gem specs.first, method
|
42
|
+
elsif spec_count > 1
|
43
|
+
print_gems specs
|
44
|
+
inspect_gem pick_gem(specs, name), method
|
45
|
+
else
|
46
|
+
error("Unable to find gem: #{name}.") and ""
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gemsmith
|
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.
|
7
|
+
module Template
|
8
|
+
def gem_name
|
9
|
+
configuration.dig :gem, :name
|
10
|
+
end
|
11
|
+
|
12
|
+
def gem_path
|
13
|
+
configuration.dig :gem, :path
|
14
|
+
end
|
15
|
+
|
16
|
+
def gem_class
|
17
|
+
configuration.dig :gem, :class
|
18
|
+
end
|
19
|
+
|
20
|
+
def rails_version
|
21
|
+
configuration.dig :versions, :rails
|
22
|
+
end
|
23
|
+
|
24
|
+
def render_namespace &block
|
25
|
+
body = capture(&block) if block_given?
|
26
|
+
concat Gem::ModuleFormatter.new(gem_class).render(body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/gemsmith/identity.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "milestoner"
|
4
|
+
require "gemsmith/identity"
|
4
5
|
require "gemsmith/credentials"
|
5
6
|
require "gemsmith/git"
|
6
|
-
require "gemsmith/
|
7
|
+
require "gemsmith/cli"
|
7
8
|
|
8
9
|
module Gemsmith
|
9
10
|
module Rake
|
@@ -15,7 +16,7 @@ module Gemsmith
|
|
15
16
|
|
16
17
|
# rubocop:disable Metrics/ParameterLists
|
17
18
|
def initialize gem_spec: Gemsmith::Gem::Specification.new(self.class.gem_spec_path),
|
18
|
-
gem_config:
|
19
|
+
gem_config: Gemsmith::CLI.configuration.to_h,
|
19
20
|
credentials: Gemsmith::Credentials,
|
20
21
|
publisher: Milestoner::Publisher.new,
|
21
22
|
shell: Bundler::UI::Shell.new,
|
data/lib/gemsmith/rake/tasks.rb
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
<%- if config.dig(:generate, :cli) -%>
|
22
22
|
spec.add_dependency "thor", "~> 0.19"
|
23
|
-
spec.add_dependency "thor_plus", "~> 4.
|
24
|
-
spec.add_dependency "runcom", "~> 0.
|
23
|
+
spec.add_dependency "thor_plus", "~> 4.1"
|
24
|
+
spec.add_dependency "runcom", "~> 0.3"
|
25
25
|
<%- end -%>
|
26
26
|
<%- if config.dig(:generate, :rails) -%>
|
27
27
|
spec.add_dependency "rails", "~> <%= config.dig(:versions, :rails) %>"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require "yaml"
|
2
1
|
require "thor"
|
3
2
|
require "thor/actions"
|
4
3
|
require "thor_plus/actions"
|
@@ -10,7 +9,7 @@ require "runcom"
|
|
10
9
|
include Thor::Actions
|
11
10
|
include ThorPlus::Actions
|
12
11
|
|
13
|
-
package_name
|
12
|
+
package_name Identity.version_label
|
14
13
|
|
15
14
|
def self.configuration
|
16
15
|
Runcom::Configuration.new file_name: Identity.file_name
|
@@ -42,7 +41,7 @@ require "runcom"
|
|
42
41
|
desc "-v, [--version]", "Show gem version."
|
43
42
|
map %w[-v --version] => :version
|
44
43
|
def version
|
45
|
-
say
|
44
|
+
say Identity.version_label
|
46
45
|
end
|
47
46
|
|
48
47
|
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
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.
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
|
31
31
|
3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-11-
|
33
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: thor
|
@@ -52,98 +52,98 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '4.
|
55
|
+
version: '4.1'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '4.
|
62
|
+
version: '4.1'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: refinements
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
69
|
+
version: '3.1'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
76
|
+
version: '3.1'
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: versionaire
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '2.
|
83
|
+
version: '2.1'
|
84
84
|
type: :runtime
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '2.
|
90
|
+
version: '2.1'
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: runcom
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
97
|
+
version: '0.3'
|
98
98
|
type: :runtime
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0.
|
104
|
+
version: '0.3'
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: milestoner
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '4.
|
111
|
+
version: '4.1'
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '4.
|
118
|
+
version: '4.1'
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: pragmater
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '2.
|
125
|
+
version: '2.1'
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '2.
|
132
|
+
version: '2.1'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: tocer
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '3.
|
139
|
+
version: '3.1'
|
140
140
|
type: :runtime
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: '3.
|
146
|
+
version: '3.1'
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: rake
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,7 +357,6 @@ files:
|
|
357
357
|
- lib/gemsmith/authenticators/basic.rb
|
358
358
|
- lib/gemsmith/authenticators/ruby_gems.rb
|
359
359
|
- lib/gemsmith/cli.rb
|
360
|
-
- lib/gemsmith/cli_helpers.rb
|
361
360
|
- lib/gemsmith/credentials.rb
|
362
361
|
- lib/gemsmith/errors/base.rb
|
363
362
|
- lib/gemsmith/errors/requirement_conversion.rb
|
@@ -386,12 +385,13 @@ files:
|
|
386
385
|
- lib/gemsmith/generators/scss_lint.rb
|
387
386
|
- lib/gemsmith/generators/travis.rb
|
388
387
|
- lib/gemsmith/git.rb
|
388
|
+
- lib/gemsmith/helpers/cli.rb
|
389
|
+
- lib/gemsmith/helpers/template.rb
|
389
390
|
- lib/gemsmith/identity.rb
|
390
391
|
- lib/gemsmith/rake/builder.rb
|
391
392
|
- lib/gemsmith/rake/publisher.rb
|
392
393
|
- lib/gemsmith/rake/setup.rb
|
393
394
|
- lib/gemsmith/rake/tasks.rb
|
394
|
-
- lib/gemsmith/template_helper.rb
|
395
395
|
- lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt
|
396
396
|
- lib/gemsmith/templates/%gem_name%/.codeclimate.yml.tt
|
397
397
|
- lib/gemsmith/templates/%gem_name%/.github/ISSUE_TEMPLATE.md.tt
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/gemsmith/cli_helpers.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Gemsmith
|
4
|
-
# Command Line Interface (CLI) helpers for the CLI class.
|
5
|
-
module CLIHelpers
|
6
|
-
module_function
|
7
|
-
|
8
|
-
def print_gems gems
|
9
|
-
say "Multiple versions found:\n\n"
|
10
|
-
gems.each.with_index { |spec, index| say "#{index + 1}. #{spec.name} #{spec.version.version}" }
|
11
|
-
say "q. Quit.\n\n"
|
12
|
-
end
|
13
|
-
|
14
|
-
def pick_gem gems, name
|
15
|
-
answer = ask "Enter selection:"
|
16
|
-
return if answer == "q"
|
17
|
-
|
18
|
-
if (1..gems.size).cover?(answer.to_i)
|
19
|
-
Gem::Specification.find name, gems[answer.to_i - 1].version.version
|
20
|
-
else
|
21
|
-
error "Invalid option: #{answer}"
|
22
|
-
nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def inspect_gem specification, method
|
27
|
-
return unless specification
|
28
|
-
Gem::Inspector.new.public_send method, Gem::Specification.new(specification.spec_file)
|
29
|
-
rescue Versionaire::Errors::Conversion => exception
|
30
|
-
error(exception.message)
|
31
|
-
end
|
32
|
-
|
33
|
-
def process_gem name, method
|
34
|
-
specs = Gem::Specification.find_all name
|
35
|
-
|
36
|
-
if specs.size == 1
|
37
|
-
inspect_gem specs.first, method
|
38
|
-
elsif specs.size > 1
|
39
|
-
print_gems specs
|
40
|
-
inspect_gem pick_gem(specs, name), method
|
41
|
-
else
|
42
|
-
error("Unable to find gem: #{name}.") and ""
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Gemsmith
|
4
|
-
# Provides helper methods for use by the Thor CLI. These methods are necessary to resolve %% file
|
5
|
-
# and folder variables and render dynamic content within the Thor ERB *templates* structure.
|
6
|
-
module TemplateHelper
|
7
|
-
def gem_name
|
8
|
-
configuration.dig :gem, :name
|
9
|
-
end
|
10
|
-
|
11
|
-
def gem_path
|
12
|
-
configuration.dig :gem, :path
|
13
|
-
end
|
14
|
-
|
15
|
-
def gem_class
|
16
|
-
configuration.dig :gem, :class
|
17
|
-
end
|
18
|
-
|
19
|
-
def rails_version
|
20
|
-
configuration.dig :versions, :rails
|
21
|
-
end
|
22
|
-
|
23
|
-
def render_namespace &block
|
24
|
-
body = capture(&block) if block_given?
|
25
|
-
concat Gem::ModuleFormatter.new(gem_class).render(body)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|