compass-rails 1.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +18 -0
  2. data/.travis.yml +5 -0
  3. data/Appraisals +17 -0
  4. data/Gemfile +22 -0
  5. data/Guardfile +9 -0
  6. data/LICENSE +22 -0
  7. data/README.md +191 -0
  8. data/Rakefile +34 -0
  9. data/compass-rails.gemspec +21 -0
  10. data/gemfiles/rails2.gemfile +21 -0
  11. data/gemfiles/rails2.gemfile.lock +87 -0
  12. data/gemfiles/rails3.gemfile +21 -0
  13. data/gemfiles/rails3.gemfile.lock +134 -0
  14. data/gemfiles/rails31.gemfile +22 -0
  15. data/gemfiles/rails31.gemfile.lock +151 -0
  16. data/gemfiles/rails32.gemfile +22 -0
  17. data/gemfiles/rails32.gemfile.lock +148 -0
  18. data/lib/compass-rails.rb +207 -0
  19. data/lib/compass-rails/configuration.rb +1 -0
  20. data/lib/compass-rails/configuration/3_1.rb +51 -0
  21. data/lib/compass-rails/configuration/default.rb +75 -0
  22. data/lib/compass-rails/installer.rb +30 -0
  23. data/lib/compass-rails/patches.rb +6 -0
  24. data/lib/compass-rails/patches/3_1.rb +28 -0
  25. data/lib/compass-rails/patches/importer.rb +26 -0
  26. data/lib/compass-rails/patches/sprite_importer.rb +38 -0
  27. data/lib/compass-rails/railties.rb +11 -0
  28. data/lib/compass-rails/railties/2_3.rb +56 -0
  29. data/lib/compass-rails/railties/3_0.rb +48 -0
  30. data/lib/compass-rails/railties/3_1.rb +90 -0
  31. data/lib/compass-rails/version.rb +5 -0
  32. data/lib/compass/app_integration/rails.rb +10 -0
  33. data/test/fixtures/.gitkeep +0 -0
  34. data/test/helpers/command_helper.rb +120 -0
  35. data/test/helpers/debug_helper.rb +12 -0
  36. data/test/helpers/file_helper.rb +53 -0
  37. data/test/helpers/rails_helper.rb +65 -0
  38. data/test/helpers/rails_project.rb +186 -0
  39. data/test/integrations/.gitkeep +0 -0
  40. data/test/integrations/rails3_test.rb +37 -0
  41. data/test/integrations/rails_23_test.rb +28 -0
  42. data/test/integrations/rails_31_test.rb +47 -0
  43. data/test/integrations/rails_32_test.rb +46 -0
  44. data/test/test_helper.rb +15 -0
  45. data/test/units/.gitkeep +0 -0
  46. metadata +160 -0
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ rails-temp/*
@@ -0,0 +1,5 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ script: "bundle exec rake appraisal:install test"
@@ -0,0 +1,17 @@
1
+ appraise "rails2" do
2
+ gem "rails", "2.3.14"
3
+ end
4
+
5
+ appraise "rails3" do
6
+ gem "rails", "3.0.11"
7
+ end
8
+
9
+ appraise "rails31" do
10
+ gem "rails", "3.1.3"
11
+ gem "sass-rails"
12
+ end
13
+
14
+ appraise "rails32" do
15
+ gem "rails", "~> 3.2"
16
+ gem "sass-rails"
17
+ end
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in compass-rails.gemspec
4
+ gemspec
5
+
6
+ group :assets do
7
+ gem 'compass', :git => 'git://github.com/chriseppstein/compass.git', :branch => :master
8
+ gem 'compass-rails', :path => '.'
9
+ end
10
+
11
+ group :test do
12
+ gem 'mocha'
13
+ gem "appraisal", :git => 'git://github.com/scottdavis/appraisal.git'
14
+ gem 'rainbow'
15
+ end
16
+
17
+ unless ENV["CI"]
18
+ gem 'rb-fsevent', :require => false
19
+ gem 'ruby_gntp', :require => false
20
+ gem 'guard'
21
+ gem 'guard-test'
22
+ end
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :test, :cli => '-v v' do
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
6
+ watch(%r{^test/.+_test\.rb$})
7
+ watch('test/test_helper.rb') { "test" }
8
+
9
+ 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,191 @@
1
+ # CompassRails
2
+
3
+ Compass rails is an adapter for the [Compass Stylesheet Authoring
4
+ Framework](http://compass-style.org) for [Ruby on Rails](http://http://rubyonrails.org/).
5
+
6
+ Since Compass v0.12, this adapter is the only way to install compass
7
+ into your rails application.
8
+
9
+ This adapter supports rails versions 2.3 and greater. Rails 2.3 and 3.0 users
10
+ please read the caviats below.
11
+
12
+ ## Installation
13
+
14
+ Add the `compass-rails` gem line to a group called `:assets` in your application's Gemfile (Rails 3.1+ users should already have the `:assets` group):
15
+
16
+ ```ruby
17
+ group :assets do
18
+ gem 'compass-rails'
19
+ end
20
+ ```
21
+
22
+ If you are using any Compass extensions, add them to this group in your
23
+ Gemfile.
24
+
25
+ And then execute:
26
+
27
+ $ bundle
28
+
29
+ To set up your project with starter stylesheets and a configuration
30
+ file:
31
+
32
+ $ bundle exec compass init
33
+
34
+ If using a compass-based framework (like [susy](http://susy.oddbird.net/) or [blueprint](http://compass-style.org/reference/blueprint/)) then you can use the `--using` option to set thi:
35
+
36
+ $ bundle exec compass init --using blueprint
37
+
38
+ Note that the `compass init` step is optional if you have a project running Rails 3.0 or greater.
39
+
40
+ ## Upgrading existing rails projects using Compass to CompassRails
41
+
42
+ First and foremost, follow the installation instructions above.
43
+
44
+ CompassRails uses the rails convention for stylesheet locations even in
45
+ older versions of rails that do not use the assets pipeline.
46
+ If you have your stylesheets already in `app/stylesheets`, you have two choices:
47
+
48
+ 1. Move your stylesheets to `app/assets/stylesheets`.
49
+ 2. Configure your project to look in `app/assets/stylesheets` by setting
50
+ `config.compass.sass_dir = "app/stylesheets"` in your rails
51
+ configuration or by setting `sass_dir = "app/stylesheets"` in your
52
+ compass configuration file.
53
+
54
+ ## Configuration
55
+
56
+ If you have a compass configuration file (recommended) then you can
57
+ use the [Compass configuration
58
+ reference](http://compass-style.org/help/tutorials/configuration-reference/)
59
+ as is. If you choose to configure compass from your rails configuration
60
+ files, then you should understand that the compass configuration
61
+ options explained there will be methods and properties on the `config.compass`
62
+ configuration object exposed to rails within any configuration block.
63
+
64
+ ## Usage
65
+
66
+ ### Developing with Rails-based Compilation
67
+
68
+ By default, your sass files in `app/assets/stylesheets` will be
69
+ automatically compiled by the the [`Sass::Plugin`](http://sass-lang.com/docs/yardoc/Sass/Plugin.html) or the [Rails asset
70
+ pipeline](http://guides.rubyonrails.org/asset_pipeline.html) depending on the version of rails that you use.
71
+
72
+ When using this approach you will need to reload your webpage in order
73
+ to trigger a recompile of your stylesheets.
74
+
75
+ ### Developing with the Compass watcher
76
+
77
+ When using the Compass watcher to update your stylesheets, your
78
+ stylesheets are recompiled as soon as you save your Sass files. In this
79
+ mode, compiled stylesheets will be written to your project's public
80
+ folder and therefore will be served directly by your project's web
81
+ server -- superceding the normal rails compilation.
82
+
83
+ In this mode, rails 3.0 or earlier users will experience a slight
84
+ speed up by disabling the `Sass::Plugin` like so:
85
+
86
+ ```ruby
87
+ config.after_initialize do
88
+ Sass::Plugin.options[:never_update] = true
89
+ end
90
+ ```
91
+
92
+ To return to using the Rails-based compilation mode, simply delete
93
+ the compiled stylesheets and remove any configuration changes.
94
+
95
+ ### Compiling for Production
96
+
97
+ If using the Rails asset pipeline run:
98
+
99
+ $ rake assets:precompile
100
+
101
+ If not using the asset pipeline run:
102
+
103
+ $ bundle exec compass compile -e production --force
104
+
105
+ It is suggested that you compile your stylesheets as part of the deploy
106
+ or build process. However, some people choose to check in their compiled
107
+ stylesheets.
108
+
109
+ ### Installing Compass extensions
110
+
111
+ Step 1: If the extension is a rubygem, Add it to your Gemfile in the
112
+ `:assets` group and run the `bundle` command to install it.
113
+ If the extension is a zip file, unzip it into the
114
+ `vendor/plugins/compass_extensions` directory of your project.
115
+
116
+ Step 2: Install the extension's assets: `bundle exec compass install
117
+ <extension/template>`
118
+
119
+ For example, if you want to use susy.
120
+
121
+ ```ruby
122
+ # Gemfile
123
+ group :assets do
124
+ gem 'compass-rails'
125
+ gem 'compass-susy-plugin'
126
+ end
127
+ ```
128
+
129
+ then run:
130
+
131
+ $ bundle
132
+ $ bundle exec compass install susy
133
+
134
+ ### Notes On Sprockets Directives
135
+
136
+ Sprockets, used by the rails asset pipeline, provides directives for
137
+ doing things like requiring. These **must not** be used with Sass files.
138
+ Instead use the sass `@import` directive. In rails projects, the
139
+ `@import` directive is configured to work with sprockets via `sass-rails`. For more information on importing in rails 3.1 or greater see the [Sass-Rails REAME](https://github.com/rails/sass-rails/blob/master/README.markdown)
140
+
141
+ ## Rails 3.0 Caviats
142
+
143
+ If you want rails to compile your stylesheets (instead of using the
144
+ compass watcher) you need to edit `config/application.rb` and change:
145
+
146
+ ```ruby
147
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
148
+ ```
149
+
150
+ to this:
151
+
152
+ ```ruby
153
+ Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)
154
+ ```
155
+
156
+ ## Rails 2.3 Caviats
157
+
158
+ Compass requires that your rails 2.3 project is using Bundler to manage
159
+ your rubygems. If you haven't yet set up your rails 2.3 project to use Bundler,
160
+ please do so prior to upgrading. [Bundler installation guide for rails
161
+ 2.3](http://gembundler.com/rails23.html).
162
+
163
+ After following the instructions there, if you want rails to compile
164
+ your stylesheets (instead of using the compass watcher) you need
165
+ edit `config/boot.rb` and change this:
166
+
167
+ ```ruby
168
+ Rails::Initializer.class_eval do
169
+ def load_gems
170
+ @bundler_loaded ||= Bundler.require :default, Rails.env
171
+ end
172
+ end
173
+ ```
174
+
175
+ To this:
176
+
177
+ ```ruby
178
+ Rails::Initializer.class_eval do
179
+ def load_gems
180
+ @bundler_loaded ||= Bundler.require :default, :assets, Rails.env
181
+ end
182
+ end
183
+ ```
184
+
185
+ ## Contributing
186
+
187
+ 1. Fork it
188
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
189
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
190
+ 4. Push to the branch (`git push origin my-new-feature`)
191
+ 5. Create new Pull Request
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env rake
2
+ require 'rubygems'
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
+
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.rb']
22
+ test_files.exclude('test/rails/*', 'test/haml/*')
23
+ t.test_files = test_files
24
+ t.verbose = true
25
+ end
26
+
27
+ Rake::TestTask.new :units do |t|
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
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/compass-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Scott Davis", "Chris Eppstein"]
6
+ gem.email = ["jetviper21@gmail.com", "chris@eppsteins.net"]
7
+ gem.description = %q{Integrate Compass into Rails 2.3 and up.}
8
+ gem.summary = %q{Integrate Compass into Rails 2.3 and up.}
9
+ gem.homepage = "https://github.com/Compass/compass-rails"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "compass-rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = CompassRails::VERSION
17
+
18
+ gem.add_dependency 'rails'
19
+ gem.add_dependency 'compass', '~> 0.12.rc.0'
20
+
21
+ end
@@ -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", "2.3.14"
10
+
11
+ group :assets do
12
+ gem "compass", :git=>"git://github.com/chriseppstein/compass.git", :branch=>:master
13
+ gem "compass-rails", :path=>".."
14
+ end
15
+ group :test do
16
+ gem "mocha"
17
+ gem "appraisal", :git=>"git://github.com/scottdavis/appraisal.git"
18
+ gem "rainbow"
19
+ end
20
+
21
+ gemspec :path=>"../"
@@ -0,0 +1,87 @@
1
+ GIT
2
+ remote: git://github.com/chriseppstein/compass.git
3
+ revision: addbc94716e95a7e6f200baa980b48c7e7a1a568
4
+ branch: master
5
+ specs:
6
+ compass (0.12.rc.4.addbc94)
7
+ chunky_png (~> 1.2)
8
+ fssm (>= 0.2.7)
9
+ sass (~> 3.1)
10
+
11
+ GIT
12
+ remote: git://github.com/scottdavis/appraisal.git
13
+ revision: b39ce49f69e330ccd5a1cb48e690f00e800a45d3
14
+ specs:
15
+ appraisal (0.4.0)
16
+ bundler
17
+ rake
18
+
19
+ PATH
20
+ remote: ..
21
+ specs:
22
+ compass-rails (1.0.0.rc.0)
23
+ compass (~> 0.12.rc.0)
24
+ rails
25
+
26
+ PATH
27
+ remote: ..
28
+ specs:
29
+ compass-rails (1.0.0.rc.0)
30
+ compass (~> 0.12.rc.0)
31
+ rails
32
+
33
+ GEM
34
+ remote: https://rubygems.org/
35
+ specs:
36
+ actionmailer (2.3.14)
37
+ actionpack (= 2.3.14)
38
+ actionpack (2.3.14)
39
+ activesupport (= 2.3.14)
40
+ rack (~> 1.1.0)
41
+ activerecord (2.3.14)
42
+ activesupport (= 2.3.14)
43
+ activeresource (2.3.14)
44
+ activesupport (= 2.3.14)
45
+ activesupport (2.3.14)
46
+ chunky_png (1.2.5)
47
+ ffi (1.0.11)
48
+ fssm (0.2.8.1)
49
+ guard (1.0.0)
50
+ ffi (>= 0.5.0)
51
+ thor (~> 0.14.6)
52
+ guard-test (0.4.3)
53
+ guard (>= 0.4)
54
+ test-unit (~> 2.2)
55
+ metaclass (0.0.1)
56
+ mocha (0.10.3)
57
+ metaclass (~> 0.0.1)
58
+ rack (1.1.3)
59
+ rails (2.3.14)
60
+ actionmailer (= 2.3.14)
61
+ actionpack (= 2.3.14)
62
+ activerecord (= 2.3.14)
63
+ activeresource (= 2.3.14)
64
+ activesupport (= 2.3.14)
65
+ rake (>= 0.8.3)
66
+ rainbow (1.1.3)
67
+ rake (0.9.2.2)
68
+ rb-fsevent (0.9.0)
69
+ ruby_gntp (0.3.4)
70
+ sass (3.1.12)
71
+ test-unit (2.4.5)
72
+ thor (0.14.6)
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ appraisal!
79
+ compass!
80
+ compass-rails!
81
+ guard
82
+ guard-test
83
+ mocha
84
+ rails (= 2.3.14)
85
+ rainbow
86
+ rb-fsevent
87
+ ruby_gntp