Class: Sphere::Packager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sphere/packager.rb

Instance Method Summary collapse

Instance Method Details

#compile(type, options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/sphere/packager.rb', line 5

def compile(type, options = {})
  packages(type).values.each do |package|
    package.compile(options)
  end
end

#out_of_date?(type = :all) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
# File 'lib/sphere/packager.rb', line 11

def out_of_date?(type = :all)
  case type
  when :js, :css
    packages(type).values.any?(&:out_of_date?)
  else
    out_of_date?(:js) || out_of_date?(:css)
  end
end

#packages(type) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/sphere/packager.rb', line 20

def packages(type)
  case type
  when :js
    javascripts
  when :css
    stylesheets
  else
    raise "Invalid package type: #{type.inspect}."
  end
end