Class: Bait::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/bait/project.rb

Direct Known Subclasses

ObjectiveC::Project

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Project

Returns a new instance of Project.



3
4
5
6
7
8
# File 'lib/bait/project.rb', line 3

def initialize root_path
  unless Dir.exists? root_path
    raise "Expected a valid directory"
  end
  @path = Pathname.new(root_path)
end

Instance Method Details

#glob(pattern) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/bait/project.rb', line 10

def glob pattern
  cache ||= {}
  if value = cache[pattern]
    value
  else
    cache[pattern] = Dir.glob @path.join("**/#{pattern}")
  end
end

#ordered_dependencies(file_pattern, klass) ⇒ Object



19
20
21
22
23
# File 'lib/bait/project.rb', line 19

def ordered_dependencies file_pattern, klass
  orderer = klass.new(glob(file_pattern), self)
  orderer.start
  orderer.order
end