glebtv-compass-rails 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +22 -0
  4. data/CHANGELOG.md +71 -0
  5. data/Gemfile +17 -0
  6. data/LICENSE +22 -0
  7. data/README.md +97 -0
  8. data/Rakefile +25 -0
  9. data/gemfiles/rails31.gemfile +18 -0
  10. data/gemfiles/rails32.gemfile +18 -0
  11. data/gemfiles/rails40.gemfile +18 -0
  12. data/gemfiles/rails42.gemfile +18 -0
  13. data/glebtv-compass-rails.gemspec +21 -0
  14. data/lib/compass-rails.rb +107 -0
  15. data/lib/compass-rails/configuration.rb +77 -0
  16. data/lib/compass-rails/patches.rb +33 -0
  17. data/lib/compass-rails/patches/compass.rb +12 -0
  18. data/lib/compass-rails/patches/importer.rb +24 -0
  19. data/lib/compass-rails/patches/sass_importer.rb +90 -0
  20. data/lib/compass-rails/patches/sprite_importer.rb +30 -0
  21. data/lib/compass-rails/patches/static_compiler.rb +12 -0
  22. data/lib/compass-rails/railtie.rb +51 -0
  23. data/lib/compass-rails/version.rb +5 -0
  24. data/lib/glebtv-compass-rails.rb +1 -0
  25. data/test/compass_rails_spec.rb +39 -0
  26. data/test/fixtures/.gitkeep +0 -0
  27. data/test/fixtures/assets/images/letters/a.png +0 -0
  28. data/test/fixtures/assets/images/letters/b.png +0 -0
  29. data/test/fixtures/assets/images/numbers/sprite-1.png +0 -0
  30. data/test/fixtures/assets/images/numbers/sprite-2.png +0 -0
  31. data/test/fixtures/assets/stylesheets/application.css.scss +23 -0
  32. data/test/fixtures/assets/stylesheets/partials/_partial_1.scss +3 -0
  33. data/test/fixtures/assets/stylesheets/partials/_partial_2.scss +3 -0
  34. data/test/helpers/command_helper.rb +105 -0
  35. data/test/helpers/debug_helper.rb +12 -0
  36. data/test/helpers/file_helper.rb +38 -0
  37. data/test/helpers/rails_helper.rb +53 -0
  38. data/test/helpers/rails_project.rb +76 -0
  39. data/test/test_helper.rb +20 -0
  40. metadata +128 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c70b7af75a22afa69db8576a2c9cf5ee32884c84
4
+ data.tar.gz: 6723ee8fe48669a0890e4897510a7ad51ddbf516
5
+ SHA512:
6
+ metadata.gz: 338a3b54c1aa5554185416452aa0364e967efc9cf4827bbabfd01df19793fcb4f733cad1093ec5ffabff38205f8007794d36f0cb0caff93f5ca634cfb4b03e08
7
+ data.tar.gz: d9cdc4a1d0ce9004d3cc269c50ee8b399e2e15f4519bec8a5d31ad1a128d95b906d0fca7aaa6050ac2d58ff899e8de0f607ae0544ec9e84d229b62f1c60e1f00
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .idea
5
+ .config
6
+ .yardoc
7
+ gemfiles/*.gemfile.lock
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ rails-temp/*
@@ -0,0 +1,22 @@
1
+ language: ruby
2
+
3
+ sudo: false
4
+
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0
8
+ - 2.1
9
+ - 2.2
10
+ - jruby-head
11
+ - rbx-2.4.1
12
+
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: jruby-head
16
+ - rvm: rbx-2.4.1
17
+
18
+ gemfile:
19
+ - gemfiles/rails31.gemfile
20
+ - gemfiles/rails32.gemfile
21
+ - gemfiles/rails40.gemfile
22
+ - gemfiles/rails42.gemfile
@@ -0,0 +1,71 @@
1
+ # Change log
2
+
3
+ ## 2.0.2 - 2015-01-03
4
+
5
+ - 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
6
+ - Support up to sass-rails 5.0.1. Issue #198
7
+ - Fix sass_importer patches having incorrect method signatures. Issue #195
8
+ - Fixed incorrect path generation for sprites in Rails 4. Issue #190
9
+
10
+ ## 2.0.0 - 2014-07-10
11
+ ### Added
12
+ - Support for Rails 4.2
13
+ - Allow newer sass-rails with Sass 3.3 support (see #160).
14
+
15
+ ### Removed
16
+ - Rails 3.0 support.
17
+
18
+ ### Fixed
19
+ - Properly bust the cache on image sprites within a sub-directory that
20
+ are imported with a wildcard (see #166).
21
+
22
+ ## 1.1.7 - 2014-03-18
23
+ ### Fixed
24
+ - Locked Sprockets version to 2.11.0 (see #146).
25
+
26
+ ## 1.1.6 - 2014-03-11
27
+ ### Fixed
28
+ - Leave bundle selection to rails environment.
29
+
30
+ ## 1.1.5 - 2014-03-11
31
+ ### Added
32
+ - Support for Ruby 2.1.0.
33
+
34
+ ### Fixed
35
+ - Fixed `rails_loaded?` for when Rails is defined but no application is actually loaded.
36
+
37
+ ## 1.1.4 - 2014-03-18
38
+ ### Changed
39
+ - Simplified README.
40
+
41
+ ## 1.1.3 - 2013-12-27
42
+ ### Fixed
43
+ - No longer assuming asset pipeline is running when generating sprites.
44
+
45
+ ## 1.1.2 - 2013-12-06
46
+ ### Fixed
47
+ - Reverted fix for `generated_image_url` introduced in 1.1.0.
48
+
49
+ ## 1.1.1 - 2013-12-05
50
+ ### Added
51
+ - Support for Compass versions greater than 0.12.2.
52
+
53
+ ## 1.1.0 - 2013-12-05
54
+ ### Added
55
+ - Rails 4 support.
56
+ - Ruby 2.0 support.
57
+
58
+ ### Fixed
59
+ - Allow compass-rails without asset pipeline on Rails 3.2.
60
+ - Fix `generated_image_url` when `generated_images_dir` is set.
61
+
62
+ ### Removed
63
+ - Support for Ruby 1.8.7 and 1.9.2.
64
+ - Support for Rails 2.3.
65
+
66
+ ## 1.0.3 - 2012-06-26
67
+ ### Added
68
+ - Bumped Compass version to 0.12.2.
69
+
70
+ ### Fixed
71
+ - `FixedStaticCompiler` hack so sprite source files dont show up in manifest.
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in compass-rails.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'mocha'
8
+ gem 'appraisal'
9
+ gem 'minitest'
10
+ end
11
+
12
+ unless ENV["CI"]
13
+ gem 'rb-fsevent', :require => false
14
+ gem 'ruby_gntp', :require => false
15
+ gem 'guard'
16
+ gem 'guard-test'
17
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Scott Davis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,97 @@
1
+ # compass-rails
2
+
3
+ **We Take Pull Requests!**
4
+
5
+ [![Build Status](https://travis-ci.org/Compass/compass-rails.png?branch=master)](https://travis-ci.org/Compass/compass-rails)
6
+ [![Code Climate](https://codeclimate.com/github/Compass/compass-rails.png)](https://codeclimate.com/github/Compass/compass-rails)
7
+ [![Gem Version](https://badge.fury.io/rb/compass-rails.svg)](http://badge.fury.io/rb/compass-rails)
8
+ [![Coverage Status](https://coveralls.io/repos/Compass/compass-rails/badge.png)](https://coveralls.io/r/Compass/compass-rails)
9
+
10
+ Compass rails is an adapter for the [Compass Stylesheet Authoring
11
+ Framework](http://compass-style.org) for [Ruby on Rails](http://rubyonrails.org/).
12
+
13
+ Since Compass v0.12.0, this is the only way to use compass with your rails application.
14
+
15
+ Supports Rails 3.2, 4.x releases.
16
+
17
+ ## Installation
18
+
19
+ Add the `compass-rails` gem line to your application's Gemfile
20
+
21
+ ```ruby
22
+ gem 'sass-rails'
23
+ gem 'compass-rails'
24
+ ```
25
+
26
+ If you are using any Compass extensions, add them to this group in your
27
+ Gemfile.
28
+
29
+ And then execute:
30
+
31
+ $ bundle
32
+
33
+ ## Usage
34
+
35
+ 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.:
36
+
37
+ ```scss
38
+ @import "compass";
39
+
40
+ @import "your_project/mixins";
41
+ @import "your_project/base";
42
+ ```
43
+
44
+ *or*
45
+
46
+ Use `application.css` to require files that use compass features. Ex:
47
+ ```css
48
+ /*
49
+ *= require styleguide_full_of_compass_stuff
50
+ */
51
+ ```
52
+
53
+ *Don't* use `*= require something` within your SCSS or SASS files. You're gonna have a bad time.
54
+
55
+ ### Configuration
56
+
57
+ Compass-rails is configured out of the box to work with Rails.
58
+
59
+ Advanced users can choose to add a `config/compass.rb` and take advantage of the [Compass configuration
60
+ reference](http://compass-style.org/help/documentation/configuration-reference/)
61
+ as is.
62
+
63
+ ### Installing Compass extensions
64
+
65
+ Step 1: Add it to your Gemfile and run the `bundle` command to install it.
66
+
67
+ Step 2: Install the extension's assets: `bundle exec compass install
68
+ <extension/template>`
69
+
70
+ For example, if you want to use susy.
71
+
72
+ ```ruby
73
+ # Gemfile
74
+ gem 'compass-rails'
75
+ gem 'susy'
76
+ ```
77
+
78
+ then run:
79
+
80
+ $ bundle
81
+ $ bundle exec compass install susy
82
+
83
+ if you are using the rails configuration files you should add:
84
+
85
+ ```ruby
86
+ config.compass.require "susy"
87
+ ```
88
+
89
+ to your application.rb configuration file.
90
+
91
+ ## Contributing
92
+
93
+ 1. Fork it
94
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
95
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
96
+ 4. Push to the branch (`git push origin my-new-feature`)
97
+ 5. Create new Pull Request
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rake
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler.setup
5
+ require 'rake/dsl_definition'
6
+
7
+ require "bundler/gem_tasks"
8
+ require 'appraisal'
9
+ require 'compass'
10
+
11
+ # ----- Default: Testing ------
12
+
13
+ task :default => [:test]
14
+
15
+ require 'rake/testtask'
16
+ require 'fileutils'
17
+
18
+ Rake::TestTask.new :test do |t|
19
+ t.libs << 'lib'
20
+ t.libs << 'test'
21
+ test_files = FileList['test/**/*_{test,spec}.rb']
22
+ test_files.exclude('test/rails/*', 'test/haml/*')
23
+ t.test_files = test_files
24
+ t.verbose = true
25
+ end
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rb-fsevent", :require => false
6
+ gem "ruby_gntp", :require => false
7
+ gem "guard"
8
+ gem "guard-test"
9
+ gem "rails", "3.1.3"
10
+ gem "sass-rails"
11
+
12
+ group :test do
13
+ gem "mocha"
14
+ gem "appraisal"
15
+ gem "minitest"
16
+ end
17
+
18
+ gemspec :path => "../"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rb-fsevent", :require => false
6
+ gem "ruby_gntp", :require => false
7
+ gem "guard"
8
+ gem "guard-test"
9
+ gem "rails", "~> 3.2"
10
+ gem "sass-rails"
11
+
12
+ group :test do
13
+ gem "mocha"
14
+ gem "appraisal"
15
+ gem "minitest"
16
+ end
17
+
18
+ gemspec :path => "../"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rb-fsevent", :require => false
6
+ gem "ruby_gntp", :require => false
7
+ gem "guard"
8
+ gem "guard-test"
9
+ gem "rails", "~> 4.0.0"
10
+ gem "sass-rails"
11
+
12
+ group :test do
13
+ gem "mocha"
14
+ gem "appraisal"
15
+ gem "minitest"
16
+ end
17
+
18
+ gemspec :path => "../"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rb-fsevent", :require => false
6
+ gem "ruby_gntp", :require => false
7
+ gem "guard"
8
+ gem "guard-test"
9
+ gem "rails", "~> 4.2.0"
10
+ gem "sass-rails", "~> 5.0"
11
+
12
+ group :test do
13
+ gem "mocha"
14
+ gem "appraisal"
15
+ gem "minitest"
16
+ end
17
+
18
+ gemspec :path => "../"
@@ -0,0 +1,21 @@
1
+ require File.expand_path('../lib/compass-rails/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Scott Davis", "Chris Eppstein", "Craig McNamara"]
5
+ gem.email = ["jetviper21@gmail.com", "chris@eppsteins.net", "craig.mcnamara@gmail.com"]
6
+ gem.description = %q{Integrate Compass into Rails 3.0 and up.}
7
+ gem.summary = %q{Integrate Compass into Rails 3.0 and up.}
8
+ gem.homepage = "https://github.com/Compass/glebtv-compass-rails"
9
+
10
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
+ gem.name = "glebtv-compass-rails"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = CompassRails::VERSION
16
+ gem.license = "MIT"
17
+
18
+ gem.add_dependency 'compass', '~> 1.0.0'
19
+ gem.add_dependency 'sprockets', '~> 3.2'
20
+ gem.add_dependency 'sass-rails', '< 5.1'
21
+ end
@@ -0,0 +1,107 @@
1
+ require 'compass'
2
+ require "compass-rails/version"
3
+ require "compass-rails/configuration"
4
+
5
+ module CompassRails
6
+ extend self
7
+
8
+ def setup_fake_rails_env_paths(sprockets_env)
9
+ return unless rails_loaded?
10
+ keys = ['app/assets', 'lib/assets', 'vendor/assets']
11
+ local = keys.map {|path| ::Rails.root.join(path) }.map { |path| [File.join(path, 'images'), File.join(path, 'stylesheets')] }.flatten!
12
+ sprockets_env.send(:trail).paths.unshift(*local)
13
+ paths = []
14
+ ::Rails::Engine.subclasses.each do |subclass|
15
+ paths = subclass.paths
16
+ keys.each do |key|
17
+ sprockets_env.send(:trail).paths.unshift(*paths[key].existent_directories)
18
+ end
19
+ end
20
+ end
21
+
22
+ def sass_config
23
+ ::Rails.application.config.sass
24
+ end
25
+
26
+ def sprockets
27
+ @sprockets ||= ::Rails.application.assets
28
+ end
29
+
30
+ def context
31
+ @context ||= begin
32
+ sprockets.version = ::Rails.env + "-#{sprockets.version}"
33
+ setup_fake_rails_env_paths(sprockets)
34
+ context = ::Rails.application.assets.context_class
35
+ context.extend(::Sprockets::Helpers::IsolatedHelper)
36
+ context.extend(::Sprockets::Helpers::RailsHelper)
37
+ context.extend(::Sass::Rails::Railtie::SassContext)
38
+ context.sass_config = sass_config
39
+
40
+ context
41
+ end
42
+ end
43
+
44
+ def rails_loaded?
45
+ defined?(::Rails)
46
+ end
47
+
48
+ def rails_version
49
+ rails_spec = (Gem.loaded_specs["railties"] || Gem.loaded_specs["rails"])
50
+ raise "You have to require Rails before compass" unless rails_spec
51
+ rails_spec.version.to_s
52
+ end
53
+
54
+ def version_match(version)
55
+ !(rails_version =~ version).nil?
56
+ end
57
+
58
+ def configuration
59
+ config = Compass::Configuration::Data.new('rails')
60
+ config.extend(CompassRails::Configuration)
61
+ config
62
+ end
63
+
64
+ def prefix
65
+ ::Rails.application.config.assets.prefix
66
+ end
67
+
68
+ def configure_rails!(app)
69
+ return unless app.config.respond_to?(:sass)
70
+ sass_config = app.config.sass
71
+ compass_config = app.config.compass
72
+
73
+ sass_config.load_paths.concat(compass_config.sass_load_paths)
74
+
75
+ { :output_style => :style,
76
+ :line_comments => :line_comments,
77
+ :cache => :cache,
78
+ :disable_warnings => :quiet,
79
+ :preferred_syntax => :preferred_syntax
80
+ }.each do |compass_option, sass_option|
81
+ set_maybe sass_config, compass_config, sass_option, compass_option
82
+ end
83
+ if compass_config.sass_options
84
+ compass_config.sass_options.each do |config, value|
85
+ sass_config.send("#{config}=", value)
86
+ end
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ # sets the sass config value only if the corresponding compass-based setting
93
+ # has been explicitly set by the user.
94
+ def set_maybe(sass_config, compass_config, sass_option, compass_option)
95
+ if compass_value = compass_config.send(:"#{compass_option}_without_default")
96
+ sass_config.send(:"#{sass_option}=", compass_value)
97
+ end
98
+ end
99
+
100
+ end
101
+
102
+ if defined?(::Rails)
103
+ Compass::AppIntegration.register(:rails, "::CompassRails")
104
+ require "compass-rails/railtie"
105
+ require "compass-rails/patches"
106
+ end
107
+