class Appium::Thor::Config
Public Class Methods
options()
click to toggle source
Returns all options as symbols. Required for defining delegators in init.rb
# File lib/appium_thor/config.rb, line 25 def self.options string_options end
set(&block)
click to toggle source
Enables setting config in the Thorfile
gem_name 'appium_thor' github_owner 'appium' github_name 'appium_thor' branch 'master' version_file 'path/to/version.rb'
end
# File lib/appium_thor/config.rb, line 52 def self.set(&block) config = self.instance config.instance_eval &block config.init_and_validate config end
string_options()
click to toggle source
the subset of options that operate on strings
# File lib/appium_thor/config.rb, line 30 def self.string_options %w[gem_name github_name github_owner branch version_file].map(&:to_sym) end
Public Instance Methods
init_and_validate()
click to toggle source
Returns true if all options are truthy
# File lib/appium_thor/config.rb, line 7 def init_and_validate # set default values if @gem_name @github_name ||= @gem_name @version_file ||= "lib/#{@gem_name}/version.rb" end @branch ||= 'master' @github_owner ||= 'appium' # ensure all options are set all_set = @gem_name && @github_name && @github_owner && @version_file raise 'Must set gem_name, github_name, github_owner, version_file' unless all_set raise "version file doesn't exist #{@version_file}" unless File.exist?(@version_file) end