Class: Greased::Options
- Inherits:
-
Object
- Object
- Greased::Options
- Defined in:
- lib/greased/options.rb
Constant Summary collapse
- APP_SETTINGS_FILENAME_BASE =
settings applied to application environment
"settings.yml"
- APP_SETTINGS_FILENAME =
"greased_#{APP_SETTINGS_FILENAME_BASE}"
- APP_PATCH_FILENAME_BASE =
additional settings applied to application environment after default Greased (template) settings are applied or custom settings file is applied.
"partial.yml"
- APP_PATCH_FILENAME =
"greased_#{APP_PATCH_FILENAME_BASE}"
- ENV_VARS_FILENAME_BASE =
environment variables to load into ENV
"variables.yml"
- ENV_VARS_FILENAME =
"greased_#{ENV_VARS_FILENAME_BASE}"
- OPTIONS_FILENAME =
options to load from YAML
"greased.yml"
- DEFAULT_OPTIONS_FILE =
Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', OPTIONS_FILENAME)
- DEFAULT_SETTINGS_FILE =
default Greased template with application settings
Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', APP_SETTINGS_FILENAME)
- DEFAULT_ENV =
"development"
Class Method Summary collapse
Class Method Details
.defaults ⇒ Object
29 30 31 |
# File 'lib/greased/options.rb', line 29 def defaults (DEFAULT_OPTIONS_FILE).deep_merge!(:app_filename => DEFAULT_SETTINGS_FILE) end |
.find(path) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/greased/options.rb', line 33 def find(path) #Greased.logger.debug "Find application options in: #{path}" = defaults if Dir.exists? path # load rails defaults = , { #:env => ::Rails.env || DEFAULT_ENV, #:groups => ["application"], :app_filename => [ Greased.file_path(path, APP_SETTINGS_FILENAME), Greased.file_path(path, "greased", APP_SETTINGS_FILENAME_BASE), Greased.file_path(path, "config", APP_SETTINGS_FILENAME), Greased.file_path(path, "config", "greased", APP_SETTINGS_FILENAME_BASE), DEFAULT_SETTINGS_FILE ], :partial_filename => [ Greased.file_path(path, APP_PATCH_FILENAME), Greased.file_path(path, "greased", APP_PATCH_FILENAME_BASE), Greased.file_path(path, "config", APP_PATCH_FILENAME), Greased.file_path(path, "config", "greased", APP_PATCH_FILENAME_BASE) ], :env_filename => [ Greased.file_path(path, ENV_VARS_FILENAME), Greased.file_path(path, "greased", ENV_VARS_FILENAME_BASE), Greased.file_path(path, "config", ENV_VARS_FILENAME), Greased.file_path(path, "config", "greased", ENV_VARS_FILENAME_BASE) ] }, # load custom options ([ Greased.file_path(path, OPTIONS_FILENAME), Greased.file_path(path, "greased", OPTIONS_FILENAME), Greased.file_path(path, "config", OPTIONS_FILENAME), Greased.file_path(path, "config", "greased", OPTIONS_FILENAME) ]) end end |