module MiGA::Common::Path

Public Instance Methods

root_path() click to toggle source

Root path to MiGA (as estimated from the location of the current file).

# File lib/miga/common/path.rb, line 6
def root_path
  File.expand_path('../../../..', __FILE__)
end
script_path(task, opts={}) click to toggle source

Path to a script to be executed for task. Supported opts are:

  • :miga Path to the MiGA home to use. If not passed, the home of the library is used).

  • :project MiGA::Project object to check within plugins. If not passed, only core scripts are supported.

# File lib/miga/common/path.rb, line 16
def script_path(task, opts={})
  opts[:miga] ||= root_path
  unless opts[:project].nil?
    opts[:project].plugins.each do |pl|
      if File.exist? File.expand_path("scripts/#{task}.bash", pl)
        opts[:miga] = pl
      end
    end
  end
  File.expand_path("scripts/#{task}.bash", opts[:miga])
end