compass-rails 1.0.3 → 1.1.3
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.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/.travis.yml +1 -2
- data/Appraisals +6 -5
- data/Gemfile +4 -3
- data/README.md +50 -63
- data/changelog.markdown +11 -0
- data/compass-rails.gemspec +6 -5
- data/gemfiles/rails3.gemfile +3 -2
- data/gemfiles/rails31.gemfile +3 -2
- data/gemfiles/rails32.gemfile +3 -2
- data/gemfiles/{rails2.gemfile → rails40.gemfile} +5 -3
- data/lib/compass-rails/configuration/{3_1.rb → asset_pipeline.rb} +5 -1
- data/lib/compass-rails/patches/3_1.rb +1 -14
- data/lib/compass-rails/patches/4_0.rb +25 -0
- data/lib/compass-rails/patches/compass.rb +12 -0
- data/lib/compass-rails/patches/sass_importer.rb +31 -0
- data/lib/compass-rails/patches/sprite_importer.rb +15 -23
- data/lib/compass-rails/patches/static_compiler.rb +1 -1
- data/lib/compass-rails/patches.rb +4 -4
- data/lib/compass-rails/railties/3_1.rb +10 -6
- data/lib/compass-rails/railties/4_0.rb +102 -0
- data/lib/compass-rails/railties.rb +4 -4
- data/lib/compass-rails/version.rb +1 -1
- data/lib/compass-rails.rb +27 -15
- data/test/helpers/file_helper.rb +6 -6
- data/test/helpers/rails_helper.rb +15 -16
- data/test/helpers/rails_project.rb +9 -73
- data/test/integrations/rails3_test.rb +4 -4
- data/test/integrations/rails_32_without_pipeline_test.rb +37 -0
- data/test/integrations/{rails_23_test.rb → rails_40_test.rb} +21 -3
- metadata +30 -32
- data/gemfiles/rails2.gemfile.lock +0 -81
- data/gemfiles/rails3.gemfile.lock +0 -128
- data/gemfiles/rails31.gemfile.lock +0 -145
- data/gemfiles/rails32.gemfile.lock +0 -142
- data/lib/compass-rails/railties/2_3.rb +0 -56
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#3.1.3
|
|
2
|
+
require 'compass'
|
|
3
|
+
require 'rails/railtie'
|
|
4
|
+
|
|
5
|
+
class Rails::Railtie::Configuration
|
|
6
|
+
# Adds compass configuration accessor to the application configuration.
|
|
7
|
+
#
|
|
8
|
+
# If a configuration file for compass exists, it will be read in and
|
|
9
|
+
# the project's configuration values will already be set on the config
|
|
10
|
+
# object.
|
|
11
|
+
#
|
|
12
|
+
# For example:
|
|
13
|
+
#
|
|
14
|
+
# module MyApp
|
|
15
|
+
# class Application < Rails::Application
|
|
16
|
+
# config.compass.line_comments = !Rails.env.production?
|
|
17
|
+
# config.compass.fonts_dir = "app/assets/fonts"
|
|
18
|
+
# end
|
|
19
|
+
# end
|
|
20
|
+
#
|
|
21
|
+
# It is suggested that you create a compass configuration file if you
|
|
22
|
+
# want a quicker boot time when using the compass command line tool.
|
|
23
|
+
#
|
|
24
|
+
# For more information on available configuration options see:
|
|
25
|
+
# http://compass-style.org/help/tutorials/configuration-reference/
|
|
26
|
+
def compass
|
|
27
|
+
@compass ||= begin
|
|
28
|
+
data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file))
|
|
29
|
+
config_data
|
|
30
|
+
else
|
|
31
|
+
Compass::Configuration::Data.new("rails_config")
|
|
32
|
+
end
|
|
33
|
+
data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded.
|
|
34
|
+
Compass.add_configuration(:rails)
|
|
35
|
+
Compass.add_configuration(data)
|
|
36
|
+
Compass.configuration.on_sprite_saved do |filename|
|
|
37
|
+
# This is a huge hack based on reading through the sprockets internals.
|
|
38
|
+
# Sprockets needs an API for adding assets during precompilation.
|
|
39
|
+
# At a minimum sprockets should provide this API:
|
|
40
|
+
#
|
|
41
|
+
# #filename is a path in the asset source directory
|
|
42
|
+
# Rails.application.assets.new_asset!(filename)
|
|
43
|
+
#
|
|
44
|
+
# # logical_path is how devs refer to it, data is the contents of it.
|
|
45
|
+
# Rails.application.assets.new_asset!(logical_path, data)
|
|
46
|
+
#
|
|
47
|
+
# I would also like to select one of the above calls based on whether
|
|
48
|
+
# the user is precompiling or not:
|
|
49
|
+
#
|
|
50
|
+
# Rails.application.assets.precompiling? #=> true or false
|
|
51
|
+
#
|
|
52
|
+
# But even the above is not an ideal API. The issue is that compass sprites need to
|
|
53
|
+
# avoid generation if the sprite file is already generated (which can be quite time
|
|
54
|
+
# consuming). To do this, compass has it's own uniqueness hash based on the user's
|
|
55
|
+
# inputs instead of being based on the file contents. So if we could provide our own
|
|
56
|
+
# hash or some metadata that is opaque to sprockets that could be read from the
|
|
57
|
+
# asset's attributes, we could avoid cluttering the assets directory with generated
|
|
58
|
+
# sprites and always just use the logical_path + data version of the api.
|
|
59
|
+
if Rails.application.config.assets.digest && # if digesting is enabled
|
|
60
|
+
caller.grep(%r{/sprockets/rails/task.rb}).any? && #OMG HAX - check if we're being precompiled
|
|
61
|
+
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
|
|
62
|
+
|
|
63
|
+
# Clear entries in Hike::Index for this sprite's directory.
|
|
64
|
+
# This makes sure the asset can be found by find_assets
|
|
65
|
+
Rails.application.assets.send(:trail).instance_variable_get(:@entries).delete(File.dirname(filename))
|
|
66
|
+
|
|
67
|
+
pathname = Pathname.new(filename)
|
|
68
|
+
logical_path = pathname.relative_path_from(Pathname.new(Compass.configuration.images_path))
|
|
69
|
+
asset = Rails.application.assets.find_asset(logical_path)
|
|
70
|
+
target = File.join(Rails.public_path, Rails.application.config.assets.prefix, asset.digest_path)
|
|
71
|
+
|
|
72
|
+
# Adds the asset to the manifest file.
|
|
73
|
+
|
|
74
|
+
manifest = ActionView::Base.assets_manifest
|
|
75
|
+
manifest.assets[logical_path.to_s] = asset.digest_path
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# Adds the fingerprinted asset to the public directory
|
|
79
|
+
FileUtils.mkdir_p File.dirname(target)
|
|
80
|
+
asset.write_to target
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
data
|
|
85
|
+
end
|
|
86
|
+
@compass
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
module CompassRails
|
|
91
|
+
class Railtie < Rails::Railtie
|
|
92
|
+
|
|
93
|
+
initializer "compass.initialize_rails", :group => :all do |app|
|
|
94
|
+
require 'compass-rails/patches/4_0'
|
|
95
|
+
# Configure compass for use within rails, and provide the project configuration
|
|
96
|
+
# that came via the rails boot process.
|
|
97
|
+
CompassRails.check_for_double_boot!
|
|
98
|
+
Compass.discover_extensions!
|
|
99
|
+
CompassRails.configure_rails!(app)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
if defined?(::Rails)
|
|
2
|
-
if CompassRails.
|
|
3
|
-
require "compass-rails/railties/2_3"
|
|
4
|
-
elsif CompassRails.rails31? || CompassRails.rails32?
|
|
2
|
+
if CompassRails.rails31? || CompassRails.rails32?
|
|
5
3
|
require "compass-rails/railties/3_1"
|
|
6
4
|
elsif CompassRails.rails3?
|
|
7
5
|
require "compass-rails/railties/3_0"
|
|
6
|
+
elsif CompassRails.rails4?
|
|
7
|
+
require "compass-rails/railties/4_0"
|
|
8
8
|
else
|
|
9
9
|
$stderr.puts "Unsupported rails environment for compass"
|
|
10
10
|
end
|
|
11
|
-
end
|
|
11
|
+
end
|
data/lib/compass-rails.rb
CHANGED
|
@@ -4,14 +4,15 @@ require "compass-rails/configuration"
|
|
|
4
4
|
|
|
5
5
|
module CompassRails
|
|
6
6
|
|
|
7
|
+
RAILS_4 = %r{^4.[0|1]}
|
|
7
8
|
RAILS_32 = %r{^3.2}
|
|
8
9
|
RAILS_31 = %r{^3.1}
|
|
9
|
-
RAILS_23 = %r{^2.3}
|
|
10
10
|
RAILS_3 = %r{^3.0}
|
|
11
11
|
|
|
12
12
|
extend self
|
|
13
13
|
|
|
14
14
|
def load_rails
|
|
15
|
+
return true if rails_loaded?
|
|
15
16
|
return if defined?(::Rails) && ::Rails.respond_to?(:application) && !::Rails.application.nil?
|
|
16
17
|
|
|
17
18
|
rails_config_path = Dir.pwd
|
|
@@ -21,7 +22,7 @@ module CompassRails
|
|
|
21
22
|
end
|
|
22
23
|
#load the rails config
|
|
23
24
|
require "#{rails_config_path}/config/application.rb"
|
|
24
|
-
if rails31? || rails32?
|
|
25
|
+
if rails31? || rails32? || rails4?
|
|
25
26
|
require 'sass-rails'
|
|
26
27
|
require 'sprockets/railtie'
|
|
27
28
|
require 'rails/engine'
|
|
@@ -85,21 +86,30 @@ module CompassRails
|
|
|
85
86
|
|
|
86
87
|
def rails3?
|
|
87
88
|
return false unless defined?(::Rails)
|
|
88
|
-
|
|
89
|
+
version_match RAILS_3
|
|
89
90
|
end
|
|
90
91
|
|
|
91
92
|
def rails31?
|
|
92
93
|
return false unless defined?(::Rails)
|
|
93
|
-
|
|
94
|
+
version_match RAILS_31
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
def rails32?
|
|
97
98
|
return false unless defined?(::Rails)
|
|
98
|
-
|
|
99
|
+
version_match RAILS_32
|
|
99
100
|
end
|
|
100
101
|
|
|
101
|
-
def
|
|
102
|
-
|
|
102
|
+
def rails4?
|
|
103
|
+
return false unless defined?(::Rails)
|
|
104
|
+
version_match RAILS_4
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def version_match(version)
|
|
108
|
+
if (rails_version =~ version).nil?
|
|
109
|
+
return false
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
true
|
|
103
113
|
end
|
|
104
114
|
|
|
105
115
|
def booted!
|
|
@@ -111,14 +121,12 @@ module CompassRails
|
|
|
111
121
|
end
|
|
112
122
|
|
|
113
123
|
def configuration
|
|
114
|
-
load_rails
|
|
124
|
+
load_rails
|
|
115
125
|
config = Compass::Configuration::Data.new('rails')
|
|
116
126
|
config.extend(Configuration::Default)
|
|
117
|
-
if
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
config.extend(Configuration::Rails3_1)
|
|
121
|
-
end
|
|
127
|
+
if asset_pipeline_enabled?
|
|
128
|
+
require "compass-rails/configuration/asset_pipeline"
|
|
129
|
+
config.extend(Configuration::AssetPipeline)
|
|
122
130
|
end
|
|
123
131
|
config
|
|
124
132
|
end
|
|
@@ -165,7 +173,7 @@ module CompassRails
|
|
|
165
173
|
end
|
|
166
174
|
end
|
|
167
175
|
|
|
168
|
-
# Rails
|
|
176
|
+
# Rails projects without asset pipeline use this in their compass initializer.
|
|
169
177
|
def initialize!(config = nil)
|
|
170
178
|
check_for_double_boot!
|
|
171
179
|
config ||= Compass.detect_configuration_file(root)
|
|
@@ -210,7 +218,11 @@ module CompassRails
|
|
|
210
218
|
def asset_pipeline_enabled?
|
|
211
219
|
return false unless rails_loaded?
|
|
212
220
|
rails_config = ::Rails.application.config
|
|
213
|
-
rails_config.respond_to?(:assets)
|
|
221
|
+
if rails_config.respond_to?(:assets)
|
|
222
|
+
rails_config.assets.enabled != false
|
|
223
|
+
else
|
|
224
|
+
false
|
|
225
|
+
end
|
|
214
226
|
end
|
|
215
227
|
|
|
216
228
|
private
|
data/test/helpers/file_helper.rb
CHANGED
|
@@ -30,18 +30,18 @@ module CompassRails
|
|
|
30
30
|
debug("Touching File: #{file}".foreground(:green))
|
|
31
31
|
::FileUtils.touch(file)
|
|
32
32
|
end
|
|
33
|
-
|
|
34
|
-
def inject_into_file(file_name,
|
|
33
|
+
|
|
34
|
+
def inject_into_file(file_name, replacement, position, anchor)
|
|
35
35
|
case position
|
|
36
36
|
when :after
|
|
37
|
-
replace(file_name, Regexp.escape(anchor), "#{anchor}#{
|
|
37
|
+
replace(file_name, Regexp.escape(anchor), "#{anchor}#{replacement}")
|
|
38
38
|
when :before
|
|
39
|
-
replace(file_name, Regexp.escape(anchor), "#{
|
|
39
|
+
replace(file_name, Regexp.escape(anchor), "#{replacement}#{anchor}")
|
|
40
40
|
else
|
|
41
41
|
raise Compass::FilesystemConflict.new("You need to specify :before or :after")
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
def replace(destination, regexp, string)
|
|
46
46
|
content = File.read(destination)
|
|
47
47
|
content.gsub!(Regexp.new(regexp), string)
|
|
@@ -50,4 +50,4 @@ module CompassRails
|
|
|
50
50
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
-
end
|
|
53
|
+
end
|
|
@@ -5,32 +5,32 @@ module CompassRails
|
|
|
5
5
|
include FileHelper
|
|
6
6
|
include DebugHelper
|
|
7
7
|
include CommandHelper
|
|
8
|
+
RAILS_4_0 = "4.0"
|
|
8
9
|
RAILS_3_2 = "3.2"
|
|
9
10
|
RAILS_3_1 = "3.1"
|
|
10
11
|
RAILS_3 = "3.0"
|
|
11
|
-
RAILS_2 = "2.3"
|
|
12
12
|
|
|
13
13
|
WORKING_DIR = File.join(ROOT_PATH, 'rails-temp')
|
|
14
14
|
|
|
15
15
|
GEMFILES = {
|
|
16
|
+
RAILS_4_0 => GEMFILES_DIR.join("rails40.gemfile").to_s,
|
|
16
17
|
RAILS_3_2 => GEMFILES_DIR.join("rails32.gemfile").to_s,
|
|
17
18
|
RAILS_3_1 => GEMFILES_DIR.join("rails31.gemfile").to_s,
|
|
18
|
-
RAILS_3 => GEMFILES_DIR.join("rails3.gemfile").to_s
|
|
19
|
-
RAILS_2 => GEMFILES_DIR.join("rails2.gemfile").to_s
|
|
19
|
+
RAILS_3 => GEMFILES_DIR.join("rails3.gemfile").to_s
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
GENERATOR_OPTIONS = {
|
|
23
|
+
RAILS_4_0 => ['-q', '-G', '-O', '--skip-bundle'],
|
|
23
24
|
RAILS_3_2 => ['-q', '-G', '-O', '--skip-bundle'],
|
|
24
25
|
RAILS_3_1 => ['-q', '-G', '-O', '--skip-bundle'],
|
|
25
|
-
RAILS_3 => ['-q', '-G', '-O', '--skip-bundle']
|
|
26
|
-
RAILS_2 => ['-q']
|
|
26
|
+
RAILS_3 => ['-q', '-G', '-O', '--skip-bundle']
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
GENERATOR_COMMAND = {
|
|
30
|
+
RAILS_4_0 => 'new',
|
|
30
31
|
RAILS_3_2 => 'new',
|
|
31
32
|
RAILS_3_1 => 'new',
|
|
32
|
-
RAILS_3 => 'new'
|
|
33
|
-
RAILS_2 => ''
|
|
33
|
+
RAILS_3 => 'new'
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
def rails_command(options, version)
|
|
@@ -42,24 +42,23 @@ module CompassRails
|
|
|
42
42
|
# with the rails libraries. This will allow testing against multiple versions of rails
|
|
43
43
|
# by manipulating the load path.
|
|
44
44
|
def generate_rails_app(name, version, options=[])
|
|
45
|
-
options +=
|
|
45
|
+
options += GENERATOR_OPTIONS[version]
|
|
46
46
|
rails_command([GENERATOR_COMMAND[version], name, *options], version)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def within_rails_app(named, version, &block)
|
|
49
|
+
def within_rails_app(named, version, asset_pipeline_enabled = true, &block)
|
|
50
50
|
dir = "#{named}-#{version}"
|
|
51
51
|
rm_rf File.join(WORKING_DIR, dir)
|
|
52
52
|
mkdir_p WORKING_DIR
|
|
53
53
|
cd(WORKING_DIR) do
|
|
54
|
-
generate_rails_app(dir, version)
|
|
54
|
+
generate_rails_app(dir, version, asset_pipeline_enabled ? [] : ["-S"])
|
|
55
55
|
cd(dir) do
|
|
56
|
-
yield RailsProject.new(File.join(WORKING_DIR, dir), version)
|
|
56
|
+
yield RailsProject.new(File.join(WORKING_DIR, dir), version, asset_pipeline_enabled)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
rm_rf File.join(WORKING_DIR, dir)
|
|
60
60
|
end
|
|
61
|
-
|
|
62
61
|
|
|
63
62
|
end
|
|
64
63
|
end
|
|
65
|
-
end
|
|
64
|
+
end
|
|
@@ -16,16 +16,16 @@ module CompassRails
|
|
|
16
16
|
BOOT_FILE = 'config/boot.rb'
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
attr_reader :directory, :version
|
|
19
|
+
attr_reader :directory, :version, :asset_pipeline_enabled
|
|
20
20
|
|
|
21
|
-
def initialize(directory, version)
|
|
21
|
+
def initialize(directory, version, asset_pipeline_enabled = true)
|
|
22
22
|
@directory = Pathname.new(directory)
|
|
23
23
|
@version = version
|
|
24
|
-
|
|
24
|
+
@asset_pipeline_enabled = asset_pipeline_enabled
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
## FILE METHODS
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
def to_s
|
|
30
30
|
directory_name
|
|
31
31
|
end
|
|
@@ -39,10 +39,9 @@ module CompassRails
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def screen_file
|
|
42
|
-
|
|
43
|
-
when RAILS_3_1, RAILS_3_2
|
|
42
|
+
if asset_pipeline_enabled
|
|
44
43
|
return directory.join('app', 'assets', 'stylesheets', 'screen.css.scss')
|
|
45
|
-
|
|
44
|
+
else
|
|
46
45
|
return directory.join('app', 'assets', 'stylesheets','screen.scss')
|
|
47
46
|
end
|
|
48
47
|
end
|
|
@@ -65,10 +64,6 @@ module CompassRails
|
|
|
65
64
|
directory.join(APPLICATION_FILE).exist?
|
|
66
65
|
end
|
|
67
66
|
|
|
68
|
-
def rails2?
|
|
69
|
-
directory.join(BOOT_FILE).exist? && !directory.join(APPLICATION_FILE).exist?
|
|
70
|
-
end
|
|
71
|
-
|
|
72
67
|
def boots?
|
|
73
68
|
string = 'THIS IS MY RANDOM AWESOME TEST STRING'
|
|
74
69
|
test_string = "puts \"#{string}\""
|
|
@@ -82,12 +77,7 @@ module CompassRails
|
|
|
82
77
|
end
|
|
83
78
|
|
|
84
79
|
def runner(string)
|
|
85
|
-
|
|
86
|
-
when RAILS_3_1, RAILS_3, RAILS_3_2
|
|
87
|
-
rails_command(['runner', "'#{string}'"], version)
|
|
88
|
-
when RAILS_2
|
|
89
|
-
run_command("script/runner '#{string}'", GEMFILES[version])
|
|
90
|
-
end
|
|
80
|
+
rails_command(['runner', "'#{string}'"], version)
|
|
91
81
|
end
|
|
92
82
|
|
|
93
83
|
# COMPASS METHODS
|
|
@@ -110,61 +100,7 @@ module CompassRails
|
|
|
110
100
|
else
|
|
111
101
|
"\n config.#{property} = '#{value}'\n"
|
|
112
102
|
end
|
|
113
|
-
inject_into_file(directory.join(APPLICATION_FILE), value, :after, '
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
## GEM METHODS
|
|
117
|
-
|
|
118
|
-
def configure_for_bundler!
|
|
119
|
-
return if [RAILS_3_1, RAILS_3, RAILS_3_2].include?(version)
|
|
120
|
-
bundle = <<-BUNDLER
|
|
121
|
-
class Rails::Boot
|
|
122
|
-
def run
|
|
123
|
-
load_initializer
|
|
124
|
-
|
|
125
|
-
Rails::Initializer.class_eval do
|
|
126
|
-
def load_gems
|
|
127
|
-
@bundler_loaded ||= Bundler.require :default, Rails.env
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
Rails::Initializer.run(:set_load_path)
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
BUNDLER
|
|
135
|
-
inject_into_file(directory.join('config/boot.rb'), bundle, :before, 'Rails.boot!')
|
|
136
|
-
|
|
137
|
-
touch directory.join('config/preinitializer.rb')
|
|
138
|
-
preinit = <<-PREINIT
|
|
139
|
-
begin
|
|
140
|
-
require "rubygems"
|
|
141
|
-
require "bundler"
|
|
142
|
-
rescue LoadError
|
|
143
|
-
raise "Could not load the bundler gem. Install it with `gem install bundler`."
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
|
|
147
|
-
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
|
|
148
|
-
"Run `gem install bundler` to upgrade."
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
begin
|
|
152
|
-
# Set up load paths for all bundled gems
|
|
153
|
-
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
|
|
154
|
-
Bundler.setup
|
|
155
|
-
rescue Bundler::GemNotFound
|
|
156
|
-
raise RuntimeError, "Bundler couldn't find some gems." +
|
|
157
|
-
"Did you run `bundle install`?"
|
|
158
|
-
end
|
|
159
|
-
PREINIT
|
|
160
|
-
inject_at_bottom(directory.join('config/preinitializer.rb'), preinit)
|
|
161
|
-
|
|
162
|
-
touch directory.join('Gemfile')
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def bundle
|
|
167
|
-
raise "NO BUNDLE FOR U"
|
|
103
|
+
inject_into_file(directory.join(APPLICATION_FILE), value, :after, 'class Application < Rails::Application')
|
|
168
104
|
end
|
|
169
105
|
|
|
170
106
|
private
|
|
@@ -183,4 +119,4 @@ module CompassRails
|
|
|
183
119
|
end
|
|
184
120
|
end
|
|
185
121
|
end
|
|
186
|
-
end
|
|
122
|
+
end
|
|
@@ -4,13 +4,13 @@ class Rails3Test < Test::Unit::TestCase
|
|
|
4
4
|
RAILS_VERSION = RAILS_3
|
|
5
5
|
|
|
6
6
|
def test_rails_app_created
|
|
7
|
-
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
7
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
8
8
|
assert project.boots?
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def test_installs_compass
|
|
13
|
-
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
13
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
14
14
|
project.run_compass('init')
|
|
15
15
|
assert project.has_config?
|
|
16
16
|
assert project.has_screen_file?
|
|
@@ -19,7 +19,7 @@ class Rails3Test < Test::Unit::TestCase
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def test_compass_compile
|
|
22
|
-
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
22
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
23
23
|
project.run_compass('init')
|
|
24
24
|
project.run_compass('compile')
|
|
25
25
|
assert project.directory.join('public/stylesheets/screen.css').exist?
|
|
@@ -27,7 +27,7 @@ class Rails3Test < Test::Unit::TestCase
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def test_install_blueprint
|
|
30
|
-
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
30
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
31
31
|
project.run_compass('init')
|
|
32
32
|
project.run_compass('install blueprint --force')
|
|
33
33
|
assert project.directory.join('app/assets/stylesheets/partials').directory?
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
class Rails32WithoutPipelineTest < Test::Unit::TestCase
|
|
3
|
+
include CompassRails::Test::RailsHelpers
|
|
4
|
+
RAILS_VERSION = RAILS_3_2
|
|
5
|
+
|
|
6
|
+
def test_rails_app_created
|
|
7
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
8
|
+
assert project.boots?
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_installs_compass
|
|
13
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
14
|
+
project.run_compass('init')
|
|
15
|
+
assert project.has_config?
|
|
16
|
+
assert project.has_screen_file?
|
|
17
|
+
assert project.has_compass_import?
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_compass_compile
|
|
22
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
23
|
+
project.run_compass('init')
|
|
24
|
+
project.run_compass('compile')
|
|
25
|
+
assert project.directory.join('public/stylesheets/screen.css').exist?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_install_blueprint
|
|
30
|
+
within_rails_app('test_railtie', RAILS_VERSION, false) do |project|
|
|
31
|
+
project.run_compass('init')
|
|
32
|
+
project.run_compass('install blueprint --force')
|
|
33
|
+
assert project.directory.join('app/assets/stylesheets/partials').directory?
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
|
-
class
|
|
2
|
+
class Rails40Test < Test::Unit::TestCase
|
|
3
3
|
include CompassRails::Test::RailsHelpers
|
|
4
|
-
RAILS_VERSION =
|
|
4
|
+
RAILS_VERSION = RAILS_4_0
|
|
5
5
|
|
|
6
6
|
def test_rails_app_created
|
|
7
7
|
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
@@ -9,6 +9,7 @@ class Rails23Test < Test::Unit::TestCase
|
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def test_installs_compass
|
|
13
14
|
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
14
15
|
project.run_compass('init')
|
|
@@ -18,11 +19,28 @@ class Rails23Test < Test::Unit::TestCase
|
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
|
|
22
|
+
def test_compass_compile
|
|
23
|
+
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
24
|
+
project.run_compass('init')
|
|
25
|
+
project.run_compass('compile')
|
|
26
|
+
assert project.directory.join('public/assets/screen.css').exist?
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
21
30
|
def test_install_blueprint
|
|
22
31
|
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
32
|
+
project.run_compass('init')
|
|
23
33
|
project.run_compass('install blueprint --force')
|
|
24
34
|
assert project.directory.join('app/assets/stylesheets/partials').directory?
|
|
25
35
|
end
|
|
26
36
|
end
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
def test_compass_preferred_syntax
|
|
39
|
+
within_rails_app('test_railtie', RAILS_VERSION) do |project|
|
|
40
|
+
project.set_rails('sass.preferred_syntax', :sass)
|
|
41
|
+
project.run_compass('init')
|
|
42
|
+
assert project.directory.join('app/assets/stylesheets/screen.css.sass').exist?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|