Class: Compass::Installers::StandAloneInstaller

Inherits:
Base
  • Object
show all
Defined in:
lib/compass/installers/stand_alone.rb

Instance Attribute Summary

Attributes inherited from Base

#css_dir, #images_dir, #javascripts_dir, #manifest, #options, #sass_dir, #target_path, #template_path, #working_path

Attributes included from Actions

#logger

Instance Method Summary collapse

Methods inherited from Base

#configure_option_with_default, #initialize, #install, installer, #manifest_file, #run, #stylesheet_links, #targetize, #templatize

Methods included from Actions

#basename, #compile, #copy, #directory, #relativize, #separate, #strip_trailing_separator, #write_file

Constructor Details

This class inherits a constructor from Compass::Installers::Base

Instance Method Details

#compilation_required?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/compass/installers/stand_alone.rb', line 71

def compilation_required?
  true
end

#config_fileObject

Read the configuration file for this project



43
44
45
# File 'lib/compass/installers/stand_alone.rb', line 43

def config_file
  @config_file ||= targetize('config.rb')
end

#configureObject



6
7
8
9
10
11
12
13
# File 'lib/compass/installers/stand_alone.rb', line 6

def configure
  if File.exists?(config_file)
    Compass.configuration.parse(config_file)
  elsif File.exists?(old_config_file)
    Compass.configuration.parse(old_config_file)
  end
  super
end

#default_css_dirObject



26
27
28
# File 'lib/compass/installers/stand_alone.rb', line 26

def default_css_dir
  Compass.configuration.css_dir || "stylesheets"
end

#default_images_dirObject



34
35
36
# File 'lib/compass/installers/stand_alone.rb', line 34

def default_images_dir
  Compass.configuration.images_dir || "images"
end

#default_javascripts_dirObject



38
39
40
# File 'lib/compass/installers/stand_alone.rb', line 38

def default_javascripts_dir
  Compass.configuration.javascripts_dir || "javascripts"
end

#default_sass_dirObject



30
31
32
# File 'lib/compass/installers/stand_alone.rb', line 30

def default_sass_dir
  Compass.configuration.sass_dir ||"src"
end

#finalize(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/compass/installers/stand_alone.rb', line 51

def finalize(options = {})
  if options[:create]
    puts <<-NEXTSTEPS

Congratulations! Your compass project has been created.
You must recompile your sass stylesheets when they change.
This can be done in one of the following ways:
  1. From within your project directory run:
     compass
  2. From any directory run:
     compass -u path/to/project
  3. To monitor your project for changes and automatically recompile:
     compass --watch [path/to/project]

NEXTSTEPS
  end
  puts "To import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
  puts stylesheet_links
end

#initObject



15
16
17
18
19
# File 'lib/compass/installers/stand_alone.rb', line 15

def init
  directory targetize("")
  directory targetize(css_dir)
  directory targetize(sass_dir)
end

#old_config_fileObject



47
48
49
# File 'lib/compass/installers/stand_alone.rb', line 47

def old_config_file
  @old_config_file ||= targetize('src/config.rb')
end

#prepareObject



21
22
23
24
# File 'lib/compass/installers/stand_alone.rb', line 21

def prepare
  directory targetize(images_dir) if manifest.has_image?
  directory targetize(javascripts_dir) if manifest.has_javascript?
end