Module: Redcuine::ConfigSetup

Defined in:
lib/redcuine/config_setup.rb

Class Method Summary collapse

Class Method Details

.runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/redcuine/config_setup.rb', line 8

def run
  unless File.exists?(CONF_FILE)
    template = open(File.dirname(__FILE__) + '/config_template.erb').read
    config = ERB.new(template, nil, '-').result(binding)
    Dir.mkdir(CONF_DIR) unless File.exists?(CONF_DIR)
    File.open(CONF_FILE, 'w', 0600) {|io|
      io << config
    }

    puts "generated: ~/.redcuine/config.yml"
    puts "Please setup it."
    return false
  end
  return true
end