Module: ORS::Config::ModuleMethods
- Included in:
- ORS::Config
- Defined in:
- lib/ors/config.rb
Instance Method Summary collapse
- #git ⇒ Object
- #parse_config_file ⇒ Object
- #parse_options(options) ⇒ Object
- #valid_environments ⇒ Object
- #valid_options? ⇒ Boolean
Instance Method Details
#git ⇒ Object
54 55 56 |
# File 'lib/ors/config.rb', line 54 def git @git ||= Git.open(Dir.pwd) end |
#parse_config_file ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ors/config.rb', line 30 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
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ors/config.rb', line 17 def self.name = name_from_git self.environment = .shift unless .empty? or .first.match(/^-/) self. = .dup .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
50 51 52 |
# File 'lib/ors/config.rb', line 50 def valid_environments %w(production demo staging) end |
#valid_options? ⇒ Boolean
46 47 48 |
# File 'lib/ors/config.rb', line 46 def name.to_s.size > 0 and valid_environments.include?(environment) end |