class BrickAndMortar::Project

Constants

DEFAULT_BRICK_STORE

Attributes

bricks[R]
config[R]
project_root[R]

Public Class Methods

new(brickfile, brick_store = DEFAULT_BRICK_STORE) click to toggle source
# File lib/brick_and_mortar/project.rb, line 10
def initialize(brickfile, brick_store = DEFAULT_BRICK_STORE)
  @config = Config.new brick_store
  @config.create_store!
  @bricks = @config.parse_file! brickfile
  @project_root = File.dirname(brickfile)
end

Public Instance Methods

laid?() click to toggle source
# File lib/brick_and_mortar/project.rb, line 21
def laid?
  @bricks.reduce(File.exist?(vendor)) do |has_been_laid, brick|
    break has_been_laid unless has_been_laid
    has_been_laid && brick.laid?(vendor)
  end
end
lay!() click to toggle source
# File lib/brick_and_mortar/project.rb, line 28
def lay!
  FileUtils.mkpath vendor
  @bricks.each do |b|
    b.lay! vendor
    sub_brickfile = File.join(b.destination, 'Brickfile')
    if File.file?(sub_brickfile)
      Dir.chdir(b.destination) do |dir|
        subproject = Project.new(sub_brickfile, @config.store)
        subproject.lay!
      end
    end
  end
end
vendor() click to toggle source
# File lib/brick_and_mortar/project.rb, line 17
def vendor
  File.join(@project_root, 'vendor')
end