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_git_hub ⇒ Object
writeonly
Sets the attribute create_git_hub.
-
#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_git_hub? ⇒ 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.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gemsmith/configuration.rb', line 13 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
49 50 51 |
# File 'lib/gemsmith/configuration.rb', line 49 def || settings_group(:author).fetch(:email, git.config_value("user.email")) end |
#author_name ⇒ Object
45 46 47 |
# File 'lib/gemsmith/configuration.rb', line 45 def || settings_group(:author).fetch(:name, git.config_value("user.name")) end |
#author_url ⇒ Object
53 54 55 |
# File 'lib/gemsmith/configuration.rb', line 53 def || settings_group(:author).fetch(:url, "") end |
#create_cli=(value) ⇒ Object (writeonly)
Sets the attribute create_cli
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_cli=(value) @create_cli = value end |
#create_code_climate=(value) ⇒ Object (writeonly)
Sets the attribute create_code_climate
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_code_climate=(value) @create_code_climate = value end |
#create_gemnasium=(value) ⇒ Object (writeonly)
Sets the attribute create_gemnasium
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_gemnasium=(value) @create_gemnasium = value end |
#create_git_hub=(value) ⇒ Object (writeonly)
Sets the attribute create_git_hub
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_git_hub=(value) @create_git_hub = value end |
#create_guard=(value) ⇒ Object (writeonly)
Sets the attribute create_guard
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_guard=(value) @create_guard = value end |
#create_patreon=(value) ⇒ Object (writeonly)
Sets the attribute create_patreon
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_patreon=(value) @create_patreon = value end |
#create_pry=(value) ⇒ Object (writeonly)
Sets the attribute create_pry
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_pry=(value) @create_pry = value end |
#create_rails=(value) ⇒ Object (writeonly)
Sets the attribute create_rails
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_rails=(value) @create_rails = value end |
#create_rspec=(value) ⇒ Object (writeonly)
Sets the attribute create_rspec
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_rspec=(value) @create_rspec = value end |
#create_rubocop=(value) ⇒ Object (writeonly)
Sets the attribute create_rubocop
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_rubocop=(value) @create_rubocop = value end |
#create_security=(value) ⇒ Object (writeonly)
Sets the attribute create_security
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_security=(value) @create_security = value end |
#create_travis=(value) ⇒ Object (writeonly)
Sets the attribute create_travis
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def create_travis=(value) @create_travis = value end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/gemsmith/configuration.rb', line 6 def file_path @file_path end |
#gem_class ⇒ Object (readonly)
Returns the value of attribute gem_class.
6 7 8 |
# File 'lib/gemsmith/configuration.rb', line 6 def gem_class @gem_class end |
#gem_home_url ⇒ Object
29 30 31 |
# File 'lib/gemsmith/configuration.rb', line 29 def gem_home_url @gem_home_url || settings_group(:gem).fetch(:home_url, github_gem_url) end |
#gem_license ⇒ Object
33 34 35 |
# File 'lib/gemsmith/configuration.rb', line 33 def gem_license @gem_license || settings_group(:gem).fetch(:license, "MIT") end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
6 7 8 |
# File 'lib/gemsmith/configuration.rb', line 6 def gem_name @gem_name end |
#gem_platform ⇒ Object
25 26 27 |
# File 'lib/gemsmith/configuration.rb', line 25 def gem_platform @gem_platform || settings_group(:gem).fetch(:platform, "Gem::Platform::RUBY") end |
#gem_private_key ⇒ Object
37 38 39 |
# File 'lib/gemsmith/configuration.rb', line 37 def gem_private_key @gem_private_key || settings_group(:gem).fetch(:private_key, "~/.ssh/gem-private.pem") end |
#gem_public_key ⇒ Object
41 42 43 |
# File 'lib/gemsmith/configuration.rb', line 41 def gem_public_key @gem_public_key || settings_group(:gem).fetch(:public_key, "~/.ssh/gem-public.pem") end |
#github_user ⇒ Object
121 122 123 |
# File 'lib/gemsmith/configuration.rb', line 121 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
7 8 9 |
# File 'lib/gemsmith/configuration.rb', line 7 def organization_email=(value) @organization_email = value end |
#organization_name ⇒ Object
57 58 59 |
# File 'lib/gemsmith/configuration.rb', line 57 def organization_name @organization_name || settings_group(:organization).fetch(:name, "") end |
#organization_url ⇒ Object
61 62 63 |
# File 'lib/gemsmith/configuration.rb', line 61 def organization_url @organization_url || settings_group(:organization).fetch(:url, "") end |
#rails_version ⇒ Object
69 70 71 |
# File 'lib/gemsmith/configuration.rb', line 69 def rails_version @rails_version || settings_group(:versions).fetch(:rails, "4.2") end |
#ruby_version ⇒ Object
65 66 67 |
# File 'lib/gemsmith/configuration.rb', line 65 def ruby_version @ruby_version || settings_group(:versions).fetch(:ruby, RUBY_VERSION) end |
#year ⇒ Object
125 126 127 |
# File 'lib/gemsmith/configuration.rb', line 125 def year @year || settings.fetch(:year, Time.now.year) end |
Instance Method Details
#create_cli? ⇒ Boolean
73 74 75 |
# File 'lib/gemsmith/configuration.rb', line 73 def create_cli? parse_boolean @create_cli, :create, :cli, false end |
#create_code_climate? ⇒ Boolean
105 106 107 |
# File 'lib/gemsmith/configuration.rb', line 105 def create_code_climate? parse_boolean @create_code_climate, :create, :code_climate, true end |
#create_gemnasium? ⇒ Boolean
109 110 111 |
# File 'lib/gemsmith/configuration.rb', line 109 def create_gemnasium? parse_boolean @create_gemnasium, :create, :gemnasium, true end |
#create_git_hub? ⇒ Boolean
97 98 99 |
# File 'lib/gemsmith/configuration.rb', line 97 def create_git_hub? parse_boolean @create_git_hub, :create, :git_hub, false end |
#create_guard? ⇒ Boolean
89 90 91 |
# File 'lib/gemsmith/configuration.rb', line 89 def create_guard? parse_boolean @create_guard, :create, :guard, true end |
#create_patreon? ⇒ Boolean
117 118 119 |
# File 'lib/gemsmith/configuration.rb', line 117 def create_patreon? parse_boolean @create_patreon, :create, :patreon, true end |
#create_pry? ⇒ Boolean
85 86 87 |
# File 'lib/gemsmith/configuration.rb', line 85 def create_pry? parse_boolean @create_pry, :create, :pry, true end |
#create_rails? ⇒ Boolean
77 78 79 |
# File 'lib/gemsmith/configuration.rb', line 77 def create_rails? parse_boolean @create_rails, :create, :rails, false end |
#create_rspec? ⇒ Boolean
93 94 95 |
# File 'lib/gemsmith/configuration.rb', line 93 def create_rspec? parse_boolean @create_rspec, :create, :rspec, true end |
#create_rubocop? ⇒ Boolean
101 102 103 |
# File 'lib/gemsmith/configuration.rb', line 101 def create_rubocop? parse_boolean @create_rubocop, :create, :rubocop, true end |
#create_security? ⇒ Boolean
81 82 83 |
# File 'lib/gemsmith/configuration.rb', line 81 def create_security? parse_boolean @create_security, :create, :security, true end |
#create_travis? ⇒ Boolean
113 114 115 |
# File 'lib/gemsmith/configuration.rb', line 113 def create_travis? parse_boolean @create_travis, :create, :travis, true end |
#to_h ⇒ Object
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 164 165 166 167 168 169 170 |
# File 'lib/gemsmith/configuration.rb', line 129 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?, git_hub: create_git_hub?, code_climate: create_code_climate?, gemnasium: create_gemnasium?, travis: create_travis?, patreon: create_patreon? } } end |