| Module | Capistrano::Configuration::Loading |
| In: |
lib/capistrano/configuration/loading.rb
lib/capistrano/configuration/loading.rb |
Load a configuration file or string into this configuration.
Usage:
load("recipe"):
Look for and load the contents of 'recipe.rb' into this
configuration.
load(:file => "recipe"):
same as above
load(:string => "set :scm, :subversion"):
Load the given string as a configuration specification.
load { ... }
Load the block in the context of the configuration.
# File lib/capistrano/configuration/loading.rb, line 78
78: def load(*args, &block)
79: options = args.last.is_a?(Hash) ? args.pop : {}
80:
81: if block
82: raise ArgumentError, "loading a block requires 0 arguments" unless options.empty? && args.empty?
83: load(:proc => block)
84:
85: elsif args.any?
86: args.each { |arg| load options.merge(:file => arg) }
87:
88: elsif options[:file]
89: load_from_file(options[:file], options[:name])
90:
91: elsif options[:string]
92: remember_load(options) unless options[:reloading]
93: instance_eval(options[:string], options[:name] || "<eval>")
94:
95: elsif options[:proc]
96: remember_load(options) unless options[:reloading]
97: instance_eval(&options[:proc])
98:
99: else
100: raise ArgumentError, "don't know how to load #{options.inspect}"
101: end
102: end
Load a configuration file or string into this configuration.
Usage:
load("recipe"):
Look for and load the contents of 'recipe.rb' into this
configuration.
load(:file => "recipe"):
same as above
load(:string => "set :scm, :subversion"):
Load the given string as a configuration specification.
load { ... }
Load the block in the context of the configuration.
# File lib/capistrano/configuration/loading.rb, line 78
78: def load(*args, &block)
79: options = args.last.is_a?(Hash) ? args.pop : {}
80:
81: if block
82: raise ArgumentError, "loading a block requires 0 arguments" unless options.empty? && args.empty?
83: load(:proc => block)
84:
85: elsif args.any?
86: args.each { |arg| load options.merge(:file => arg) }
87:
88: elsif options[:file]
89: load_from_file(options[:file], options[:name])
90:
91: elsif options[:string]
92: remember_load(options) unless options[:reloading]
93: instance_eval(options[:string], options[:name] || "<eval>")
94:
95: elsif options[:proc]
96: remember_load(options) unless options[:reloading]
97: instance_eval(&options[:proc])
98:
99: else
100: raise ArgumentError, "don't know how to load #{options.inspect}"
101: end
102: end