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_private_key ⇒ Object
- .gem_public_key ⇒ 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_version ⇒ Object
- .year ⇒ Object
Class Method Details
.author_email ⇒ Object
64 65 66 |
# File 'lib/gemsmith/cli_options.rb', line 64 def @settings[:author_email] || Gemsmith::Kit.git_config_value("user.email") || "TODO: Add email address here." end |
.author_name ⇒ Object
60 61 62 |
# File 'lib/gemsmith/cli_options.rb', line 60 def @settings[:author_name] || Gemsmith::Kit.git_config_value("user.name") || "TODO: Add full name here." end |
.author_url ⇒ Object
68 69 70 |
# File 'lib/gemsmith/cli_options.rb', line 68 def @settings[:author_url] || "https://www.unknown.com" end |
.company_name ⇒ Object
72 73 74 |
# File 'lib/gemsmith/cli_options.rb', line 72 def company_name @settings[:company_name] || end |
.company_url ⇒ Object
76 77 78 |
# File 'lib/gemsmith/cli_options.rb', line 76 def company_url @settings[:company_url] || end |
.default_boolean(key, value = false) ⇒ Object
96 97 98 |
# File 'lib/gemsmith/cli_options.rb', line 96 def default_boolean key, value = false @settings.has_key?(key) ? @settings[key] : value end |
.gem_platform ⇒ Object
44 45 46 |
# File 'lib/gemsmith/cli_options.rb', line 44 def gem_platform @settings[:gem_platform] || "Gem::Platform::RUBY" end |
.gem_private_key ⇒ Object
52 53 54 |
# File 'lib/gemsmith/cli_options.rb', line 52 def gem_private_key @settings.fetch :gem_private_key, "~/.ssh/gem-private.pem" end |
.gem_public_key ⇒ Object
56 57 58 |
# File 'lib/gemsmith/cli_options.rb', line 56 def gem_public_key @settings.fetch :gem_public_key, "~/.ssh/gem-public.pem" end |
.gem_url ⇒ Object
48 49 50 |
# File 'lib/gemsmith/cli_options.rb', line 48 def gem_url @settings[:gem_url] || end |
.github_user ⇒ Object
80 81 82 |
# File 'lib/gemsmith/cli_options.rb', line 80 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 41 42 |
# 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, gem_private_key: gem_private_key, gem_public_key: gem_public_key, author_name: , author_email: , author_url: , company_name: company_name, company_url: company_url, github_user: github_user, year: year, ruby_version: ruby_version, 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), code_climate: default_boolean(:code_climate, true), gemnasium: default_boolean(:gemnasium, true), travis: default_boolean(:travis, true) } end |
.rails_version ⇒ Object
92 93 94 |
# File 'lib/gemsmith/cli_options.rb', line 92 def rails_version @settings[:rails_version] || "4.1" end |
.ruby_version ⇒ Object
88 89 90 |
# File 'lib/gemsmith/cli_options.rb', line 88 def ruby_version @settings[:ruby_version] || "2.1.3" end |
.year ⇒ Object
84 85 86 |
# File 'lib/gemsmith/cli_options.rb', line 84 def year @settings[:year] || Time.now.year end |