Class: BotConfig
Instance Method Summary collapse
- #github_access_token ⇒ Object
- #github_repo ⇒ Object
-
#initialize ⇒ BotConfig
constructor
A new instance of BotConfig.
- #param(key) ⇒ Object
- #scm_path ⇒ Object
- #xcode_devices ⇒ Object
- #xcode_project_or_workspace ⇒ Object
- #xcode_scheme ⇒ Object
- #xcode_server_hostname ⇒ Object
Constructor Details
#initialize ⇒ BotConfig
Returns a new instance of BotConfig.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bot_config.rb', line 7 def initialize @filename = File.('~/.bot-sync-github.cfg') if (!File.exists? @filename) $stderr.puts "Missing configuration file #{@filename}" exit 1 end @config = ParseConfig.new(@filename) # Make sure every param is configured properly since param will throw an error for a missing key [:xcode_server, :github_url, :github_repo, :github_access_token, :xcode_devices, :xcode_scheme, :xcode_project_or_workspace].each do |key| param key end end |
Instance Method Details
#github_access_token ⇒ Object
26 27 28 |
# File 'lib/bot_config.rb', line 26 def github_access_token param :github_access_token end |
#github_repo ⇒ Object
34 35 36 |
# File 'lib/bot_config.rb', line 34 def github_repo param :github_repo end |
#param(key) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/bot_config.rb', line 50 def param(key) value = @config[key.to_s] if (value.nil?) $stderr.puts "Missing configuration key #{key} in #{@filename}" exit 1 end value end |
#scm_path ⇒ Object
30 31 32 |
# File 'lib/bot_config.rb', line 30 def scm_path param :github_url end |
#xcode_devices ⇒ Object
38 39 40 |
# File 'lib/bot_config.rb', line 38 def xcode_devices param(:xcode_devices).split('|') end |
#xcode_project_or_workspace ⇒ Object
46 47 48 |
# File 'lib/bot_config.rb', line 46 def xcode_project_or_workspace param :xcode_project_or_workspace end |
#xcode_scheme ⇒ Object
42 43 44 |
# File 'lib/bot_config.rb', line 42 def xcode_scheme param :xcode_scheme end |
#xcode_server_hostname ⇒ Object
22 23 24 |
# File 'lib/bot_config.rb', line 22 def xcode_server_hostname param :xcode_server end |