Class: Savory::Theme::Packager

Inherits:
Object
  • Object
show all
Defined in:
lib/savory/theme/packager.rb,
lib/savory/theme/packager/features.rb,
lib/savory/theme/packager/features/sass.rb,
lib/savory/theme/packager/features/compass.rb

Defined Under Namespace

Classes: Features

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theme, options = {}) ⇒ Packager

Returns a new instance of Packager.



10
11
12
13
14
15
# File 'lib/savory/theme/packager.rb', line 10

def initialize(theme, options = {})
  @theme = theme
  @options = options
  @verbose = @options.delete(:verbose)
  @features = Features.new(self)
end

Instance Attribute Details

#verboseObject (readonly)

Returns the value of attribute verbose.



8
9
10
# File 'lib/savory/theme/packager.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#bom!Object



26
27
28
# File 'lib/savory/theme/packager.rb', line 26

def bom!
  BOM.create!(@theme)
end

#cleanObject



49
50
51
52
53
# File 'lib/savory/theme/packager.rb', line 49

def clean
  BOM.new(@theme).clean
  @features.clean(@theme)
  @theme.layout.clean
end

#compile!(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/savory/theme/packager.rb', line 17

def compile!(options = {})
  full_version = options.delete(:full_version)
  output_style = options.delete(:output_style)

  @features.apply!(@theme, :output_style => output_style)

  puts "Theme CSS compiled" if @verbose
end

#zip!(zip_name, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/savory/theme/packager.rb', line 30

def zip!(zip_name, options = {})
  @theme.layout.prepare(:zip, @theme.res_home)
  home = Pathname.new(@theme.res_home)
  excludes = options.delete(:exclude)

  paths = {
    'VERSION' => 'config/VERSION',
    'app' => 'app',
    'config' => 'config',
    'data' => 'data',
    home.join(@theme.layout.public_css) => 'public/stylesheets',
    home.join(@theme.layout.public_js) => 'public/javascripts',
    home.join(@theme.layout.public_images) => 'public/images'
  }

  write_zip(zip_name, paths, excludes)
  puts "Theme written to #{zip_name}" if @verbose
end