Method: Backup::Config.load
- Defined in:
- lib/backup/config.rb
.load(options = {}) ⇒ Object
Loads the user’s config.rb and all model files.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/backup/config.rb', line 21 def load( = {}) update() # from the command line unless File.exist?(config_file) raise Error, "Could not find configuration file: '#{config_file}'." end config = File.read(config_file) version = Backup::VERSION.split('.').first unless config =~ /^# Backup v#{ version }\.x Configuration$/ raise Error, " Invalid Configuration File\n The configuration file at '\#{ config_file }'\n does not appear to be a Backup v\#{ version }.x configuration file.\n If you have upgraded to v\#{ version }.x from a previous version,\n you need to upgrade your configuration file.\n Please see the instructions for upgrading in the Backup documentation.\n EOS\n end\n\n dsl = DSL.new\n dsl.instance_eval(config, config_file)\n\n update(dsl._config_options) # from config.rb\n update(options) # command line takes precedence\n\n Dir[File.join(File.dirname(config_file), 'models', '*.rb')].each do |model|\n dsl.instance_eval(File.read(model), model)\n end\nend\n" |