Class: Compass::Installers::StandAloneInstaller

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

Instance Attribute Summary

Attributes inherited from Base

#manifest, #options, #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, #pattern_name_as_dir, #run, #stylesheet_links, #targetize, #templatize

Methods included from Actions

#basename, #compile, #copy, #directory, #relativize, #remove, #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)


55
56
57
# File 'lib/compass/installers/stand_alone.rb', line 55

def compilation_required?
  true
end

#config_contentsObject



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

def config_contents
  project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil
  Compass.configuration.serialize
ensure
  Compass.configuration.project_path = project_path
end

#config_files_exist?Boolean

Returns:

  • (Boolean)


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

def config_files_exist?
  File.exists? targetize('config.rb')
end

#configuration_defaultsObject

We want to rely on the defaults provided by Configuration



32
33
34
# File 'lib/compass/installers/stand_alone.rb', line 32

def configuration_defaults
  {}
end

#finalize(options = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/compass/installers/stand_alone.rb', line 36

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 "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
  puts stylesheet_links
end

#initObject



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

def init
  directory targetize("")
  super
end

#prepareObject



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

def prepare
  write_configuration_files unless config_files_exist?
end

#write_configuration_files(config_file = nil) ⇒ Object



11
12
13
14
# File 'lib/compass/installers/stand_alone.rb', line 11

def write_configuration_files(config_file = nil)
  config_file ||= targetize('config.rb')
  write_file config_file, config_contents
end