Method: Vendor::Spec.load

Defined in:
lib/vendor/spec.rb

.load(file) ⇒ Vendor::Spec

Note:

the following method performs an ‘eval` with the source found within the specificed file. This could contain any action native to ruby which may lead to unintended or malicous effects.

Load the specified Vendor specification file. A vendor specification file is simply the Ruby code to generate a specificatio

Returns:

  • (Vendor::Spec)

    the Vendor::Spec parse and evaluated fom the specified file.



17
18
19
20
21
22
23
24
25
26
# File 'lib/vendor/spec.rb', line 17

def self.load(file)
  # Before evaling we need to chdir into the location of the vendorspec. This is
  # so if the vendorfile does any system calls, they're expecting to be in the right
  # right location.
  before = Dir.pwd
  Dir.chdir File.dirname(file)
  spec = eval File.read(file), nil, file
  Dir.chdir before
  spec
end