Class Index [+]

Quicksearch

Capistrano::Configuration::Loading

Attributes

load_paths[R]

The load paths used for locating recipe files.

Public Instance Methods

load(*args, &block) click to toggle source

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

Private Instance Methods

find_file_in_load_path(file) click to toggle source
     # File lib/capistrano/configuration/loading.rb, line 175
175:         def find_file_in_load_path(file)
176:           load_paths.each do |path|
177:             ["", ".rb"].each do |ext|
178:               name = File.join(path, "#{file}#{ext}")
179:               return name if File.file?(name)
180:             end
181:           end
182: 
183:           raise LoadError, "no such file to load -- #{file}"
184:         end
load_from_file(file, name=nil) click to toggle source

Load a recipe from the named file. If name is given, the file will be reported using that name.

     # File lib/capistrano/configuration/loading.rb, line 170
170:         def load_from_file(file, name=nil)
171:           file = find_file_in_load_path(file) unless File.file?(file)
172:           load :string => File.read(file), :name => name || file
173:         end
remember_load(options) click to toggle source

If a file is being required, the options associated with loading a recipe are remembered in the recipes_per_feature archive under the name of the file currently being required.

     # File lib/capistrano/configuration/loading.rb, line 189
189:         def remember_load(options)
190:           if self.class.current_feature
191:             list = (self.class.recipes_per_feature[self.class.current_feature] ||= [])
192:             list << options
193:           end
194:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.