Module: ORS::Config::ModuleMethods
- Included in:
- ORS::Config
- Defined in:
- lib/ors/config.rb
Instance Method Summary collapse
- #parse_config_file ⇒ Object
- #parse_options(options) ⇒ Object
- #valid_environments ⇒ Object
- #valid_options? ⇒ Boolean
Instance Method Details
#parse_config_file ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ors/config.rb', line 28 def parse_config_file if File.exists?(CONFIG_FILENAME) YAML.load(File.read(CONFIG_FILENAME)).each {|(name, value)| send "#{name}=", value } else self.gateway = "deploy-gateway" self.deploy_user = "deployer" self.repo = "ors_git" self.base_path = "/var/www" self.web_servers = %w(koala) self.app_servers = %w(eel jellyfish squid) self.migration_server = "tuna" self.console_server = "tuna" self.cron_server = "tuna" end end |
#parse_options(options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ors/config.rb', line 16 def self.name = name_from_git self.environment = .shift unless .empty? or .first.match(/^-/) .each do |option| case option when "-p", "--pretend" then self.pretending = true when "-ng", "--no-gateway" then self.use_gateway = false end end end |
#valid_environments ⇒ Object
48 49 50 |
# File 'lib/ors/config.rb', line 48 def valid_environments %w(production demo staging) end |
#valid_options? ⇒ Boolean
44 45 46 |
# File 'lib/ors/config.rb', line 44 def name.to_s.size > 0 and valid_environments.include?(environment) end |