Class: Gemsmith::Configuration
- Inherits:
-
Object
- Object
- Gemsmith::Configuration
- Defined in:
- lib/gemsmith/configuration.rb
Overview
Default configuration for gem with support for custom settings.
Instance Attribute Summary collapse
- #author_email ⇒ Object
- #author_name ⇒ Object
- #author_url ⇒ Object
-
#create_cli ⇒ Object
writeonly
Sets the attribute create_cli.
-
#create_code_climate ⇒ Object
writeonly
Sets the attribute create_code_climate.
-
#create_gemnasium ⇒ Object
writeonly
Sets the attribute create_gemnasium.
-
#create_guard ⇒ Object
writeonly
Sets the attribute create_guard.
-
#create_patreon ⇒ Object
writeonly
Sets the attribute create_patreon.
-
#create_pry ⇒ Object
writeonly
Sets the attribute create_pry.
-
#create_rails ⇒ Object
writeonly
Sets the attribute create_rails.
-
#create_rspec ⇒ Object
writeonly
Sets the attribute create_rspec.
-
#create_rubocop ⇒ Object
writeonly
Sets the attribute create_rubocop.
-
#create_security ⇒ Object
writeonly
Sets the attribute create_security.
-
#create_travis ⇒ Object
writeonly
Sets the attribute create_travis.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#gem_class ⇒ Object
readonly
Returns the value of attribute gem_class.
- #gem_home_url ⇒ Object
- #gem_license ⇒ Object
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
- #gem_platform ⇒ Object
- #gem_private_key ⇒ Object
- #gem_public_key ⇒ Object
- #github_user ⇒ Object
-
#organization_email ⇒ Object
writeonly
Sets the attribute organization_email.
- #organization_name ⇒ Object
- #organization_url ⇒ Object
- #rails_version ⇒ Object
- #ruby_version ⇒ Object
- #year ⇒ Object
Instance Method Summary collapse
- #create_cli? ⇒ Boolean
- #create_code_climate? ⇒ Boolean
- #create_gemnasium? ⇒ Boolean
- #create_guard? ⇒ Boolean
- #create_patreon? ⇒ Boolean
- #create_pry? ⇒ Boolean
- #create_rails? ⇒ Boolean
- #create_rspec? ⇒ Boolean
- #create_rubocop? ⇒ Boolean
- #create_security? ⇒ Boolean
- #create_travis? ⇒ Boolean
-
#initialize(gem_name: "unknown", gem_class: "Unknown", git: Aids::Git, file_path: File.join(ENV["HOME"], Identity.file_name)) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h ⇒ Object
Constructor Details
#initialize(gem_name: "unknown", gem_class: "Unknown", git: Aids::Git, file_path: File.join(ENV["HOME"], Identity.file_name)) ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gemsmith/configuration.rb', line 11 def initialize gem_name: "unknown", gem_class: "Unknown", git: Aids::Git, file_path: File.join(ENV["HOME"], Identity.file_name) @gem_name = gem_name @gem_class = gem_class @file_path = file_path @git = git @settings = load_settings end |
Instance Attribute Details
#author_email ⇒ Object
47 48 49 |
# File 'lib/gemsmith/configuration.rb', line 47 def @author_email || settings_group(:author).fetch(:email, git.config_value("user.email")) end |
#author_name ⇒ Object
43 44 45 |
# File 'lib/gemsmith/configuration.rb', line 43 def @author_name || settings_group(:author).fetch(:name, git.config_value("user.name")) end |
#author_url ⇒ Object
51 52 53 |
# File 'lib/gemsmith/configuration.rb', line 51 def @author_url || settings_group(:author).fetch(:url, "") end |
#create_cli=(value) ⇒ Object (writeonly)
Sets the attribute create_cli
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_cli=(value) @create_cli = value end |
#create_code_climate=(value) ⇒ Object (writeonly)
Sets the attribute create_code_climate
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_code_climate=(value) @create_code_climate = value end |
#create_gemnasium=(value) ⇒ Object (writeonly)
Sets the attribute create_gemnasium
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_gemnasium=(value) @create_gemnasium = value end |
#create_guard=(value) ⇒ Object (writeonly)
Sets the attribute create_guard
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_guard=(value) @create_guard = value end |
#create_patreon=(value) ⇒ Object (writeonly)
Sets the attribute create_patreon
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_patreon=(value) @create_patreon = value end |
#create_pry=(value) ⇒ Object (writeonly)
Sets the attribute create_pry
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_pry=(value) @create_pry = value end |
#create_rails=(value) ⇒ Object (writeonly)
Sets the attribute create_rails
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_rails=(value) @create_rails = value end |
#create_rspec=(value) ⇒ Object (writeonly)
Sets the attribute create_rspec
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_rspec=(value) @create_rspec = value end |
#create_rubocop=(value) ⇒ Object (writeonly)
Sets the attribute create_rubocop
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_rubocop=(value) @create_rubocop = value end |
#create_security=(value) ⇒ Object (writeonly)
Sets the attribute create_security
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_security=(value) @create_security = value end |
#create_travis=(value) ⇒ Object (writeonly)
Sets the attribute create_travis
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def create_travis=(value) @create_travis = value end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
4 5 6 |
# File 'lib/gemsmith/configuration.rb', line 4 def file_path @file_path end |
#gem_class ⇒ Object (readonly)
Returns the value of attribute gem_class.
4 5 6 |
# File 'lib/gemsmith/configuration.rb', line 4 def gem_class @gem_class end |
#gem_home_url ⇒ Object
27 28 29 |
# File 'lib/gemsmith/configuration.rb', line 27 def gem_home_url @gem_home_url || settings_group(:gem).fetch(:home_url, github_gem_url) end |
#gem_license ⇒ Object
31 32 33 |
# File 'lib/gemsmith/configuration.rb', line 31 def gem_license @gem_license || settings_group(:gem).fetch(:license, "MIT") end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
4 5 6 |
# File 'lib/gemsmith/configuration.rb', line 4 def gem_name @gem_name end |
#gem_platform ⇒ Object
23 24 25 |
# File 'lib/gemsmith/configuration.rb', line 23 def gem_platform @gem_platform || settings_group(:gem).fetch(:platform, "Gem::Platform::RUBY") end |
#gem_private_key ⇒ Object
35 36 37 |
# File 'lib/gemsmith/configuration.rb', line 35 def gem_private_key @gem_private_key || settings_group(:gem).fetch(:private_key, "~/.ssh/gem-private.pem") end |
#gem_public_key ⇒ Object
39 40 41 |
# File 'lib/gemsmith/configuration.rb', line 39 def gem_public_key @gem_public_key || settings_group(:gem).fetch(:public_key, "~/.ssh/gem-public.pem") end |
#github_user ⇒ Object
115 116 117 |
# File 'lib/gemsmith/configuration.rb', line 115 def github_user @github_user || settings.fetch(:github_user, git.config_value("github.user")) end |
#organization_email=(value) ⇒ Object (writeonly)
Sets the attribute organization_email
5 6 7 |
# File 'lib/gemsmith/configuration.rb', line 5 def organization_email=(value) @organization_email = value end |
#organization_name ⇒ Object
55 56 57 |
# File 'lib/gemsmith/configuration.rb', line 55 def organization_name @organization_name || settings_group(:organization).fetch(:name, "") end |
#organization_url ⇒ Object
59 60 61 |
# File 'lib/gemsmith/configuration.rb', line 59 def organization_url @organization_url || settings_group(:organization).fetch(:url, "") end |
#rails_version ⇒ Object
67 68 69 |
# File 'lib/gemsmith/configuration.rb', line 67 def rails_version @rails_version || settings_group(:versions).fetch(:rails, "4.2") end |
#ruby_version ⇒ Object
63 64 65 |
# File 'lib/gemsmith/configuration.rb', line 63 def ruby_version @ruby_version || settings_group(:versions).fetch(:ruby, RUBY_VERSION) end |
#year ⇒ Object
119 120 121 |
# File 'lib/gemsmith/configuration.rb', line 119 def year @year || settings.fetch(:year, Time.now.year) end |
Instance Method Details
#create_cli? ⇒ Boolean
71 72 73 |
# File 'lib/gemsmith/configuration.rb', line 71 def create_cli? parse_boolean @create_cli, :create, :cli, false end |
#create_code_climate? ⇒ Boolean
99 100 101 |
# File 'lib/gemsmith/configuration.rb', line 99 def create_code_climate? parse_boolean @create_code_climate, :create, :code_climate, true end |
#create_gemnasium? ⇒ Boolean
103 104 105 |
# File 'lib/gemsmith/configuration.rb', line 103 def create_gemnasium? parse_boolean @create_gemnasium, :create, :gemnasium, true end |
#create_guard? ⇒ Boolean
87 88 89 |
# File 'lib/gemsmith/configuration.rb', line 87 def create_guard? parse_boolean @create_guard, :create, :guard, true end |
#create_patreon? ⇒ Boolean
111 112 113 |
# File 'lib/gemsmith/configuration.rb', line 111 def create_patreon? parse_boolean @create_patreon, :create, :patreon, true end |
#create_pry? ⇒ Boolean
83 84 85 |
# File 'lib/gemsmith/configuration.rb', line 83 def create_pry? parse_boolean @create_pry, :create, :pry, true end |
#create_rails? ⇒ Boolean
75 76 77 |
# File 'lib/gemsmith/configuration.rb', line 75 def create_rails? parse_boolean @create_rails, :create, :rails, false end |
#create_rspec? ⇒ Boolean
91 92 93 |
# File 'lib/gemsmith/configuration.rb', line 91 def create_rspec? parse_boolean @create_rspec, :create, :rspec, true end |
#create_rubocop? ⇒ Boolean
95 96 97 |
# File 'lib/gemsmith/configuration.rb', line 95 def create_rubocop? parse_boolean @create_rubocop, :create, :rubocop, true end |
#create_security? ⇒ Boolean
79 80 81 |
# File 'lib/gemsmith/configuration.rb', line 79 def create_security? parse_boolean @create_security, :create, :security, true end |
#create_travis? ⇒ Boolean
107 108 109 |
# File 'lib/gemsmith/configuration.rb', line 107 def create_travis? parse_boolean @create_travis, :create, :travis, true end |
#to_h ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/gemsmith/configuration.rb', line 123 def to_h { year: year, github_user: github_user, gem: { name: gem_name, class: gem_class, platform: gem_platform, home_url: gem_home_url, license: gem_license, private_key: gem_private_key, public_key: gem_public_key }, author: { name: , email: , url: }, organization: { name: organization_name, url: organization_url }, versions: { ruby: ruby_version, rails: rails_version }, create: { cli: create_cli?, rails: create_rails?, security: create_security?, pry: create_pry?, guard: create_guard?, rspec: create_rspec?, rubocop: create_rubocop?, code_climate: create_code_climate?, gemnasium: create_gemnasium?, travis: create_travis?, patreon: create_patreon? } } end |