Method not available on this version
This method is only available on newer versions. The first available version of the method is shown here.
apply(path, config = {})
public
Loads an external file and execute it in the instance binding.
Parameters
path |
The path to the file to execute. Can be a web address or a relative path
from the source root.
|
Examples
apply "http://gist.github.com/103208"
apply "recipes/jquery.rb"
Show source
def apply(path, config = {})
verbose = config.fetch(:verbose, true)
is_uri = path =~ %{^https?\://}
path = find_in_source_paths(path) unless is_uri
say_status :apply, path, verbose
shell.padding += 1 if verbose
contents = if is_uri
open(path, "Accept" => "application/x-thor-template", &:read)
else
open(path, &:read)
end
instance_eval(contents, path)
shell.padding -= 1 if verbose
end