Module: TxCatcher::Initializer::ConfigFile
- Defined in:
- lib/txcatcher/initializer.rb
Class Method Summary collapse
- .path ⇒ Object
-
.set!(path = nil) ⇒ Object
Determine config dir or set default.
Class Method Details
.path ⇒ Object
38 39 40 |
# File 'lib/txcatcher/initializer.rb', line 38 def path @@config_file end |
.set!(path = nil) ⇒ Object
Determine config dir or set default. Useful when we want to have different settings for production or staging or development environments.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/txcatcher/initializer.rb', line 20 def set!(path=nil) @@config_file = path and return if path @@config_file = ENV['HOME'] + '/.txcatcher/config.yml' ARGV.each_with_index do |a,i| if a =~ /\A--config-file=.+/ @@config_file = File.(a.sub('--config-file=', '')) ARGV.delete_at(i) break elsif a =~ /\A-c\Z/ @@config_file = File.(ARGV[1]) ARGV.delete_at(i) and ARGV.delete_at(i+1) break end end TxCatcher::Config.config_dir = File.dirname(@@config_file) puts "Using config file: #{@@config_file}" end |