Module: Gemsmith::CLIOptions
- Included in:
- CLI
- Defined in:
- lib/gemsmith/cli_options.rb
Class Method Summary collapse
- .author_email ⇒ Object
- .author_name ⇒ Object
- .author_url ⇒ Object
- .company_name ⇒ Object
- .company_url ⇒ Object
- .default_boolean(key, value = false) ⇒ Object
- .gem_platform ⇒ Object
- .gem_url ⇒ Object
- .github_user ⇒ Object
-
.initialize_template_options(name, options = {}) ⇒ Object
Initializes template options with default and/or command line overrides.
- .rails_version ⇒ Object
- .ruby_patch ⇒ Object
- .ruby_version ⇒ Object
- .year ⇒ Object
Class Method Details
.author_email ⇒ Object
54 55 56 |
# File 'lib/gemsmith/cli_options.rb', line 54 def @settings[:author_email] || Gemsmith::Kit.git_config_value("user.email") || "TODO: Add email address here." end |
.author_name ⇒ Object
50 51 52 |
# File 'lib/gemsmith/cli_options.rb', line 50 def @settings[:author_name] || Gemsmith::Kit.git_config_value("user.name") || "TODO: Add full name here." end |
.author_url ⇒ Object
58 59 60 |
# File 'lib/gemsmith/cli_options.rb', line 58 def @settings[:author_url] || "https://www.unknown.com" end |
.company_name ⇒ Object
62 63 64 |
# File 'lib/gemsmith/cli_options.rb', line 62 def company_name @settings[:company_name] || end |
.company_url ⇒ Object
66 67 68 |
# File 'lib/gemsmith/cli_options.rb', line 66 def company_url @settings[:company_url] || end |
.default_boolean(key, value = false) ⇒ Object
90 91 92 |
# File 'lib/gemsmith/cli_options.rb', line 90 def default_boolean key, value = false @settings.has_key?(key) ? @settings[key] : value end |
.gem_platform ⇒ Object
42 43 44 |
# File 'lib/gemsmith/cli_options.rb', line 42 def gem_platform @settings[:gem_platform] || "Gem::Platform::RUBY" end |
.gem_url ⇒ Object
46 47 48 |
# File 'lib/gemsmith/cli_options.rb', line 46 def gem_url @settings[:gem_url] || end |
.github_user ⇒ Object
70 71 72 |
# File 'lib/gemsmith/cli_options.rb', line 70 def github_user @settings[:github_user] || Gemsmith::Kit.git_config_value("github.user") || "unknown" end |
.initialize_template_options(name, options = {}) ⇒ Object
Initializes template options with default and/or command line overrides.
Parameters
-
name- Required. The gem name. -
options- Optional. Additional command line options. Default: {}.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gemsmith/cli_options.rb', line 9 def name, = {} @settings.merge! @settings = enforce_symbol_keys @settings gem_name name gem_class name = { gem_name: gem_name, gem_class: gem_class, gem_platform: gem_platform, gem_url: gem_url, author_name: , author_email: , author_url: , company_name: company_name, company_url: company_url, github_user: github_user, year: year, ruby_version: ruby_version, ruby_patch: ruby_patch, rails_version: rails_version, post_install_message: @settings[:post_install_message], bin: default_boolean(:bin), rails: default_boolean(:rails), pry: default_boolean(:pry, true), guard: default_boolean(:guard, true), rspec: default_boolean(:rspec, true), travis: default_boolean(:travis, true), code_climate: default_boolean(:code_climate, true) } end |
.rails_version ⇒ Object
86 87 88 |
# File 'lib/gemsmith/cli_options.rb', line 86 def rails_version @settings[:rails_version] || "3.0" end |
.ruby_patch ⇒ Object
82 83 84 |
# File 'lib/gemsmith/cli_options.rb', line 82 def ruby_patch @settings[:ruby_patch] || "p0" end |
.ruby_version ⇒ Object
78 79 80 |
# File 'lib/gemsmith/cli_options.rb', line 78 def ruby_version @settings[:ruby_version] || "2.0.0" end |
.year ⇒ Object
74 75 76 |
# File 'lib/gemsmith/cli_options.rb', line 74 def year @settings[:year] || Time.now.year end |