Class: Appium::Thor::Config
- Inherits:
-
Object
- Object
- Appium::Thor::Config
- Includes:
- Singleton
- Defined in:
- lib/appium_thor/config.rb
Class Method Summary collapse
-
.options ⇒ Object
all config.rb options as a symbol array.
-
.set(&block) ⇒ Object
Enables setting config in the Thorfile.
Instance Method Summary collapse
-
#docs_block(&block) ⇒ Object
block of code to execute that contains documentation generation logic.
-
#gem_name(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string.
-
#github_name(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string.
-
#validate ⇒ Object
Returns true if all options are truthy.
-
#version_file(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string.
Class Method Details
.options ⇒ Object
all config.rb options as a symbol array
41 42 43 |
# File 'lib/appium_thor/config.rb', line 41 def self. %w[gem_name github_name version_file docs_block].map(&:to_sym) end |
.set(&block) ⇒ Object
Enables setting config in the Thorfile
Appium::Thor::Config.set do
gem_name 'appium_thor'
github_name 'appium_thor'
version_file 'path/to/version.rb'
end
52 53 54 55 56 57 |
# File 'lib/appium_thor/config.rb', line 52 def self.set &block config = self.instance config.instance_eval &block config.validate config end |
Instance Method Details
#docs_block(&block) ⇒ Object
block of code to execute that contains documentation generation logic
35 36 37 38 |
# File 'lib/appium_thor/config.rb', line 35 def docs_block &block return @docs_block if @docs_block @docs_block = block end |
#gem_name(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string
14 15 16 17 |
# File 'lib/appium_thor/config.rb', line 14 def gem_name string=nil return @gem_name if @gem_name @gem_name = string end |
#github_name(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string
21 22 23 24 |
# File 'lib/appium_thor/config.rb', line 21 def github_name string=nil return @github_name if @github_name @github_name = string end |
#validate ⇒ Object
Returns true if all options are truthy
7 8 9 10 |
# File 'lib/appium_thor/config.rb', line 7 def validate raise 'Must set gem_name, github_name, version_file' unless @gem_name && @github_name && @version_file raise "version file doesn't exist #{@version_file}" unless File.exist?(@version_file) end |
#version_file(string = nil) ⇒ Object
Returns option value if it’s set otherwise sets the option value to string
28 29 30 31 |
# File 'lib/appium_thor/config.rb', line 28 def version_file string=nil return @version_file if @version_file @version_file = string end |