Class: AssetBuild

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ AssetBuild

Returns a new instance of AssetBuild.



7
8
9
10
# File 'lib/asset_build.rb', line 7

def initialize(path)
  @manifest = YAML::load(File.open(path).readlines.join(""))
  @path = File.dirname(path)
end

Instance Attribute Details

#manifestObject

Returns the value of attribute manifest.



5
6
7
# File 'lib/asset_build.rb', line 5

def manifest
  @manifest
end

Instance Method Details

#process_files!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/asset_build.rb', line 12

def process_files!
  @manifest.each do |destination,options|
    compressed = options["compress"] || false
    if options["type"] == "coffeescript"
      coffee_bundler = CoffeeBundler.new(File.join(@path,options["source"]))
      coffee_bundler.save(File.join(@path,destination),:compress => compressed)
      puts File.join(@path,destination)
    elsif options["type"] == "stylesheet"
      css_reader = CSSReader.new(File.join(@path,options["source"]))
      css_reader.save(File.join(@path,destination),:compress => compressed)
      puts File.join(@path,destination)
    end
  end
end