compass-rails 2.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +23 -4
- data/Appraisals +18 -9
- data/CHANGELOG.md +82 -0
- data/Gemfile +4 -8
- data/README.md +14 -12
- data/Rakefile +4 -23
- data/compass-rails.gemspec +3 -2
- data/gemfiles/rails52.gemfile +20 -0
- data/gemfiles/rails60.gemfile +21 -0
- data/gemfiles/rails_edge.gemfile +21 -0
- data/lib/compass-rails.rb +16 -125
- data/lib/compass-rails/patches.rb +0 -3
- data/lib/compass-rails/patches/3_1.rb +3 -12
- data/lib/compass-rails/patches/4_0.rb +23 -29
- data/lib/compass-rails/patches/compass.rb +3 -3
- data/lib/compass-rails/patches/importer.rb +10 -12
- data/lib/compass-rails/patches/sass_importer.rb +67 -7
- data/lib/compass-rails/patches/sprite_importer.rb +4 -4
- data/lib/compass-rails/railties.rb +1 -3
- data/lib/compass-rails/railties/3_1.rb +5 -12
- data/lib/compass-rails/railties/4_0.rb +11 -9
- data/lib/compass-rails/version.rb +1 -3
- data/test/compass_rails_spec.rb +58 -0
- data/test/fixtures/assets/images/letters/a.png +0 -0
- data/test/fixtures/assets/images/letters/b.png +0 -0
- data/test/fixtures/assets/images/numbers/sprite-1.png +0 -0
- data/test/fixtures/assets/images/numbers/sprite-2.png +0 -0
- data/test/fixtures/assets/stylesheets/application.css.scss +23 -0
- data/test/fixtures/assets/stylesheets/partials/_partial_1.scss +3 -0
- data/test/fixtures/assets/stylesheets/partials/_partial_2.scss +3 -0
- data/test/helpers/command_helper.rb +2 -15
- data/test/helpers/debug_helper.rb +1 -1
- data/test/helpers/file_helper.rb +2 -17
- data/test/helpers/rails_helper.rb +37 -38
- data/test/helpers/rails_project.rb +30 -70
- data/test/test_helper.rb +8 -3
- metadata +55 -24
- data/changelog.markdown +0 -11
- data/gemfiles/rails31.gemfile +0 -23
- data/gemfiles/rails32.gemfile +0 -23
- data/gemfiles/rails40.gemfile +0 -23
- data/lib/compass-rails/installer.rb +0 -30
- data/test/integrations/.gitkeep +0 -0
- data/test/integrations/rails_31_test.rb +0 -46
- data/test/integrations/rails_32_test.rb +0 -46
- data/test/integrations/rails_40_test.rb +0 -46
- data/test/units/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 051e3425d85a8db3f1b3d76430f4523a905b19d51b3d29476188f18441fe315b
|
4
|
+
data.tar.gz: 30d80439765d7c6288c1f460ee1ad45d710bb690f3e8fda29bbd7c13039d7199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4be5c5939deedbe57b6c64e801cb69ef14947722de615a279e51e051f6b8efc063197fe72b26a97eb6036b31012d123762ad20f8409a78e30ebd113f62895ea1
|
7
|
+
data.tar.gz: 4b95ded34fbfeae63c2df0645b63e8452040046ec38e11e5601624764a70c9353829a88d210f4569110c04987530237829f6563347b141f5fd21ee116b49f1b9
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
1
3
|
rvm:
|
2
|
-
-
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
|
4
|
+
- 2.4.9
|
5
|
+
- 2.5.7
|
6
|
+
- 2.6.5
|
7
|
+
- 2.7.0
|
8
|
+
- ruby-head
|
9
|
+
- jruby-head
|
10
|
+
gemfile:
|
11
|
+
- gemfiles/rails52.gemfile
|
12
|
+
- gemfiles/rails60.gemfile
|
13
|
+
- gemfiles/rails_edge.gemfile
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: 2.4.9
|
17
|
+
gemfile: gemfiles/rails60.gemfile
|
18
|
+
- rvm: 2.4.9
|
19
|
+
gemfile: gemfiles/rails_edge.gemfile
|
20
|
+
fast_finish: true
|
21
|
+
allow_failures:
|
22
|
+
- rvm: ruby-head
|
23
|
+
- rvm: jruby-head
|
24
|
+
- gemfile: gemfiles/rails_edge.gemfile
|
data/Appraisals
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
-
appraise "
|
2
|
-
gem "rails", "
|
3
|
-
gem "
|
1
|
+
appraise "rails52" do
|
2
|
+
gem "rails", "~> 5.2.0"
|
3
|
+
gem "sprockets", "< 4.0"
|
4
|
+
gem "sass-rails", "~> 5.0"
|
5
|
+
gem "bootsnap", require: false
|
4
6
|
end
|
5
7
|
|
6
|
-
appraise "
|
7
|
-
gem "rails", "~>
|
8
|
-
gem "
|
8
|
+
appraise "rails60" do
|
9
|
+
gem "rails", "~> 6.0.0"
|
10
|
+
gem "sprockets", "< 4.0"
|
11
|
+
gem "sass-rails", "~> 5.0"
|
12
|
+
gem "webpacker", "~> 4.0"
|
13
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
9
14
|
end
|
10
15
|
|
11
|
-
appraise "
|
12
|
-
gem "rails",
|
13
|
-
|
16
|
+
appraise "rails_edge" do
|
17
|
+
gem "rails", github: "rails/rails"
|
18
|
+
|
19
|
+
gem "sprockets", "< 4.0"
|
20
|
+
gem "sass-rails", "~> 5.0"
|
21
|
+
gem "webpacker", "~> 4.0"
|
22
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
14
23
|
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## 3.0.1 - 2016-2
|
4
|
+
### Fixed
|
5
|
+
- Fix running rake assts:precompile to be run in production mode. Issue #257.
|
6
|
+
|
7
|
+
## 3.0.0 - 2016-01-23
|
8
|
+
### Added
|
9
|
+
- Added Sprockets 3 support. Issue #232, #236, #244.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Sprockets cache files are no longer saved to /tmp and now use the app-level tmp folder instead.
|
13
|
+
|
14
|
+
## 2.0.2 - 2015-01-03
|
15
|
+
### Fixed
|
16
|
+
- 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
|
17
|
+
- Support up to sass-rails 5.0.1. Issue #198
|
18
|
+
- Fix sass_importer patches having incorrect method signatures. Issue #195
|
19
|
+
- Fixed incorrect path generation for sprites in Rails 4. Issue #190
|
20
|
+
|
21
|
+
## 2.0.0 - 2014-07-10
|
22
|
+
### Added
|
23
|
+
- Support for Rails 4.2
|
24
|
+
- Allow newer sass-rails with Sass 3.3 support (see #160).
|
25
|
+
|
26
|
+
### Removed
|
27
|
+
- Rails 3.0 support.
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
- Properly bust the cache on image sprites within a sub-directory that
|
31
|
+
are imported with a wildcard (see #166).
|
32
|
+
|
33
|
+
## 1.1.7 - 2014-03-18
|
34
|
+
### Fixed
|
35
|
+
- Locked Sprockets version to 2.11.0 (see #146).
|
36
|
+
|
37
|
+
## 1.1.6 - 2014-03-11
|
38
|
+
### Fixed
|
39
|
+
- Leave bundle selection to rails environment.
|
40
|
+
|
41
|
+
## 1.1.5 - 2014-03-11
|
42
|
+
### Added
|
43
|
+
- Support for Ruby 2.1.0.
|
44
|
+
|
45
|
+
### Fixed
|
46
|
+
- Fixed `rails_loaded?` for when Rails is defined but no application is actually loaded.
|
47
|
+
|
48
|
+
## 1.1.4 - 2014-03-18
|
49
|
+
### Changed
|
50
|
+
- Simplified README.
|
51
|
+
|
52
|
+
## 1.1.3 - 2013-12-27
|
53
|
+
### Fixed
|
54
|
+
- No longer assuming asset pipeline is running when generating sprites.
|
55
|
+
|
56
|
+
## 1.1.2 - 2013-12-06
|
57
|
+
### Fixed
|
58
|
+
- Reverted fix for `generated_image_url` introduced in 1.1.0.
|
59
|
+
|
60
|
+
## 1.1.1 - 2013-12-05
|
61
|
+
### Added
|
62
|
+
- Support for Compass versions greater than 0.12.2.
|
63
|
+
|
64
|
+
## 1.1.0 - 2013-12-05
|
65
|
+
### Added
|
66
|
+
- Rails 4 support.
|
67
|
+
- Ruby 2.0 support.
|
68
|
+
|
69
|
+
### Fixed
|
70
|
+
- Allow compass-rails without asset pipeline on Rails 3.2.
|
71
|
+
- Fix `generated_image_url` when `generated_images_dir` is set.
|
72
|
+
|
73
|
+
### Removed
|
74
|
+
- Support for Ruby 1.8.7 and 1.9.2.
|
75
|
+
- Support for Rails 2.3.
|
76
|
+
|
77
|
+
## 1.0.3 - 2012-06-26
|
78
|
+
### Added
|
79
|
+
- Bumped Compass version to 0.12.2.
|
80
|
+
|
81
|
+
### Fixed
|
82
|
+
- `FixedStaticCompiler` hack so sprite source files dont show up in manifest.
|
data/Gemfile
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
2
3
|
|
3
4
|
# Specify your gem's dependencies in compass-rails.gemspec
|
4
5
|
gemspec
|
5
6
|
|
6
|
-
group :assets do
|
7
|
-
gem "compass", '~> 0.13.alpha.0'
|
8
|
-
gem "compass-rails", :path=>"."
|
9
|
-
gem 'compass-blueprint'
|
10
|
-
end
|
11
|
-
|
12
7
|
group :test do
|
13
8
|
gem 'mocha'
|
14
|
-
gem
|
15
|
-
gem '
|
9
|
+
gem 'appraisal'
|
10
|
+
gem 'minitest'
|
16
11
|
end
|
17
12
|
|
18
13
|
unless ENV["CI"]
|
@@ -21,3 +16,4 @@ unless ENV["CI"]
|
|
21
16
|
gem 'guard'
|
22
17
|
gem 'guard-test'
|
23
18
|
end
|
19
|
+
|
data/README.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# compass-rails
|
2
2
|
|
3
|
+
**Don't start new projects with compass, it is no longer supported, see the [compass statement](https://github.com/Compass/compass/pull/2094)**
|
4
|
+
|
3
5
|
**We Take Pull Requests!**
|
4
6
|
|
5
|
-
[![Build Status](https://travis-ci.org/Compass/compass-rails.
|
6
|
-
[![Code Climate](https://codeclimate.com/github/Compass/compass-rails.
|
7
|
+
[![Build Status](https://travis-ci.org/Compass/compass-rails.svg?branch=master)](https://travis-ci.org/Compass/compass-rails)
|
8
|
+
[![Code Climate](https://codeclimate.com/github/Compass/compass-rails.svg)](https://codeclimate.com/github/Compass/compass-rails)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/compass-rails.svg)](http://badge.fury.io/rb/compass-rails)
|
10
|
+
[![Coverage Status](https://coveralls.io/repos/Compass/compass-rails/badge.svg)](https://coveralls.io/r/Compass/compass-rails)
|
7
11
|
|
8
12
|
Compass rails is an adapter for the [Compass Stylesheet Authoring
|
9
13
|
Framework](http://compass-style.org) for [Ruby on Rails](http://rubyonrails.org/).
|
10
14
|
|
11
15
|
Since Compass v0.12.0, this is the only way to use compass with your rails application.
|
12
16
|
|
13
|
-
Supports Rails
|
17
|
+
Supports Rails 5.2 and 6.x releases.
|
14
18
|
|
15
19
|
## Installation
|
16
20
|
|
@@ -52,19 +56,17 @@ Use `application.css` to require files that use compass features. Ex:
|
|
52
56
|
|
53
57
|
### Configuration
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
options explained there will be methods and properties on the `config.compass`
|
61
|
-
configuration object exposed to rails within any configuration block.
|
59
|
+
Compass-rails is configured out of the box to work with Rails.
|
60
|
+
|
61
|
+
Advanced users can choose to add a `config/compass.rb` and take advantage of the [Compass configuration
|
62
|
+
reference](http://compass-style.org/help/documentation/configuration-reference/)
|
63
|
+
as is.
|
62
64
|
|
63
65
|
### Installing Compass extensions
|
64
66
|
|
65
67
|
Step 1: Add it to your Gemfile and run the `bundle` command to install it.
|
66
68
|
|
67
|
-
Step 2: Install the extension's assets: `bundle exec compass install
|
69
|
+
Step 2: Install the extension's assets: `bundle exec compass install
|
68
70
|
<extension/template>`
|
69
71
|
|
70
72
|
For example, if you want to use susy.
|
@@ -72,7 +74,7 @@ For example, if you want to use susy.
|
|
72
74
|
```ruby
|
73
75
|
# Gemfile
|
74
76
|
gem 'compass-rails'
|
75
|
-
gem '
|
77
|
+
gem 'susy'
|
76
78
|
```
|
77
79
|
|
78
80
|
then run:
|
data/Rakefile
CHANGED
@@ -1,34 +1,15 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
require '
|
3
|
-
require 'bundler'
|
4
|
-
Bundler.setup
|
5
|
-
require 'rake/dsl_definition' rescue nil
|
6
|
-
|
7
|
-
require "bundler/gem_tasks"
|
8
|
-
require 'appraisal'
|
9
|
-
require 'compass'
|
10
|
-
|
11
|
-
# ----- Default: Testing ------
|
12
|
-
|
13
|
-
task :default => [:test, :features]
|
14
|
-
|
2
|
+
require 'bundler/gem_tasks'
|
15
3
|
require 'rake/testtask'
|
16
|
-
require 'fileutils'
|
17
4
|
|
18
5
|
Rake::TestTask.new :test do |t|
|
6
|
+
require 'fileutils'
|
19
7
|
t.libs << 'lib'
|
20
8
|
t.libs << 'test'
|
21
|
-
test_files = FileList['test/**/*
|
9
|
+
test_files = FileList['test/**/*_{test,spec}.rb']
|
22
10
|
test_files.exclude('test/rails/*', 'test/haml/*')
|
23
11
|
t.test_files = test_files
|
24
12
|
t.verbose = true
|
25
13
|
end
|
26
14
|
|
27
|
-
|
28
|
-
t.libs << 'lib'
|
29
|
-
t.libs << 'test'
|
30
|
-
test_files = FileList['test/units/**/*_test.rb']
|
31
|
-
test_files.exclude('test/rails/*', 'test/haml/*')
|
32
|
-
t.test_files = test_files
|
33
|
-
t.verbose = true
|
34
|
-
end
|
15
|
+
task :default => [:test]
|
data/compass-rails.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = CompassRails::VERSION
|
17
17
|
gem.license = "MIT"
|
18
18
|
|
19
|
-
gem.add_dependency 'compass',
|
20
|
-
|
19
|
+
gem.add_dependency 'compass', '~> 1.0.0'
|
20
|
+
gem.add_dependency 'sprockets', '< 4.0'
|
21
|
+
gem.add_dependency 'sass-rails', '< 5.1'
|
21
22
|
end
|
@@ -0,0 +1,20 @@
|
|
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", "~> 5.2.0"
|
10
|
+
gem "sprockets", "< 4.0"
|
11
|
+
gem "sass-rails", "~> 5.0"
|
12
|
+
gem "bootsnap", require: false
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem "mocha"
|
16
|
+
gem "appraisal"
|
17
|
+
gem "minitest"
|
18
|
+
end
|
19
|
+
|
20
|
+
gemspec path: "../"
|
@@ -0,0 +1,21 @@
|
|
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", "~> 6.0.0"
|
10
|
+
gem "sprockets", "< 4.0"
|
11
|
+
gem "sass-rails", "~> 5.0"
|
12
|
+
gem "webpacker", "~> 4.0"
|
13
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "mocha"
|
17
|
+
gem "appraisal"
|
18
|
+
gem "minitest"
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec path: "../"
|
@@ -0,0 +1,21 @@
|
|
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", git: "https://github.com/rails/rails.git"
|
10
|
+
gem "sprockets", "< 4.0"
|
11
|
+
gem "sass-rails", "~> 5.0"
|
12
|
+
gem "webpacker", "~> 4.0"
|
13
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "mocha"
|
17
|
+
gem "appraisal"
|
18
|
+
gem "minitest"
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec path: "../"
|
data/lib/compass-rails.rb
CHANGED
@@ -4,60 +4,45 @@ require "compass-rails/configuration"
|
|
4
4
|
|
5
5
|
module CompassRails
|
6
6
|
|
7
|
-
RAILS_4 = %r{^4.[0|1|2]}
|
8
7
|
RAILS_32 = %r{^3.2}
|
9
8
|
RAILS_31 = %r{^3.1}
|
10
9
|
|
11
10
|
extend self
|
12
11
|
|
13
|
-
def
|
14
|
-
return
|
15
|
-
return if defined?(::Rails) && ::Rails.respond_to?(:application) && !::Rails.application.nil?
|
12
|
+
def setup_fake_rails_env_paths(sprockets_env)
|
13
|
+
return unless rails_loaded?
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
if sprockets_env.respond_to?(:trail, true)
|
16
|
+
sprockets_trail = sprockets_env.send(:trail)
|
17
|
+
else
|
18
|
+
sprockets_trail = sprockets_env.index
|
21
19
|
end
|
22
|
-
#load the rails config
|
23
|
-
require "#{rails_config_path}/config/application.rb"
|
24
|
-
require 'sass-rails'
|
25
|
-
require 'sprockets/railtie'
|
26
|
-
require 'rails/engine'
|
27
|
-
@app ||= ::Rails.application.initialize!
|
28
|
-
end
|
29
|
-
|
30
20
|
|
31
|
-
def setup_fake_rails_env_paths(sprockets_env)
|
32
|
-
return unless rails_loaded?
|
33
21
|
keys = ['app/assets', 'lib/assets', 'vendor/assets']
|
34
22
|
local = keys.map {|path| ::Rails.root.join(path) }.map { |path| [File.join(path, 'images'), File.join(path, 'stylesheets')] }.flatten!
|
35
|
-
|
23
|
+
sprockets_trail.paths.unshift(*local)
|
36
24
|
paths = []
|
37
25
|
::Rails::Engine.subclasses.each do |subclass|
|
38
26
|
paths = subclass.paths
|
39
27
|
keys.each do |key|
|
40
|
-
|
28
|
+
sprockets_trail.paths.unshift(*paths[key].existent_directories)
|
41
29
|
end
|
42
30
|
end
|
43
31
|
end
|
44
32
|
|
45
33
|
def sass_config
|
46
|
-
load_rails
|
47
34
|
::Rails.application.config.sass
|
48
35
|
end
|
49
36
|
|
50
37
|
def sprockets
|
51
|
-
|
52
|
-
@sprockets ||= ::Rails.application.assets
|
38
|
+
@sprockets ||= Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)
|
53
39
|
end
|
54
40
|
|
55
41
|
def context
|
56
|
-
load_rails
|
57
42
|
@context ||= begin
|
58
43
|
sprockets.version = ::Rails.env + "-#{sprockets.version}"
|
59
44
|
setup_fake_rails_env_paths(sprockets)
|
60
|
-
context = ::
|
45
|
+
context = ::CompassRails.sprockets.context_class
|
61
46
|
context.extend(::Sprockets::Helpers::IsolatedHelper)
|
62
47
|
context.extend(::Sprockets::Helpers::RailsHelper)
|
63
48
|
context.extend(::Sass::Rails::Railtie::SassContext)
|
@@ -67,10 +52,6 @@ module CompassRails
|
|
67
52
|
end
|
68
53
|
end
|
69
54
|
|
70
|
-
def installer(*args)
|
71
|
-
CompassRails::Installer.new(*args)
|
72
|
-
end
|
73
|
-
|
74
55
|
def rails_loaded?
|
75
56
|
defined?(::Rails)
|
76
57
|
end
|
@@ -91,29 +72,11 @@ module CompassRails
|
|
91
72
|
version_match RAILS_32
|
92
73
|
end
|
93
74
|
|
94
|
-
def rails4?
|
95
|
-
return false unless defined?(::Rails)
|
96
|
-
version_match RAILS_4
|
97
|
-
end
|
98
|
-
|
99
75
|
def version_match(version)
|
100
|
-
|
101
|
-
return false
|
102
|
-
end
|
103
|
-
|
104
|
-
true
|
105
|
-
end
|
106
|
-
|
107
|
-
def booted!
|
108
|
-
CompassRails.const_set(:BOOTED, true)
|
109
|
-
end
|
110
|
-
|
111
|
-
def booted?
|
112
|
-
defined?(CompassRails::BOOTED) && CompassRails::BOOTED
|
76
|
+
!(rails_version =~ version).nil?
|
113
77
|
end
|
114
78
|
|
115
79
|
def configuration
|
116
|
-
load_rails
|
117
80
|
config = Compass::Configuration::Data.new('rails')
|
118
81
|
config.extend(CompassRails::Configuration)
|
119
82
|
config
|
@@ -123,50 +86,6 @@ module CompassRails
|
|
123
86
|
::Rails.application.config.assets.prefix
|
124
87
|
end
|
125
88
|
|
126
|
-
def env_production?
|
127
|
-
if defined?(::Rails) && ::Rails.respond_to?(:env)
|
128
|
-
::Rails.env.production?
|
129
|
-
elsif defined?(RAILS_ENV)
|
130
|
-
RAILS_ENV == "production"
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def root
|
135
|
-
@root ||= begin
|
136
|
-
if defined?(::Rails) && ::Rails.respond_to?(:root)
|
137
|
-
::Rails.root
|
138
|
-
elsif defined?(RAILS_ROOT)
|
139
|
-
Pathname.new(RAILS_ROOT)
|
140
|
-
else
|
141
|
-
Pathname.new(Dir.pwd)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def check_for_double_boot!
|
147
|
-
if booted?
|
148
|
-
Compass::Util.compass_warn("Warning: Compass was booted twice. Compass-rails has got your back; please remove your compass initializer.")
|
149
|
-
else
|
150
|
-
booted!
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def sass_plugin_enabled?
|
155
|
-
unless rails31?
|
156
|
-
defined?(Sass::Plugin) && !Sass::Plugin.options[:never_update]
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
# Rails projects without asset pipeline use this in their compass initializer.
|
161
|
-
def initialize!(config = nil)
|
162
|
-
check_for_double_boot!
|
163
|
-
config ||= Compass.detect_configuration_file(root)
|
164
|
-
Compass.add_project_configuration(config, :project_type => :rails)
|
165
|
-
Compass.discover_extensions!
|
166
|
-
Compass.configure_sass_plugin!
|
167
|
-
Compass.handle_configuration_change! if sass_plugin_enabled?
|
168
|
-
end
|
169
|
-
|
170
89
|
def configure_rails!(app)
|
171
90
|
return unless app.config.respond_to?(:sass)
|
172
91
|
sass_config = app.config.sass
|
@@ -189,31 +108,6 @@ module CompassRails
|
|
189
108
|
end
|
190
109
|
end
|
191
110
|
|
192
|
-
def boot_config
|
193
|
-
config = begin
|
194
|
-
if (config_file = Compass.detect_configuration_file) &&
|
195
|
-
(config_data = Compass.configuration_for(config_file))
|
196
|
-
config_data
|
197
|
-
else
|
198
|
-
Compass::Configuration::Data.new("compass_rails_boot")
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
config.tap do |c|
|
203
|
-
c.top_level.project_type = :rails
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
def asset_pipeline_enabled?
|
208
|
-
return false unless rails_loaded? && ::Rails.respond_to?(:application) && !::Rails.application.nil?
|
209
|
-
rails_config = ::Rails.application.config
|
210
|
-
if rails_config.respond_to?(:assets)
|
211
|
-
rails_config.assets.enabled != false
|
212
|
-
else
|
213
|
-
false
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
111
|
private
|
218
112
|
|
219
113
|
# sets the sass config value only if the corresponding compass-based setting
|
@@ -226,11 +120,8 @@ module CompassRails
|
|
226
120
|
|
227
121
|
end
|
228
122
|
|
229
|
-
|
230
|
-
Compass.
|
231
|
-
|
232
|
-
require "compass-rails/
|
233
|
-
|
234
|
-
require "compass-rails/installer"
|
235
|
-
|
236
|
-
|
123
|
+
if defined?(::Rails)
|
124
|
+
Compass::AppIntegration.register(:rails, "::CompassRails")
|
125
|
+
require "compass-rails/patches"
|
126
|
+
require "compass-rails/railties"
|
127
|
+
end
|