Method: Ore::Project#within

Defined in:
lib/ore/project.rb

#within(sub_dir = nil) { ... } ⇒ Object

Executes code within the project.

Parameters:

  • sub_dir (String) (defaults to: nil)

    An optional sub-directory within the project to execute from.

Yields:

  • [] The given block will be called once the current working-directory has been switched. Once the block finishes executing, the current working-directory will be switched back.

See Also:



326
327
328
329
330
331
332
333
334
# File 'lib/ore/project.rb', line 326

def within(sub_dir=nil,&block)
  dir = if sub_dir
          @root.join(sub_dir)
        else
          @root
        end

  Dir.chdir(dir,&block)
end