gemsmith 5.6.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +4 -3
  4. data/README.md +90 -54
  5. data/lib/gemsmith.rb +0 -1
  6. data/lib/gemsmith/aids/gem.rb +24 -0
  7. data/lib/gemsmith/aids/git.rb +10 -0
  8. data/lib/gemsmith/aids/spec.rb +41 -0
  9. data/lib/gemsmith/cli.rb +26 -11
  10. data/lib/gemsmith/cli_helpers.rb +20 -69
  11. data/lib/gemsmith/configuration.rb +189 -0
  12. data/lib/gemsmith/identity.rb +2 -2
  13. data/lib/gemsmith/rake/build.rb +17 -19
  14. data/lib/gemsmith/rake/tasks.rb +11 -9
  15. data/lib/gemsmith/skeletons/base_skeleton.rb +6 -9
  16. data/lib/gemsmith/skeletons/bundler_skeleton.rb +1 -1
  17. data/lib/gemsmith/skeletons/cli_skeleton.rb +3 -7
  18. data/lib/gemsmith/skeletons/documentation_skeleton.rb +17 -5
  19. data/lib/gemsmith/skeletons/gem_skeleton.rb +4 -4
  20. data/lib/gemsmith/skeletons/git_skeleton.rb +2 -2
  21. data/lib/gemsmith/skeletons/guard_skeleton.rb +2 -6
  22. data/lib/gemsmith/skeletons/pry_skeleton.rb +11 -0
  23. data/lib/gemsmith/skeletons/rails_skeleton.rb +21 -19
  24. data/lib/gemsmith/skeletons/rake_skeleton.rb +10 -15
  25. data/lib/gemsmith/skeletons/rspec_skeleton.rb +8 -12
  26. data/lib/gemsmith/skeletons/rubocop_skeleton.rb +3 -7
  27. data/lib/gemsmith/skeletons/ruby_skeleton.rb +1 -1
  28. data/lib/gemsmith/skeletons/travis_skeleton.rb +2 -6
  29. data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +23 -29
  30. data/lib/gemsmith/templates/%gem_name%/.gitignore.tt +0 -1
  31. data/lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt +3 -1
  32. data/lib/gemsmith/templates/%gem_name%/.ruby-version.tt +1 -1
  33. data/lib/gemsmith/templates/%gem_name%/.travis.yml.tt +3 -4
  34. data/lib/gemsmith/templates/%gem_name%/CODE_OF_CONDUCT.md.tt +18 -9
  35. data/lib/gemsmith/templates/%gem_name%/Guardfile.tt +1 -1
  36. data/lib/gemsmith/templates/%gem_name%/LICENSE.md.tt +1 -1
  37. data/lib/gemsmith/templates/%gem_name%/README.md.tt +25 -22
  38. data/lib/gemsmith/templates/%gem_name%/Rakefile.tt +1 -1
  39. data/lib/gemsmith/templates/%gem_name%/bin/%gem_name%.tt +5 -5
  40. data/lib/gemsmith/templates/%gem_name%/gemfiles/rails-%rails_version%.x.gemfile.tt +5 -0
  41. data/lib/gemsmith/templates/%gem_name%/lib/%gem_name%.rb.tt +3 -3
  42. data/lib/gemsmith/templates/%gem_name%/lib/%gem_name%/cli.rb.tt +7 -7
  43. data/lib/gemsmith/templates/%gem_name%/lib/%gem_name%/engine.rb.tt +2 -2
  44. data/lib/gemsmith/templates/%gem_name%/lib/%gem_name%/identity.rb.tt +5 -5
  45. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/install/USAGE.tt +2 -2
  46. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/install/install_generator.rb.tt +2 -2
  47. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/upgrade/USAGE.tt +2 -2
  48. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/upgrade/upgrade_generator.rb.tt +2 -2
  49. data/lib/gemsmith/templates/%gem_name%/lib/{%gem_name%/tasks → tasks}/rspec.rake.tt +0 -0
  50. data/lib/gemsmith/templates/%gem_name%/lib/{%gem_name%/tasks → tasks}/rubocop.rake.tt +0 -0
  51. data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_name%/%gem_name%_spec.rb.tt +1 -1
  52. data/lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt +5 -16
  53. data/lib/gemsmith/templates/%gem_name%/spec/support/extensions/pry.rb.tt +6 -0
  54. data/lib/{gemsmith/tasks → tasks}/rspec.rake +0 -0
  55. data/lib/{gemsmith/tasks → tasks}/rubocop.rake +0 -0
  56. metadata +47 -15
  57. metadata.gz.sig +0 -0
  58. data/lib/gemsmith/cli_options.rb +0 -103
  59. data/lib/gemsmith/kit.rb +0 -12
  60. data/lib/gemsmith/templates/%gem_name%/gemfiles/rails-4.1.x.gemfile.tt +0 -5
@@ -1,2 +1,2 @@
1
1
  require "gemsmith/rake/setup"
2
- Dir.glob("lib/<%= config[:gem_name] %>/tasks/*.rake").each { |file| load file }
2
+ Dir.glob("lib/tasks/*.rake").each { |file| load file }
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require "<%= config[:gem_name] %>"
4
- require "<%= config[:gem_name] %>/cli"
5
- require "<%= config[:gem_name] %>/identity"
3
+ require "<%= config.fetch(:gem).fetch(:name) %>"
4
+ require "<%= config.fetch(:gem).fetch(:name) %>/cli"
5
+ require "<%= config.fetch(:gem).fetch(:name) %>/identity"
6
6
 
7
- Process.setproctitle <%= config[:gem_class] %>::Identity.version_label
8
- <%= config[:gem_class] %>::CLI.start
7
+ Process.setproctitle <%= config.fetch(:gem).fetch(:class) %>::Identity.version_label
8
+ <%= config.fetch(:gem).fetch(:class) %>::CLI.start
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> <%= config.fetch(:versions).fetch(:rails) %>.0"
4
+
5
+ gemspec path: "../"
@@ -1,4 +1,4 @@
1
- require "<%= config[:gem_name] %>/identity"
2
- <%- if config[:rails] -%>
3
- require "<%= config[:gem_name] %>/engine"
1
+ require "<%= config.fetch(:gem).fetch(:name) %>/identity"
2
+ <%- if config.fetch(:create).fetch(:rails) -%>
3
+ require "<%= config.fetch(:gem).fetch(:name) %>/engine"
4
4
  <%- end -%>
@@ -3,30 +3,30 @@ require "thor"
3
3
  require "thor/actions"
4
4
  require "thor_plus/actions"
5
5
 
6
- module <%= config[:gem_class] %>
6
+ module <%= config.fetch(:gem).fetch(:class) %>
7
7
  # The Command Line Interface (CLI) for the gem.
8
8
  class CLI < Thor
9
9
  include Thor::Actions
10
10
  include ThorPlus::Actions
11
11
 
12
- package_name <%= config[:gem_class] %>::Identity.version_label
12
+ package_name <%= config.fetch(:gem).fetch(:class) %>::Identity.version_label
13
13
 
14
14
  def initialize args = [], options = {}, config = {}
15
15
  super args, options, config
16
16
  end
17
- <%- if config[:bin] -%>
17
+ <%- if config.fetch(:create).fetch(:cli) -%>
18
18
 
19
- desc "-e, [--edit]", "Edit #{<%= config[:gem_class] %>::Identity.label} settings in default editor."
19
+ desc "-e, [--edit]", "Edit #{<%= config.fetch(:gem).fetch(:class) %>::Identity.label} settings in default editor."
20
20
  map %w(-e --edit) => :edit
21
21
  def edit
22
- `#{editor} $HOME/#{<%= config[:gem_class] %>::Identity.file_name}`
22
+ `#{editor} $HOME/#{<%= config.fetch(:gem).fetch(:class) %>::Identity.file_name}`
23
23
  end
24
24
  <%- end -%>
25
25
 
26
- desc "-v, [--version]", "Show #{<%= config[:gem_class] %>::Identity.label} version."
26
+ desc "-v, [--version]", "Show #{<%= config.fetch(:gem).fetch(:class) %>::Identity.label} version."
27
27
  map %w(-v --version) => :version
28
28
  def version
29
- say <%= config[:gem_class] %>::Identity.version_label
29
+ say <%= config.fetch(:gem).fetch(:class) %>::Identity.version_label
30
30
  end
31
31
 
32
32
  desc "-h, [--help=HELP]", "Show this message or get help for a command."
@@ -1,6 +1,6 @@
1
- module <%= config[:gem_class] %>
1
+ module <%= config.fetch(:gem).fetch(:class) %>
2
2
  # Defines and registers the Rails engine.
3
3
  class Engine < ::Rails::Engine
4
- isolate_namespace <%= config[:gem_class] %>
4
+ isolate_namespace <%= config.fetch(:gem).fetch(:class) %>
5
5
  end
6
6
  end
@@ -1,12 +1,12 @@
1
- module <%= config[:gem_class] %>
1
+ module <%= config.fetch(:gem).fetch(:class) %>
2
2
  # Gem identity information.
3
3
  module Identity
4
4
  def self.name
5
- "<%= config[:gem_name] %>"
5
+ "<%= config.fetch(:gem).fetch(:name) %>"
6
6
  end
7
7
 
8
8
  def self.label
9
- "<%= config[:gem_class] %>"
9
+ "<%= config.fetch(:gem).fetch(:class) %>"
10
10
  end
11
11
 
12
12
  def self.version
@@ -14,9 +14,9 @@ module <%= config[:gem_class] %>
14
14
  end
15
15
 
16
16
  def self.version_label
17
- [label, version].join " "
17
+ "#{label} #{version}"
18
18
  end
19
- <%- if config[:bin] -%>
19
+ <%- if config.fetch(:create).fetch(:cli) -%>
20
20
 
21
21
  def self.file_name
22
22
  ".#{name}rc"
@@ -1,8 +1,8 @@
1
1
  Description:
2
- Installs additional <%= config[:gem_class] %> resources.
2
+ Installs additional <%= config.fetch(:gem).fetch(:class) %> resources.
3
3
 
4
4
  Example:
5
- rails generate <%= config[:gem_name] %>:install
5
+ rails generate <%= config.fetch(:gem).fetch(:name) %>:install
6
6
 
7
7
  This will create:
8
8
  what/will/it/create
@@ -1,9 +1,9 @@
1
- module <%= config[:gem_class] %>
1
+ module <%= config.fetch(:gem).fetch(:class) %>
2
2
  # Generator for installing new files.
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  source_root File.join(File.dirname(__FILE__), "..", "templates")
5
5
 
6
- desc "Installs additional <%= config[:gem_class] %> resources."
6
+ desc "Installs additional <%= config.fetch(:gem).fetch(:class) %> resources."
7
7
  def install
8
8
  # TODO: Add install code.
9
9
  end
@@ -1,8 +1,8 @@
1
1
  Description:
2
- Upgrades previously installed <%= config[:gem_class] %> resources.
2
+ Upgrades previously installed <%= config.fetch(:gem).fetch(:class) %> resources.
3
3
 
4
4
  Example:
5
- rails generate <%= config[:gem_name] %>:upgrade
5
+ rails generate <%= config.fetch(:gem).fetch(:name) %>:upgrade
6
6
 
7
7
  This will create:
8
8
  what/will/it/create
@@ -1,9 +1,9 @@
1
- module <%= config[:gem_class] %>
1
+ module <%= config.fetch(:gem).fetch(:class) %>
2
2
  # Generator for updating existing files.
3
3
  class UpgradeGenerator < Rails::Generators::Base
4
4
  source_root File.join(File.dirname(__FILE__), "..", "templates")
5
5
 
6
- desc "Upgrades previously installed <%= config[:gem_class] %> resources."
6
+ desc "Upgrades previously installed <%= config.fetch(:gem).fetch(:class) %> resources."
7
7
  def upgrade
8
8
  # TODO: Add upgrade code.
9
9
  end
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "<%= config[:gem_class] %>" do
3
+ describe "<%= config.fetch(:gem).fetch(:class) %>" do
4
4
  it "should be tested"
5
5
  end
@@ -1,30 +1,19 @@
1
1
  require "bundler/setup"
2
2
 
3
- <%- if config[:code_climate] -%>
4
- if ENV["CODECLIMATE_REPO_TOKEN"]
3
+ <%- if config.fetch(:create).fetch(:code_climate) -%>
4
+ if ENV["CI"]
5
5
  require "codeclimate-test-reporter"
6
6
  CodeClimate::TestReporter.start
7
7
  end
8
8
 
9
9
  <%- end -%>
10
- <%- if config[:rails] -%>
10
+ <%- if config.fetch(:create).fetch(:rails) -%>
11
11
  ENV["RAILS_ENV"] ||= "test"
12
12
  require File.expand_path "../dummy/config/environment", __FILE__
13
13
  ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "/dummy"
14
14
 
15
15
  <%- end -%>
16
- require "<%= config[:gem_name] %>"
17
- <%- if config[:pry] -%>
18
- require "pry"
19
- require "pry-byebug"
20
- require "pry-state"
21
- require "pry-stack_explorer"
22
- require "pry-remote"
23
- require "pry-rescue"
24
- <%- end -%>
16
+ require "<%= config.fetch(:gem).fetch(:name) %>"
25
17
 
18
+ Dir[File.join(File.dirname(__FILE__), "support/extensions/**/*.rb")].each { |file| require file }
26
19
  Dir[File.join(File.dirname(__FILE__), "support/kit/**/*.rb")].each { |file| require file }
27
-
28
- # Uncomment to add a custom configuration. For the default configuration, see the "support/kit" folder.
29
- # RSpec.configure do |config|
30
- # end
@@ -0,0 +1,6 @@
1
+ require "pry"
2
+ require "pry-byebug"
3
+ require "pry-remote"
4
+ require "pry-state"
5
+ require "pry-rescue"
6
+ require "pry-stack_explorer"
File without changes
File without changes
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: 5.6.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -30,7 +30,7 @@ cert_chain:
30
30
  aSif+qBc6oHD7EQWPF5cZkzkIURuwNwPBngZGxIKaMAgRhjGFXzUMAaq++r59cS9
31
31
  xTfQ4k6fglKEgpnLAXiKdo2c8Ym+X4rIKFfedQ==
32
32
  -----END CERTIFICATE-----
33
- date: 2015-09-27 00:00:00.000000000 Z
33
+ date: 2015-11-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: thor
@@ -61,7 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '2.1'
63
63
  - !ruby/object:Gem::Dependency
64
- name: milestoner
64
+ name: tocer
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
@@ -74,6 +74,20 @@ dependencies:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.0'
77
+ - !ruby/object:Gem::Dependency
78
+ name: milestoner
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.1'
84
+ type: :runtime
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.1'
77
91
  - !ruby/object:Gem::Dependency
78
92
  name: rake
79
93
  requirement: !ruby/object:Gem::Requirement
@@ -117,7 +131,7 @@ dependencies:
117
131
  - !ruby/object:Gem::Version
118
132
  version: '0'
119
133
  - !ruby/object:Gem::Dependency
120
- name: pry-state
134
+ name: pry-remote
121
135
  requirement: !ruby/object:Gem::Requirement
122
136
  requirements:
123
137
  - - ">="
@@ -131,7 +145,7 @@ dependencies:
131
145
  - !ruby/object:Gem::Version
132
146
  version: '0'
133
147
  - !ruby/object:Gem::Dependency
134
- name: pry-stack_explorer
148
+ name: pry-state
135
149
  requirement: !ruby/object:Gem::Requirement
136
150
  requirements:
137
151
  - - ">="
@@ -145,7 +159,7 @@ dependencies:
145
159
  - !ruby/object:Gem::Version
146
160
  version: '0'
147
161
  - !ruby/object:Gem::Dependency
148
- name: pry-remote
162
+ name: pry-rescue
149
163
  requirement: !ruby/object:Gem::Requirement
150
164
  requirements:
151
165
  - - ">="
@@ -159,7 +173,7 @@ dependencies:
159
173
  - !ruby/object:Gem::Version
160
174
  version: '0'
161
175
  - !ruby/object:Gem::Dependency
162
- name: pry-rescue
176
+ name: pry-stack_explorer
163
177
  requirement: !ruby/object:Gem::Requirement
164
178
  requirements:
165
179
  - - ">="
@@ -186,6 +200,20 @@ dependencies:
186
200
  - - ">="
187
201
  - !ruby/object:Gem::Version
188
202
  version: '0'
203
+ - !ruby/object:Gem::Dependency
204
+ name: climate_control
205
+ requirement: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ type: :development
211
+ prerelease: false
212
+ version_requirements: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: '0'
189
217
  - !ruby/object:Gem::Dependency
190
218
  name: rb-fsevent
191
219
  requirement: !ruby/object:Gem::Requirement
@@ -284,11 +312,13 @@ files:
284
312
  - README.md
285
313
  - bin/gemsmith
286
314
  - lib/gemsmith.rb
315
+ - lib/gemsmith/aids/gem.rb
316
+ - lib/gemsmith/aids/git.rb
317
+ - lib/gemsmith/aids/spec.rb
287
318
  - lib/gemsmith/cli.rb
288
319
  - lib/gemsmith/cli_helpers.rb
289
- - lib/gemsmith/cli_options.rb
320
+ - lib/gemsmith/configuration.rb
290
321
  - lib/gemsmith/identity.rb
291
- - lib/gemsmith/kit.rb
292
322
  - lib/gemsmith/rake/build.rb
293
323
  - lib/gemsmith/rake/release.rb
294
324
  - lib/gemsmith/rake/setup.rb
@@ -300,14 +330,13 @@ files:
300
330
  - lib/gemsmith/skeletons/gem_skeleton.rb
301
331
  - lib/gemsmith/skeletons/git_skeleton.rb
302
332
  - lib/gemsmith/skeletons/guard_skeleton.rb
333
+ - lib/gemsmith/skeletons/pry_skeleton.rb
303
334
  - lib/gemsmith/skeletons/rails_skeleton.rb
304
335
  - lib/gemsmith/skeletons/rake_skeleton.rb
305
336
  - lib/gemsmith/skeletons/rspec_skeleton.rb
306
337
  - lib/gemsmith/skeletons/rubocop_skeleton.rb
307
338
  - lib/gemsmith/skeletons/ruby_skeleton.rb
308
339
  - lib/gemsmith/skeletons/travis_skeleton.rb
309
- - lib/gemsmith/tasks/rspec.rake
310
- - lib/gemsmith/tasks/rubocop.rake
311
340
  - lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt
312
341
  - lib/gemsmith/templates/%gem_name%/.gitignore.tt
313
342
  - lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt
@@ -322,23 +351,26 @@ files:
322
351
  - lib/gemsmith/templates/%gem_name%/README.md.tt
323
352
  - lib/gemsmith/templates/%gem_name%/Rakefile.tt
324
353
  - lib/gemsmith/templates/%gem_name%/bin/%gem_name%.tt
325
- - lib/gemsmith/templates/%gem_name%/gemfiles/rails-4.1.x.gemfile.tt
354
+ - lib/gemsmith/templates/%gem_name%/gemfiles/rails-%rails_version%.x.gemfile.tt
326
355
  - lib/gemsmith/templates/%gem_name%/lib/%gem_name%.rb.tt
327
356
  - lib/gemsmith/templates/%gem_name%/lib/%gem_name%/cli.rb.tt
328
357
  - lib/gemsmith/templates/%gem_name%/lib/%gem_name%/engine.rb.tt
329
358
  - lib/gemsmith/templates/%gem_name%/lib/%gem_name%/identity.rb.tt
330
- - lib/gemsmith/templates/%gem_name%/lib/%gem_name%/tasks/rspec.rake.tt
331
- - lib/gemsmith/templates/%gem_name%/lib/%gem_name%/tasks/rubocop.rake.tt
332
359
  - lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/install/USAGE.tt
333
360
  - lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/install/install_generator.rb.tt
334
361
  - lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/upgrade/USAGE.tt
335
362
  - lib/gemsmith/templates/%gem_name%/lib/generators/%gem_name%/upgrade/upgrade_generator.rb.tt
363
+ - lib/gemsmith/templates/%gem_name%/lib/tasks/rspec.rake.tt
364
+ - lib/gemsmith/templates/%gem_name%/lib/tasks/rubocop.rake.tt
336
365
  - lib/gemsmith/templates/%gem_name%/spec/lib/%gem_name%/%gem_name%_spec.rb.tt
337
366
  - lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt
367
+ - lib/gemsmith/templates/%gem_name%/spec/support/extensions/pry.rb.tt
338
368
  - lib/gemsmith/templates/%gem_name%/spec/support/kit/default_config.rb.tt
339
369
  - lib/gemsmith/templates/%gem_name%/spec/support/kit/stderr.rb.tt
340
370
  - lib/gemsmith/templates/%gem_name%/spec/support/kit/stdout.rb.tt
341
371
  - lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
372
+ - lib/tasks/rspec.rake
373
+ - lib/tasks/rubocop.rake
342
374
  homepage: https://github.com/bkuhlmann/gemsmith
343
375
  licenses:
344
376
  - MIT
@@ -359,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
391
  version: '0'
360
392
  requirements: []
361
393
  rubyforge_project:
362
- rubygems_version: 2.4.8
394
+ rubygems_version: 2.5.0
363
395
  signing_key:
364
396
  specification_version: 4
365
397
  summary: A command line interface for smithing new Ruby gems.
metadata.gz.sig CHANGED
Binary file
@@ -1,103 +0,0 @@
1
- module Gemsmith
2
- # Provides Command Line Interface (CLI) settings initialization with safe defaults.
3
- module CLIOptions
4
- module_function
5
-
6
- # Initializes template options with default and/or command line overrides.
7
- # ==== Parameters
8
- # * +name+ - Required. The gem name.
9
- # * +options+ - Optional. Additional command line options. Default: {}.
10
- def initialize_template_options name, options = {}
11
- @settings.merge! options
12
- @settings = enforce_symbol_keys @settings
13
-
14
- gem_name name
15
- gem_class name
16
-
17
- @template_options = {
18
- gem_name: gem_name,
19
- gem_class: gem_class,
20
- gem_platform: gem_platform,
21
- gem_url: gem_url,
22
- gem_private_key: gem_private_key,
23
- gem_public_key: gem_public_key,
24
- author_name: author_name,
25
- author_email: author_email,
26
- author_url: author_url,
27
- company_name: company_name,
28
- company_url: company_url,
29
- github_user: github_user,
30
- year: year,
31
- ruby_version: ruby_version,
32
- rails_version: rails_version,
33
- post_install_message: @settings[:post_install_message],
34
- bin: default_boolean(:bin),
35
- rails: default_boolean(:rails),
36
- security: default_boolean(:security, true),
37
- pry: default_boolean(:pry, true),
38
- guard: default_boolean(:guard, true),
39
- rspec: default_boolean(:rspec, true),
40
- rubocop: default_boolean(:rubocop, true),
41
- code_climate: default_boolean(:code_climate, true),
42
- gemnasium: default_boolean(:gemnasium, true),
43
- travis: default_boolean(:travis, true)
44
- }
45
- end
46
-
47
- def gem_platform
48
- @settings[:gem_platform] || "Gem::Platform::RUBY"
49
- end
50
-
51
- def gem_url
52
- @settings[:gem_url] || author_url
53
- end
54
-
55
- def gem_private_key
56
- @settings.fetch :gem_private_key, "~/.ssh/gem-private.pem"
57
- end
58
-
59
- def gem_public_key
60
- @settings.fetch :gem_public_key, "~/.ssh/gem-public.pem"
61
- end
62
-
63
- def author_name
64
- @settings[:author_name] || Gemsmith::Kit.git_config_value("user.name") || "TODO: Add full name."
65
- end
66
-
67
- def author_email
68
- @settings[:author_email] || Gemsmith::Kit.git_config_value("user.email") || "TODO: Add email address."
69
- end
70
-
71
- def author_url
72
- @settings[:author_url] || "https://www.unknown.com"
73
- end
74
-
75
- def company_name
76
- @settings[:company_name] || author_name
77
- end
78
-
79
- def company_url
80
- @settings[:company_url] || author_url
81
- end
82
-
83
- def github_user
84
- @settings[:github_user] || Gemsmith::Kit.git_config_value("github.user") || "unknown"
85
- end
86
-
87
- def year
88
- @settings[:year] || Time.now.year
89
- end
90
-
91
- def ruby_version
92
- @settings[:ruby_version] || "2.2.3"
93
- end
94
-
95
- def rails_version
96
- @settings[:rails_version] || "4.2"
97
- end
98
-
99
- def default_boolean key, value = false
100
- @settings.key?(key) ? @settings[key] : value
101
- end
102
- end
103
- end