Class: Troops::Configuration
- Inherits:
-
Object
- Object
- Troops::Configuration
- Defined in:
- lib/troops/configuration.rb
Overview
This class will handle all things considering loading and saving configuration. It should work like this.
There are 2 kinds of configurations:
* the project dependent one, has a .troops file with
some configuration for the project
* a user dependent one in the home directory of
the user
Class Method Summary collapse
- .config(environment) ⇒ Object
-
.troops_project_config ⇒ Object
All project dependent config files are stored in ‘.troops`.
-
.troops_user_config ⇒ Object
All user dependent config files are stored in ‘~/.troops`.
-
.yamlize ⇒ Object
Setup the color theme with the hash.
Class Method Details
.config(environment) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/troops/configuration.rb', line 17 def config(environment) config_hash = yamlize if config_hash["team_token"].nil? warn "" warn "=======================================================================================" warn "================================== TROOPS =============================================" warn "=======================================================================================" warn "=== You have to set your TestFlight 'team_token' in your ~/.troops file. ===" warn "=== Here is an example on how the .troop file should look: ===" warn "=== ===" warn "=== team_token: 'thisisyourawesometeamtoken' ===" warn "=== ===" warn "=== You can find your Team Token on your Team Info page on http://testflightapp.com ===" warn "=======================================================================================" warn "=======================================================================================" warn "" elsif config_hash["api_token"].nil? warn "" warn "=============================================================================================" warn "================================== TROOPS ===================================================" warn "=============================================================================================" warn "=== You have to set your TestFlight 'api_token' in your .troops file inside this project. ===" warn "=== Here is an example on how the .troops file should look: ===" warn "=== ===" warn "=== api_token: 'thisisyourawesomeapitoken' ===" warn "=== production: ===" warn "=== configuration: 'Release' ===" warn "=== target: 'The Release iOS App Name' ===" warn "=== staging: ===" warn "=== configuration: 'Ad Hoc' ===" warn "=== target: 'The Ad Hoc iOS App Name' ===" warn "=== ===" warn "=== You can find your Team Token on Your Account page on http://testflightapp.com ===" warn "=============================================================================================" warn "=============================================================================================" warn "" elsif config_hash[environment].nil? warn "" warn "=============================================================================================" warn "================================== TROOPS ===================================================" warn "=============================================================================================" warn "=== You have to set your environment variable in your .troops file. ===" warn "=== Here is an example on how the .troops file should look: ===" warn "=== ===" warn "=== api_token: 'thisisyourawesomeapitoken' ===" warn "=== production: ===" warn "=== configuration: 'Release' ===" warn "=== target: 'The Release iOS App Name' ===" warn "=== staging: ===" warn "=== configuration: 'Ad Hoc' ===" warn "=== target: 'The Ad Hoc iOS App Name' ===" warn "=============================================================================================" warn "=============================================================================================" warn "" else config_hash end end |
.troops_project_config ⇒ Object
All project dependent config files are stored in ‘.troops`
95 96 97 |
# File 'lib/troops/configuration.rb', line 95 def troops_project_config configurize "PWD" end |
.troops_user_config ⇒ Object
All user dependent config files are stored in ‘~/.troops`
90 91 92 |
# File 'lib/troops/configuration.rb', line 90 def troops_user_config configurize "HOME" end |
.yamlize ⇒ Object
Setup the color theme with the hash.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/troops/configuration.rb', line 77 def yamlize user_hash = {} user_hash = YAML::load File.open(troops_user_config) user_hash = {} unless Hash === user_hash project_hash = {} project_hash = YAML::load File.open(troops_project_config) project_hash = {} unless Hash === project_hash project_hash.merge(user_hash) end |