Class/Module Index [+]

Quicksearch

Compass::AppIntegration::Rails::Installer

Public Instance Methods

completed_configuration() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 13
def completed_configuration
  config = {}
  config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default
  config[:css_dir] = prompt_css_dir unless css_dir_without_default
  config unless config.empty?
end
config_contents() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 114
def config_contents
  project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil
  ("# This configuration file works with both the Compass command line tool and within Rails.\n" +
   Compass.configuration.serialize)
ensure
  Compass.configuration.project_path = project_path
end
finalize(options = {}) click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 48
def finalize(options = {})
  if options[:create]
    puts Congratulations! Your rails project has been configured to use Compass.Just a couple more things left to do.#{gem_config_instructions}Then, make sure you restart your server.Sass will automatically compile your stylesheets during the nextpage request and keep them up to date when they change.
  end
  unless options[:prepare]
    if manifest.has_stylesheet?
      puts "\nNow add these lines to the head of your layout(s):\n\n"
      puts stylesheet_links
    end
  end
end
gem_config_instructions() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 40
def gem_config_instructions
  if rails3?
    %{Add the following to your Gemfile:\n\n    gem "compass", ">= #{Compass::VERSION}"}
  else
    %{Add the following to your environment.rb:\n\n    config.gem "compass", :version => ">= #{Compass::VERSION}"}
  end
end
hamlize?() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 71
def hamlize?
  # XXX Is there a better way to detect haml in a particular rails project?
  require 'haml'
  true
rescue LoadError
  false
end
initializer_contents() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 122
def initializer_contents
  %{require 'compass'
    |require 'compass/app_integration/rails'
    |Compass::AppIntegration::Rails.initialize!
    |}.gsub(/^\s+\|/,'')
end
install_location_for_html(to, options) click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 79
def install_location_for_html(to, options)
  separate("public/#{pattern_name_as_dir}#{to}")
end
prepare() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 36
def prepare
  write_configuration_files
end
prompt_css_dir() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 97
      def prompt_css_dir
        if rails3?
          nil
        else
          recommended_location = separate("public/stylesheets/compiled")
          default_location = separate("public/stylesheets")
          puts
          print %{Compass recommends that you keep your compiled css in #{recommended_location}/
instead the Sass default of #{default_location}/.
However, if you're exclusively using Sass, then #{default_location}/ is recommended.
Emit compiled stylesheets to #{recommended_location}/? (Y/n) }
          answer = $stdin.gets
          answer = answer.downcase[0]
          answer == nn ? default_location : recommended_location
        end
      end
prompt_sass_dir() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 83
      def prompt_sass_dir
        if rails3?
          nil
        else
          recommended_location = separate('app/stylesheets')
          default_location = separate('public/stylesheets/sass')
          print %{Compass recommends that you keep your stylesheets in #{recommended_location}
instead of the Sass default location of #{default_location}.
Is this OK? (Y/n) }
          answer = $stdin.gets.downcase[0]
          answer == nn ? default_location : recommended_location
        end
      end
rails3?() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 32
def rails3?
  File.exists?(targetize('config/application.rb'))
end
stylesheet_prefix() click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 129
def stylesheet_prefix
  if css_dir.length >= 19
    "#{css_dir[19..-1]}/"
  else
    nil
  end
end
write_configuration_files(config_file = nil) click to toggle source
# File lib/compass/app_integration/rails/installer.rb, line 20
def write_configuration_files(config_file = nil)
  config_file ||= targetize('config/compass.rb')
  unless File.exists?(config_file)
    directory File.dirname(config_file)
    write_file config_file, config_contents
  end
  unless rails3?
    directory File.dirname(targetize('config/initializers/compass.rb'))
    write_file targetize('config/initializers/compass.rb'), initializer_contents
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.