Method: Sake::TasksFile.parse
- Defined in:
- lib/sake.rb
.parse(file) ⇒ Object
The idea here is that we may be sucking in Rakefiles from an untrusted source. While we’re happy to let the user audit the code of any Rake task before running it, we’d rather not be responsible for executing a ‘rm -rf` in the Rakefile itself. To ensure this, we need to set a safelevel before parsing the Rakefile in question.
331 332 333 334 335 336 337 |
# File 'lib/sake.rb', line 331 def self.parse(file) body = open(file).read instance = new Thread.new { instance.instance_eval "$SAFE = 3\n#{body}" }.join instance end |