Sha256: bfadf742dec161575bd191f0f44b305b0640927ff055a71c6d62b228d4f656b3

Contents?: true

Size: 566 Bytes

Versions: 16

Compression:

Stored size: 566 Bytes

Contents

# Find out if a specific library file was already required
def required?(file)
  rex = Regexp.new("/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
  $LOADED_FEATURES.find { |f| f =~ rex }
end

def any_required?(arr)
  arr.any? { |file| required?(file) }
end

def all_required?(arr)
  arr.all? { |file| required?(file) }
end

def load_task(name, dependencies = [])
  if all_required? dependencies
    load File.join(File.dirname(__FILE__), '..', 'capistrano', 'tasks', "#{name}.rake")
  else
    fail "To load #{name} you need to include #{dependencies.join ", "}"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
negroku-2.8.6 lib/negroku/helpers/tasks.rb
negroku-2.8.5 lib/negroku/helpers/tasks.rb
negroku-2.8.4 lib/negroku/helpers/tasks.rb
negroku-2.8.3 lib/negroku/helpers/tasks.rb
negroku-2.8.2 lib/negroku/helpers/tasks.rb
negroku-2.8.1 lib/negroku/helpers/tasks.rb
negroku-2.8.0 lib/negroku/helpers/tasks.rb
negroku-2.7.1 lib/negroku/helpers/tasks.rb
negroku-2.7.0 lib/negroku/helpers/tasks.rb
negroku-2.6.0 lib/negroku/helpers/tasks.rb
negroku-2.5.5 lib/negroku/helpers/tasks.rb
negroku-2.5.4 lib/negroku/helpers/tasks.rb
negroku-2.5.3 lib/negroku/helpers/tasks.rb
negroku-2.5.2 lib/negroku/helpers/tasks.rb
negroku-2.5.1 lib/negroku/helpers/tasks.rb
negroku-2.5.0 lib/negroku/helpers/tasks.rb