Class: MotionConfig::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-config/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setupObject


3
4
5
6
7
# File 'lib/motion-config/configuration.rb', line 3

def self.setup
  instance = allocate
  instance.custom_initializer
  instance
end

Instance Method Details

#app_configObject


20
21
22
# File 'lib/motion-config/configuration.rb', line 20

def app_config
  @app_config ||= File.expand_path(".motion-config.yml")
end

#custom_initializerObject


9
10
11
12
13
14
# File 'lib/motion-config/configuration.rb', line 9

def custom_initializer
  [app_config, user_config].each do |config|
    create_config_file(config) unless File.exist?(config)
    environmentize parse(config)
  end
end

#user_configObject


16
17
18
# File 'lib/motion-config/configuration.rb', line 16

def user_config
  @user_config ||= File.expand_path("~/.motion-config.yml")
end