compass-rails-2.0.5/0000755000004100000410000000000012565054112014324 5ustar www-datawww-datacompass-rails-2.0.5/Rakefile0000644000004100000410000000076112565054112015775 0ustar www-datawww-data#!/usr/bin/env rake require 'rubygems' require 'bundler' Bundler.setup require 'rake/dsl_definition' require "bundler/gem_tasks" require 'appraisal' require 'compass' # ----- Default: Testing ------ task :default => [:test] require 'rake/testtask' require 'fileutils' Rake::TestTask.new :test do |t| t.libs << 'lib' t.libs << 'test' test_files = FileList['test/**/*_{test,spec}.rb'] test_files.exclude('test/rails/*', 'test/haml/*') t.test_files = test_files t.verbose = true end compass-rails-2.0.5/Gemfile0000644000004100000410000000045112565054112015617 0ustar www-datawww-datasource 'https://rubygems.org' # Specify your gem's dependencies in compass-rails.gemspec gemspec group :test do gem 'mocha' gem 'appraisal' gem 'minitest' end unless ENV["CI"] gem 'rb-fsevent', :require => false gem 'ruby_gntp', :require => false gem 'guard' gem 'guard-test' end compass-rails-2.0.5/compass-rails.gemspec0000644000004100000410000000172612565054112020454 0ustar www-datawww-data# -*- encoding: utf-8 -*- require File.expand_path('../lib/compass-rails/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Scott Davis", "Chris Eppstein", "Craig McNamara"] gem.email = ["jetviper21@gmail.com", "chris@eppsteins.net", "craig.mcnamara@gmail.com"] gem.description = %q{Integrate Compass into Rails 3.0 and up.} gem.summary = %q{Integrate Compass into Rails 3.0 and up.} gem.homepage = "https://github.com/Compass/compass-rails" gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.name = "compass-rails" gem.require_paths = ["lib"] gem.version = CompassRails::VERSION gem.license = "MIT" gem.add_dependency 'compass', '~> 1.0.0' gem.add_dependency 'sprockets', '< 2.13' gem.add_dependency 'sass-rails', '< 5.1' end compass-rails-2.0.5/.travis.yml0000644000004100000410000000044512565054112016440 0ustar www-datawww-datalanguage: ruby sudo: false rvm: - 1.9.3 - 2.0 - 2.1 - 2.2 - jruby-head - rbx-2.4.1 matrix: allow_failures: - rvm: jruby-head - rvm: rbx-2.4.1 gemfile: - gemfiles/rails31.gemfile - gemfiles/rails32.gemfile - gemfiles/rails40.gemfile - gemfiles/rails42.gemfile compass-rails-2.0.5/lib/0000755000004100000410000000000012565054112015072 5ustar www-datawww-datacompass-rails-2.0.5/lib/compass-rails/0000755000004100000410000000000012565054112017647 5ustar www-datawww-datacompass-rails-2.0.5/lib/compass-rails/configuration.rb0000644000004100000410000000305112565054112023042 0ustar www-datawww-datamodule CompassRails module Configuration def default_images_dir File.join("app", "assets", "images") end def default_fonts_dir File.join("app", "assets", "fonts") end def default_javascripts_dir File.join("app", "assets", "javascripts") end def default_css_dir File.join('public', CompassRails.prefix) end def default_http_path File.join(CompassRails.prefix) end def default_http_images_path "#{top_level.http_path}" end def default_http_javascripts_path "#{top_level.http_path}" end def default_http_fonts_path "#{top_level.http_path}" end def default_http_stylesheets_path "#{top_level.http_path}" end def default_preferred_syntax ::Rails.application.config.sass.preferred_syntax rescue nil end def default_sprite_load_path CompassRails.sprockets.paths end def project_type_without_default :rails end def default_sass_dir File.join("app", "assets", "stylesheets") end def default_http_generated_images_path # Relies on the fact that this will be loaded after the "normal" # defaults, so that method_missing finds http_root_relative http_root_relative "images" end def default_extensions_dir File.join("vendor", "plugins", "compass_extensions") end def default_cache_dir File.join("tmp", "sass-cache") end def default_project_path Rails.root end def default_environment Rails.env end end endcompass-rails-2.0.5/lib/compass-rails/railties/0000755000004100000410000000000012565054112021463 5ustar www-datawww-datacompass-rails-2.0.5/lib/compass-rails/railties/3_1.rb0000644000004100000410000000414612565054112022377 0ustar www-datawww-datamodule CompassRails class Railtie < Rails::Railtie initializer "compass.initialize_rails", :group => :all do |app| require 'compass' require 'compass-rails/patches/3_1' Compass.discover_extensions! CompassRails.configure_rails!(app) end config.compass = begin @compass ||= begin data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file)) config_data else Compass::Configuration::Data.new("rails_config") end data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded. Compass.add_configuration(:rails) Compass.add_configuration(data) Compass.configuration.on_sprite_saved do |filename| if Rails.application.config.assets.digest && # if digesting is enabled caller.grep(/static_compiler/).any? && #OMG HAX - check if we're being precompiled Compass.configuration.generated_images_path[Compass.configuration.images_path] # if the generated images path is not in the assets images directory, we don't have to do these backflips # Clear entries in Hike::Index for this sprite's directory. # This makes sure the asset can be found by find_assets Rails.application.assets.send(:trail).instance_variable_get(:@entries).delete(File.dirname(filename)) pathname = Pathname.new(filename) logical_path = pathname.relative_path_from(Pathname.new(Compass.configuration.images_path)) asset = Rails.application.assets.find_asset(logical_path) target = File.join(Rails.public_path, Rails.application.config.assets.prefix, asset.digest_path) # Adds the asset to the manifest file. Sprockets::StaticCompiler.generated_sprites[logical_path.to_s] = asset.digest_path # Adds the fingerprinted asset to the public directory FileUtils.mkdir_p File.dirname(target) asset.write_to target end end data end end end end compass-rails-2.0.5/lib/compass-rails/railties/4_0.rb0000644000004100000410000000436612565054112022403 0ustar www-datawww-datamodule CompassRails class Railtie < Rails::Railtie initializer "compass.initialize_rails", :group => :all do |app| require 'compass' require 'compass-rails/patches/4_0' Compass.discover_extensions! CompassRails.configure_rails!(app) end config.compass = begin @compass ||= begin data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file)) config_data else Compass::Configuration::Data.new("rails_config") end data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded. Compass.add_configuration(:rails) Compass.add_configuration(data) Compass.configuration.on_sprite_saved do |filename| if Rails.application.config.assets.digest && # if digesting is enabled caller.grep(%r{/sprockets/rails/task.rb}).any? && #OMG HAX - check if we're being precompiled Compass.configuration.generated_images_path[Compass.configuration.images_path.to_s] # if the generated images path is not in the assets images directory, we don't have to do these backflips # Clear entries in Hike::Index for this sprite's directory. # This makes sure the asset can be found by find_assets index = Rails.application.assets.send(:trail).index index.instance_variable_get(:@entries).delete(File.dirname(filename)) index.instance_variable_get(:@stats).delete(filename) pathname = Pathname.new(filename) logical_path = pathname.relative_path_from(Pathname.new(Compass.configuration.images_path)) asset = Rails.application.assets.find_asset(logical_path) target = File.join(Rails.public_path, Rails.application.config.assets.prefix, asset.digest_path) # Adds the asset to the manifest file. manifest = ActionView::Base.assets_manifest manifest.assets[logical_path.to_s] = asset.digest_path # Adds the fingerprinted asset to the public directory FileUtils.mkdir_p File.dirname(target) asset.write_to target end end data end end end end compass-rails-2.0.5/lib/compass-rails/patches/0000755000004100000410000000000012565054112021276 5ustar www-datawww-datacompass-rails-2.0.5/lib/compass-rails/patches/3_1.rb0000644000004100000410000000047112565054112022207 0ustar www-datawww-datarequire 'compass-rails/patches/compass' require 'compass-rails/patches/static_compiler' Compass::Core::SassExtensions::Functions::Urls::GeneratedImageUrl.module_eval do def generated_image_url(path, cache_buster = Sass::Script::Bool.new(false)) asset_url(path, Sass::Script::String.new('image')) end end compass-rails-2.0.5/lib/compass-rails/patches/importer.rb0000644000004100000410000000166312565054112023472 0ustar www-datawww-datarequire 'compass/compiler' module Compass class Compiler attr_accessor :sass_options STYLESHEET = /stylesheet/ def sass_options @sass_options[:custom] ||= {} @sass_options[:custom] = {:resolver => ::Sass::Rails::Resolver.new(CompassRails.context)} @sass_options[:load_paths] ||= [] unless @sass_options[:load_paths].any? {|k| k.is_a?(::Sass::Rails::Importer) } ::Rails.application.assets.paths.each do |path| next unless path.to_s =~ STYLESHEET Dir["#{path}/**/*"].each do |pathname| # args are: sprockets environment, the logical_path ex. 'stylesheets', and the full path name for the render context = ::CompassRails.context.new(::Rails.application.assets, File.basename(path), Pathname.new(pathname)) @sass_options[:load_paths] << ::Sass::Rails::Importer.new(context) end end end @sass_options end end end compass-rails-2.0.5/lib/compass-rails/patches/4_0.rb0000644000004100000410000000240112565054112022202 0ustar www-datawww-datarequire 'compass-rails/patches/compass' require 'compass-rails/patches/sass_importer' require 'compass-rails/patches/sprite_importer' Compass::Core::SassExtensions::Functions::Urls::GeneratedImageUrl.module_eval do def generated_image_url(path, cache_buster = Sass::Script::Bool.new(false)) cachebust_generated_images(path) asset_url(path) end def cachebust_generated_images(path) generated_images_dir = Compass.configuration.generated_images_dir generated_images_dir = Rails.root.join(generated_images_dir) sprockets_env = options[:sprockets][:environment] sprockets_trail = sprockets_env.send(:trail) sprockets_entries = sprockets_trail.instance_variable_get(:@entries) || {} sprockets_stats = sprockets_trail.instance_variable_get(:@stats) || {} if sprockets_entries.key?(generated_images_dir.to_s) path = path.value dir = File.dirname(path) # Delete the entries (directories) which cache the files/dirs in a directory entry = generated_images_dir.join(dir).to_s sprockets_entries.delete(entry) # Delete the stats (file/dir info) which cache the what kind of file/dir each image is stat = generated_images_dir.join(path).to_s sprockets_stats.delete(stat) end end end compass-rails-2.0.5/lib/compass-rails/patches/sass_importer.rb0000644000004100000410000000537412565054112024526 0ustar www-datawww-dataklass = if defined?(Sass::Rails::SassTemplate) Sass::Rails::SassTemplate else Sprockets::SassTemplate end klass.class_eval do def evaluate(context, locals, &block) # Use custom importer that knows about Sprockets Caching cache_store = if defined?(Sprockets::SassCacheStore) Sprockets::SassCacheStore.new(context.environment) else Sprockets::SassProcessor::CacheStore.new(sprockets_cache_store, context.environment) end paths = context.environment.paths.map { |path| CompassRails::SpriteImporter.new(path) } paths += context.environment.paths.map { |path| sass_importer(context, path) } paths += ::Rails.application.config.sass.load_paths options = CompassRails.sass_config.merge( { :filename => eval_file, :line => line, :syntax => syntax, :cache_store => cache_store, :importer => sass_importer(context, context.pathname), :load_paths => paths, :sprockets => { :context => context, :environment => context.environment } }) engine = ::Sass::Engine.new(data, options) engine.dependencies.map do |dependency| filename = dependency.options[:filename] if filename.include?('*') # Handle sprite globs image_path = Rails.root.join(Compass.configuration.images_dir).to_s Dir[File.join(image_path, filename)].each do |f| context.depend_on(f) end else context.depend_on(filename) end end engine.render rescue ::Sass::SyntaxError => e # Annotates exception message with parse line number context.__LINE__ = e.sass_backtrace.first[:line] raise e end private def sass_importer_artiy @sass_importer_artiy ||= sass_importer_class.instance_method(:initialize).arity end def sass_importer(context, path) case sass_importer_artiy.abs when 1 sass_importer_class.new(path) else sass_importer_class.new(context, path) end end # if using haml-rails, self.class.parent = Haml::Filters (which doesn't have an implementation) def sass_importer_class @sass_importer_class ||= if defined?(self.class.parent::SassImporter) self.class.parent::SassImporter elsif defined?(Sass::Rails::SassTemplate) Sass::Rails::SassImporter else Sprockets::SassImporter end end def sprockets_cache_store case Rails.application.config.assets.cache_store when :null_store Sprockets::Cache::NullStore.new when :memory_store, :mem_cache_store Sprockets::Cache::MemoryStore.new else Sprockets::Cache::FileStore.new(Dir::tmpdir) end end end compass-rails-2.0.5/lib/compass-rails/patches/sprite_importer.rb0000644000004100000410000000122612565054112025053 0ustar www-datawww-datarequire 'sprockets' require 'compass/sprite_importer' module CompassRails class SpriteImporter < Compass::SpriteImporter attr_reader :root def initialize(root) @root = root end def find(uri, options) if old = super(uri, options) context = options[:sprockets][:context] self.class.files(uri).each do |file| relative_path = Pathname.new(file).relative_path_from(Pathname.new(root)) begin pathname = context.resolve(relative_path) context.depend_on_asset(pathname) rescue Sprockets::FileNotFound end end end old end end end compass-rails-2.0.5/lib/compass-rails/patches/compass.rb0000644000004100000410000000045012565054112023267 0ustar www-datawww-dataCompass::Core::SassExtensions::Functions::ImageSize.class_eval do private def image_path_for_size(image_file) begin file = ::Rails.application.assets.find_asset(image_file) return file rescue ::Sprockets::FileOutsidePaths return super(image_file) end end end compass-rails-2.0.5/lib/compass-rails/patches/static_compiler.rb0000644000004100000410000000052712565054112025010 0ustar www-datawww-datarequire 'sprockets/static_compiler' module Sprockets class StaticCompiler cattr_accessor :generated_sprites self.generated_sprites = {} def write_manifest_with_sprites(manifest) write_manifest_without_sprites(manifest.merge(self.class.generated_sprites)) end alias_method_chain :write_manifest, :sprites end end compass-rails-2.0.5/lib/compass-rails/patches.rb0000644000004100000410000000014112565054112021617 0ustar www-datawww-dataif CompassRails.rails31? || CompassRails.rails32? require 'compass-rails/patches/importer' end compass-rails-2.0.5/lib/compass-rails/version.rb0000644000004100000410000000013712565054112021662 0ustar www-datawww-datamodule CompassRails unless defined?(::CompassRails::VERSION) VERSION = "2.0.5" end end compass-rails-2.0.5/lib/compass-rails/railties.rb0000644000004100000410000000025412565054112022011 0ustar www-datawww-dataif defined?(::Rails) if CompassRails.rails31? || CompassRails.rails32? require "compass-rails/railties/3_1" else require "compass-rails/railties/4_0" end end compass-rails-2.0.5/lib/compass-rails.rb0000644000004100000410000000647512565054112020210 0ustar www-datawww-datarequire 'compass' require "compass-rails/version" require "compass-rails/configuration" module CompassRails RAILS_32 = %r{^3.2} RAILS_31 = %r{^3.1} extend self def setup_fake_rails_env_paths(sprockets_env) return unless rails_loaded? keys = ['app/assets', 'lib/assets', 'vendor/assets'] local = keys.map {|path| ::Rails.root.join(path) }.map { |path| [File.join(path, 'images'), File.join(path, 'stylesheets')] }.flatten! sprockets_env.send(:trail).paths.unshift(*local) paths = [] ::Rails::Engine.subclasses.each do |subclass| paths = subclass.paths keys.each do |key| sprockets_env.send(:trail).paths.unshift(*paths[key].existent_directories) end end end def sass_config ::Rails.application.config.sass end def sprockets @sprockets ||= ::Rails.application.assets end def context @context ||= begin sprockets.version = ::Rails.env + "-#{sprockets.version}" setup_fake_rails_env_paths(sprockets) context = ::Rails.application.assets.context_class context.extend(::Sprockets::Helpers::IsolatedHelper) context.extend(::Sprockets::Helpers::RailsHelper) context.extend(::Sass::Rails::Railtie::SassContext) context.sass_config = sass_config context end end def rails_loaded? defined?(::Rails) end def rails_version rails_spec = (Gem.loaded_specs["railties"] || Gem.loaded_specs["rails"]) raise "You have to require Rails before compass" unless rails_spec rails_spec.version.to_s end def rails31? return false unless defined?(::Rails) version_match RAILS_31 end def rails32? return false unless defined?(::Rails) version_match RAILS_32 end def version_match(version) !(rails_version =~ version).nil? end def configuration config = Compass::Configuration::Data.new('rails') config.extend(CompassRails::Configuration) config end def prefix ::Rails.application.config.assets.prefix end def configure_rails!(app) return unless app.config.respond_to?(:sass) sass_config = app.config.sass compass_config = app.config.compass sass_config.load_paths.concat(compass_config.sass_load_paths) { :output_style => :style, :line_comments => :line_comments, :cache => :cache, :disable_warnings => :quiet, :preferred_syntax => :preferred_syntax }.each do |compass_option, sass_option| set_maybe sass_config, compass_config, sass_option, compass_option end if compass_config.sass_options compass_config.sass_options.each do |config, value| sass_config.send("#{config}=", value) end end end private # sets the sass config value only if the corresponding compass-based setting # has been explicitly set by the user. def set_maybe(sass_config, compass_config, sass_option, compass_option) if compass_value = compass_config.send(:"#{compass_option}_without_default") sass_config.send(:"#{sass_option}=", compass_value) end end end if defined?(::Rails) Compass::AppIntegration.register(:rails, "::CompassRails") require "compass-rails/patches" require "compass-rails/railties" end compass-rails-2.0.5/gemfiles/0000755000004100000410000000000012565054112016117 5ustar www-datawww-datacompass-rails-2.0.5/gemfiles/rails31.gemfile0000644000004100000410000000045612565054112020734 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "rb-fsevent", :require => false gem "ruby_gntp", :require => false gem "guard" gem "guard-test" gem "rails", "3.1.3" gem "sass-rails" group :test do gem "mocha" gem "appraisal" gem "minitest" end gemspec :path => "../" compass-rails-2.0.5/gemfiles/rails40.gemfile0000644000004100000410000000046112565054112020730 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "rb-fsevent", :require => false gem "ruby_gntp", :require => false gem "guard" gem "guard-test" gem "rails", "~> 4.0.0" gem "sass-rails" group :test do gem "mocha" gem "appraisal" gem "minitest" end gemspec :path => "../" compass-rails-2.0.5/gemfiles/rails42.gemfile0000644000004100000410000000047312565054112020735 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "rb-fsevent", :require => false gem "ruby_gntp", :require => false gem "guard" gem "guard-test" gem "rails", "~> 4.2.0" gem "sass-rails", "~> 5.0" group :test do gem "mocha" gem "appraisal" gem "minitest" end gemspec :path => "../" compass-rails-2.0.5/gemfiles/rails32.gemfile0000644000004100000410000000045712565054112020736 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "rb-fsevent", :require => false gem "ruby_gntp", :require => false gem "guard" gem "guard-test" gem "rails", "~> 3.2" gem "sass-rails" group :test do gem "mocha" gem "appraisal" gem "minitest" end gemspec :path => "../" compass-rails-2.0.5/metadata.yml0000644000004100000410000001000012565054112016616 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: compass-rails version: !ruby/object:Gem::Version version: 2.0.5 platform: ruby authors: - Scott Davis - Chris Eppstein - Craig McNamara autorequire: bindir: bin cert_chain: [] date: 2015-08-15 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: compass requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.0.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.0.0 - !ruby/object:Gem::Dependency name: sprockets requirement: !ruby/object:Gem::Requirement requirements: - - "<" - !ruby/object:Gem::Version version: '2.13' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "<" - !ruby/object:Gem::Version version: '2.13' - !ruby/object:Gem::Dependency name: sass-rails requirement: !ruby/object:Gem::Requirement requirements: - - "<" - !ruby/object:Gem::Version version: '5.1' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "<" - !ruby/object:Gem::Version version: '5.1' description: Integrate Compass into Rails 3.0 and up. email: - jetviper21@gmail.com - chris@eppsteins.net - craig.mcnamara@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".travis.yml" - Appraisals - CHANGELOG.md - Gemfile - Guardfile - LICENSE - README.md - Rakefile - compass-rails.gemspec - gemfiles/rails31.gemfile - gemfiles/rails32.gemfile - gemfiles/rails40.gemfile - gemfiles/rails42.gemfile - lib/compass-rails.rb - lib/compass-rails/configuration.rb - lib/compass-rails/patches.rb - lib/compass-rails/patches/3_1.rb - lib/compass-rails/patches/4_0.rb - lib/compass-rails/patches/compass.rb - lib/compass-rails/patches/importer.rb - lib/compass-rails/patches/sass_importer.rb - lib/compass-rails/patches/sprite_importer.rb - lib/compass-rails/patches/static_compiler.rb - lib/compass-rails/railties.rb - lib/compass-rails/railties/3_1.rb - lib/compass-rails/railties/4_0.rb - lib/compass-rails/version.rb - sache.json - test/compass_rails_spec.rb - test/fixtures/.gitkeep - test/fixtures/assets/images/letters/a.png - test/fixtures/assets/images/letters/b.png - test/fixtures/assets/images/numbers/sprite-1.png - test/fixtures/assets/images/numbers/sprite-2.png - test/fixtures/assets/stylesheets/application.css.scss - test/fixtures/assets/stylesheets/partials/_partial_1.scss - test/fixtures/assets/stylesheets/partials/_partial_2.scss - test/helpers/command_helper.rb - test/helpers/debug_helper.rb - test/helpers/file_helper.rb - test/helpers/rails_helper.rb - test/helpers/rails_project.rb - test/test_helper.rb homepage: https://github.com/Compass/compass-rails licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.2.2 signing_key: specification_version: 4 summary: Integrate Compass into Rails 3.0 and up. test_files: - test/compass_rails_spec.rb - test/fixtures/.gitkeep - test/fixtures/assets/images/letters/a.png - test/fixtures/assets/images/letters/b.png - test/fixtures/assets/images/numbers/sprite-1.png - test/fixtures/assets/images/numbers/sprite-2.png - test/fixtures/assets/stylesheets/application.css.scss - test/fixtures/assets/stylesheets/partials/_partial_1.scss - test/fixtures/assets/stylesheets/partials/_partial_2.scss - test/helpers/command_helper.rb - test/helpers/debug_helper.rb - test/helpers/file_helper.rb - test/helpers/rails_helper.rb - test/helpers/rails_project.rb - test/test_helper.rb has_rdoc: compass-rails-2.0.5/test/0000755000004100000410000000000012565054112015303 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/0000755000004100000410000000000012565054112017154 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/.gitkeep0000644000004100000410000000000012565054112020573 0ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/0000755000004100000410000000000012565054112020456 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/images/0000755000004100000410000000000012565054112021723 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/images/numbers/0000755000004100000410000000000012565054112023376 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/images/numbers/sprite-2.png0000644000004100000410000000047512565054112025557 0ustar www-datawww-dataPNG  IHDR;0sBIT|d pHYs  ~tEXtSoftwareAdobe Fireworks CS4ӠtEXtCreation Time1/6/15QIDATH hFhFpFhFhFh!L!MOOQ#"ԈZncƘ+¯G``u`zm\'>-wt-˦wޡC*z^H,o)Xis'LVXw;sIENDB`compass-rails-2.0.5/test/fixtures/assets/images/numbers/sprite-1.png0000644000004100000410000000044512565054112025553 0ustar www-datawww-dataPNG  IHDR;0sBIT|d pHYs  ~tEXtSoftwareAdobe Fireworks CS4ӠtEXtCreation Time1/6/15QIDATH ?8#t#tPI<(j@EUe:^[ DW\|Gp4$`[v3W`qA~Qת$Og_yz;<$:2U "IENDB`compass-rails-2.0.5/test/fixtures/assets/images/letters/0000755000004100000410000000000012565054112023405 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/images/letters/b.png0000644000004100000410000000125012565054112024332 0ustar www-datawww-dataPNG  IHDR<<:rsBIT|d pHYs  ~tEXtCreation Time1/7/15餏tEXtSoftwareAdobe Fireworks CS4ӠIDAThQ0z ؀:#P7pNlN nP6h'?PhMgw. ~Du]s(.k}]}'N ;AwL;(lꖺ/@ݲe@++hK) MxG] ?A`s=sw_W@~X!KDp,L7D MZIxll$Vhr:ix*<9+пp IE@塉㔍;Ac*ppGWW3W5s+᜽Iic|r]89R:5ks."ˇ  `_ o - WT6hY0&\`. 6a0/G^ ;Ep*ڄ3'H]ܤ3 ~pZ.G.] 埩nGW#~|QV74t y`s^@ [9sʰ> pHcL䥯(+HAݫRX3t3`r aעR`_9+pfQLp?4iµӄk N&\;jkM^IENDB`compass-rails-2.0.5/test/fixtures/assets/stylesheets/0000755000004100000410000000000012565054112023032 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/stylesheets/application.css.scss0000644000004100000410000000064712565054112027030 0ustar www-datawww-data// Import Compass @import "compass"; // Glob import SCSS partials @import "partials/*"; // Import Sprites @import "letters/*.png"; @include all-letters-sprites; // Inline Sprites $numbers-inline: true; @import "numbers/sprite-*.png"; @include all-numbers-sprites; // Try out some compass stuff body{ @include background-image(linear-gradient(white, #aaaaaa)); container{ @include border-radius(4px, 4px); } }compass-rails-2.0.5/test/fixtures/assets/stylesheets/partials/0000755000004100000410000000000012565054112024651 5ustar www-datawww-datacompass-rails-2.0.5/test/fixtures/assets/stylesheets/partials/_partial_1.scss0000644000004100000410000000003612565054112027560 0ustar www-datawww-data.partial1 { display: none; }compass-rails-2.0.5/test/fixtures/assets/stylesheets/partials/_partial_2.scss0000644000004100000410000000003612565054112027561 0ustar www-datawww-data.partial2{ display: block; }compass-rails-2.0.5/test/test_helper.rb0000644000004100000410000000070712565054112020152 0ustar www-datawww-datarequire 'minitest/autorun' require 'compass-rails' require 'active_support/all' module CompassRails module Test ROOT_PATH = File.expand_path('../../', __FILE__) def self.root Pathname.new(ROOT_PATH) end end end %w(debug file command rails).each do |helper| require File.join(File.expand_path('../', __FILE__), 'helpers', "#{helper}_helper") end require File.join(File.expand_path('../', __FILE__), 'helpers', "rails_project") compass-rails-2.0.5/test/helpers/0000755000004100000410000000000012565054112016745 5ustar www-datawww-datacompass-rails-2.0.5/test/helpers/debug_helper.rb0000644000004100000410000000026012565054112021715 0ustar www-datawww-datamodule CompassRails module Test module DebugHelper def debug(message) puts "#{message}\n" if ENV['DEBUG'] $stdout.flush end end end end compass-rails-2.0.5/test/helpers/rails_project.rb0000644000004100000410000000334312565054112022135 0ustar www-datawww-datamodule CompassRails module Test class RailsProject include FileHelper include DebugHelper include CommandHelper include RailsHelpers include Kernal::Captures APPLICATION_FILE = 'config/application.rb' attr_reader :directory, :version def initialize(directory, version) @directory = Pathname.new(directory) @version = version end ## FILE METHODS def to_s directory_name end def directory_name File.basename(directory) end def file(path) directory.join(path) end # RAILS METHODS def boots? rails_property("compass.project_type") == "rails" end def precompile! run_command("rake assets:precompile", GEMFILES[version]) end def setup_asset_fixtures! rm_rf file("app/assets") cp_r CompassRails::Test.root.join('test', 'fixtures', 'assets'), file("app") end def precompiled?(path) !Dir[asset_path(path)].empty? end def compiled_stylesheet(path, &block) File.open(asset_path(path)).read.tap do |css| debug(css) yield css if block_given? end end def asset_path(path_pattern) Dir[file(path_pattern)].first.tap do |asset| raise 'Asset not found' if asset.nil? end end def rails_property(key) rails_command(['runner', "'puts Rails.application.config.#{key}'"]).chomp end def set_rails(property, value) value = "\n config.#{property} = #{value.inspect}\n" inject_into_file(directory.join(APPLICATION_FILE), value, :after, 'class Application < Rails::Application') end end end end compass-rails-2.0.5/test/helpers/file_helper.rb0000644000004100000410000000212012565054112021543 0ustar www-datawww-datamodule CompassRails module Test module FileHelper include DebugHelper delegate :mkdir_p, :rm, :rm_rf, :cp_r, :touch, to: ::FileUtils def cd(path, &block) debug "Entering: #{path}" Dir.chdir(path, &block) end def inject_at_bottom(file_name, string) content = File.read(file_name) content = "#{content}#{string}" File.open(file_name, 'w') { |file| file << content } end def inject_into_file(file_name, replacement, position, anchor) case position when :after replace(file_name, Regexp.escape(anchor), "#{anchor}#{replacement}") when :before replace(file_name, Regexp.escape(anchor), "#{replacement}#{anchor}") else raise Compass::FilesystemConflict.new("You need to specify :before or :after") end end def replace(destination, regexp, string) content = File.read(destination) content.gsub!(Regexp.new(regexp), string) File.open(destination, 'wb') { |file| file.write(content) } end end end end compass-rails-2.0.5/test/helpers/command_helper.rb0000644000004100000410000000414312565054112022251 0ustar www-datawww-datarequire 'appraisal' require 'appraisal/command' module Kernal module Captures def capture_output buffer = [] real_stdout, $stdout = $stdout, StringIO.new buffer << yield buffer << $stdout.string return buffer.join ensure $stdout = real_stdout end def capture_all_output capture_output do capture_warning do yield end end end def capture_warning buffer = [] real_stderr, $stderr = $stderr, StringIO.new buffer << yield buffer << $stderr.string return buffer.join ensure $stderr = real_stderr end end end include Kernal::Captures module CompassRails module Test module CommandHelper include DebugHelper GEMFILES_DIR = Pathname.new(ROOT_PATH).join('gemfiles') BUNDLER_COMMAND = 'bundle' def run_command(command, gemfile=nil) debug "Running: #{command} with gemfile: #{gemfile}" capture_all_output { CompassRails::Test::CommandRunner.new(command, gemfile).run } end def bundle(gemfile=nil) run_command(BUNDLER_COMMAND, gemfile) end end end end # Executes commands with a clean environment class CompassRails::Test::CommandRunner BUNDLER_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).freeze def self.from_args(gemfile) command = ([$0] + ARGV.slice(1, ARGV.size)).join(' ') new(command, gemfile) end def initialize(command, gemfile = nil) @original_env = {} @gemfile = gemfile if command =~ /^bundle/ @command = command else @command = "bundle exec #{command}" end end def run with_clean_env { %x{#{@command}} } end def exec with_clean_env { Kernel.exec(@command) } end private def with_clean_env unset_bundler_env_vars ENV['BUNDLE_GEMFILE'] = @gemfile yield ensure restore_env end def unset_bundler_env_vars BUNDLER_ENV_VARS.each do |key| @original_env[key] = ENV[key] ENV[key] = nil end end def restore_env @original_env.each { |key, value| ENV[key] = value } end end compass-rails-2.0.5/test/helpers/rails_helper.rb0000644000004100000410000000362512565054112021751 0ustar www-datawww-datamodule CompassRails module Test module RailsHelpers include FileHelper include DebugHelper include CommandHelper RAILS_4_2 = "4.2" RAILS_4_0 = "4.0" RAILS_3_2 = "3.2" RAILS_3_1 = "3.1" WORKING_DIR = File.join(ROOT_PATH, 'rails-temp') VERSION_LOOKUP = { RAILS_4_2 => %r{^4\.2\.}, RAILS_4_0 => %r{^4\.0\.}, RAILS_3_2 => %r{^3\.2\.}, RAILS_3_1 => %r{^3\.1\.}, } GEMFILES = { RAILS_4_2 => GEMFILES_DIR.join("rails42.gemfile").to_s, RAILS_4_0 => GEMFILES_DIR.join("rails40.gemfile").to_s, RAILS_3_2 => GEMFILES_DIR.join("rails32.gemfile").to_s, RAILS_3_1 => GEMFILES_DIR.join("rails31.gemfile").to_s } GENERATOR_OPTIONS = ['-q', '-G', '-O', '--skip-bundle'] def rails_command(options) debug cmd = "rails #{options.join(' ')}" run_command(cmd, GEMFILES[rails_version]) end def rails_version @rails_version ||= VERSION_LOOKUP.detect { |version, regex| CompassRails.version_match(regex) }.first end # Generate a rails application without polluting our current set of requires # with the rails libraries. This will allow testing against multiple versions of rails # by manipulating the load path. def generate_rails_app(name, options = []) options += GENERATOR_OPTIONS rails_command(['new', name, *options]) end def within_rails_app(named, &block) dir = "#{named}-#{rails_version}" rm_rf File.join(WORKING_DIR, dir) mkdir_p WORKING_DIR cd(WORKING_DIR) do generate_rails_app(dir, []) cd(dir) do yield RailsProject.new(File.join(WORKING_DIR, dir), rails_version) end end rm_rf File.join(WORKING_DIR, dir) unless ENV['DEBUG_COMPILE'] end end end end compass-rails-2.0.5/test/compass_rails_spec.rb0000644000004100000410000000241312565054112021501 0ustar www-datawww-datarequire 'test_helper' describe CompassRails do include CompassRails::Test::RailsHelpers it "compiles a basic compass stylesheet" do within_rails_app('test_railtie') do |project| project.setup_asset_fixtures! assert project.boots? project.precompile! project.compiled_stylesheet 'public/assets/application*.css' do |css| refute css.empty? assert_match 'body container', css assert_match "-webkit-linear-gradient", css assert_match "-moz-border-radius", css assert_match '.numbers-sprite-1', css assert_match '.numbers-sprite-2', css assert_match '.letters-a', css assert_match '.letters-a', css end end end it "supports rails config arguments" do within_rails_app('test_railtie') do |project| assert_equal "scss", project.rails_property("sass.preferred_syntax") assert_equal "public/assets", project.rails_property("compass.css_dir") project.set_rails('sass.preferred_syntax', :sass) project.set_rails('compass.css_dir', "public/stylesheets") assert_equal "sass", project.rails_property("sass.preferred_syntax") assert_equal "public/stylesheets", project.rails_property("compass.css_dir") end end unless ENV['DEBUG_COMPILE'] endcompass-rails-2.0.5/sache.json0000644000004100000410000000016412565054112016303 0ustar www-datawww-data{ "name": "compass-rails", "description": "compass rails integration", "tags": ["ruby", "rails", "compass"] } compass-rails-2.0.5/.gitignore0000644000004100000410000000030512565054112016312 0ustar www-datawww-data*.gem *.rbc .bundle .idea .config .yardoc gemfiles/*.gemfile.lock Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp rails-temp/* compass-rails-2.0.5/LICENSE0000644000004100000410000000205312565054112015331 0ustar www-datawww-dataCopyright (c) 2011 Scott Davis MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.compass-rails-2.0.5/Appraisals0000644000004100000410000000044412565054112016350 0ustar www-datawww-dataappraise "rails31" do gem "rails", "3.1.3" gem "sass-rails" end appraise "rails32" do gem "rails", "~> 3.2" gem "sass-rails" end appraise "rails40" do gem "rails", "~> 4.0.0" gem "sass-rails" end appraise "rails42" do gem "rails", "~> 4.2.0" gem "sass-rails", "~> 5.0" end compass-rails-2.0.5/CHANGELOG.md0000644000004100000410000000327112565054112016140 0ustar www-datawww-data# Change log ## 2.0.2 - 2015-01-03 - Fixed test suite to test against Rails 3.1, 3.2, 4.0, 4.2 on Ruby 1.9.3, 2.0.0, 2.1.0, 2.2.0 and jruby-head. Issue #206 - Support up to sass-rails 5.0.1. Issue #198 - Fix sass_importer patches having incorrect method signatures. Issue #195 - Fixed incorrect path generation for sprites in Rails 4. Issue #190 ## 2.0.0 - 2014-07-10 ### Added - Support for Rails 4.2 - Allow newer sass-rails with Sass 3.3 support (see #160). ### Removed - Rails 3.0 support. ### Fixed - Properly bust the cache on image sprites within a sub-directory that are imported with a wildcard (see #166). ## 1.1.7 - 2014-03-18 ### Fixed - Locked Sprockets version to 2.11.0 (see #146). ## 1.1.6 - 2014-03-11 ### Fixed - Leave bundle selection to rails environment. ## 1.1.5 - 2014-03-11 ### Added - Support for Ruby 2.1.0. ### Fixed - Fixed `rails_loaded?` for when Rails is defined but no application is actually loaded. ## 1.1.4 - 2014-03-18 ### Changed - Simplified README. ## 1.1.3 - 2013-12-27 ### Fixed - No longer assuming asset pipeline is running when generating sprites. ## 1.1.2 - 2013-12-06 ### Fixed - Reverted fix for `generated_image_url` introduced in 1.1.0. ## 1.1.1 - 2013-12-05 ### Added - Support for Compass versions greater than 0.12.2. ## 1.1.0 - 2013-12-05 ### Added - Rails 4 support. - Ruby 2.0 support. ### Fixed - Allow compass-rails without asset pipeline on Rails 3.2. - Fix `generated_image_url` when `generated_images_dir` is set. ### Removed - Support for Ruby 1.8.7 and 1.9.2. - Support for Rails 2.3. ## 1.0.3 - 2012-06-26 ### Added - Bumped Compass version to 0.12.2. ### Fixed - `FixedStaticCompiler` hack so sprite source files dont show up in manifest. compass-rails-2.0.5/README.md0000644000004100000410000000503112565054112015602 0ustar www-datawww-data# compass-rails **We Take Pull Requests!** [![Build Status](https://travis-ci.org/Compass/compass-rails.png?branch=master)](https://travis-ci.org/Compass/compass-rails) [![Code Climate](https://codeclimate.com/github/Compass/compass-rails.png)](https://codeclimate.com/github/Compass/compass-rails) [![Gem Version](https://badge.fury.io/rb/compass-rails.svg)](http://badge.fury.io/rb/compass-rails) [![Coverage Status](https://coveralls.io/repos/Compass/compass-rails/badge.png)](https://coveralls.io/r/Compass/compass-rails) Compass rails is an adapter for the [Compass Stylesheet Authoring Framework](http://compass-style.org) for [Ruby on Rails](http://rubyonrails.org/). Since Compass v0.12.0, this is the only way to use compass with your rails application. Supports Rails 3.2, 4.x releases. ## Installation Add the `compass-rails` gem line to your application's Gemfile ```ruby gem 'sass-rails' gem 'compass-rails' ``` If you are using any Compass extensions, add them to this group in your Gemfile. And then execute: $ bundle ## Usage Change your `application.css` to `application.css.scss` or `application.css.sass` and then `@import compass` and your own stylesheets to your hearts content. E.g.: ```scss @import "compass"; @import "your_project/mixins"; @import "your_project/base"; ``` *or* Use `application.css` to require files that use compass features. Ex: ```css /* *= require styleguide_full_of_compass_stuff */ ``` *Don't* use `*= require something` within your SCSS or SASS files. You're gonna have a bad time. ### Configuration Compass-rails is configured out of the box to work with Rails. Advanced users can choose to add a `config/compass.rb` and take advantage of the [Compass configuration reference](http://compass-style.org/help/documentation/configuration-reference/) as is. ### Installing Compass extensions Step 1: Add it to your Gemfile and run the `bundle` command to install it. Step 2: Install the extension's assets: `bundle exec compass install ` For example, if you want to use susy. ```ruby # Gemfile gem 'compass-rails' gem 'susy' ``` then run: $ bundle $ bundle exec compass install susy if you are using the rails configuration files you should add: ```ruby config.compass.require "susy" ``` to your application.rb configuration file. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Added some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request compass-rails-2.0.5/Guardfile0000644000004100000410000000037112565054112016152 0ustar www-datawww-data# A sample Guardfile # More info at https://github.com/guard/guard#readme guard :test, :cli => '-v v' do watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } watch(%r{^test/.+_test\.rb$}) watch('test/test_helper.rb') { "test" } end