Module: ConfigHelpers

Defined in:
lib/railsbricks/config_helpers.rb

Constant Summary collapse

CONFIG_PATH =
".rbricks"

Class Method Summary collapse

Class Method Details

.create_config(app_dir, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/railsbricks/config_helpers.rb', line 8

def self.create_config(app_dir, options = {})
  FileUtils::mkdir_p "#{app_dir}/#{CONFIG_PATH}"
  dup_options = options.dup
  dup_options[:email_config][:password] = "******"
  saved_options = dup_options.to_json

  File.open("#{app_dir}/#{CONFIG_PATH}/config", "w") { |f| f.write(saved_options)}

end

.load_configObject



18
19
20
21
22
23
24
25
# File 'lib/railsbricks/config_helpers.rb', line 18

def self.load_config
  config_json = File.read("#{CONFIG_PATH}/config")
  JSON.parse(config_json)
rescue
  options = {}
  options["rake_command"] = "rake"
  options
end