compass 0.12.alpha.4 → 0.12.rc.0

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 (53) hide show
  1. data/VERSION.yml +2 -2
  2. data/bin/compass +4 -0
  3. data/features/command_line.feature +0 -10
  4. data/features/extensions.feature +0 -10
  5. data/features/step_definitions/command_line_steps.rb +0 -12
  6. data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +2 -2
  7. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +1 -1
  8. data/lib/compass/app_integration.rb +26 -11
  9. data/lib/compass/commands/project_structure.rb +93 -0
  10. data/lib/compass/commands/update_project.rb +0 -1
  11. data/lib/compass/commands/watch_project.rb +6 -1
  12. data/lib/compass/compiler.rb +2 -1
  13. data/lib/compass/configuration.rb +6 -1
  14. data/lib/compass/configuration/data.rb +9 -3
  15. data/lib/compass/configuration/helpers.rb +7 -21
  16. data/lib/compass/configuration/inheritance.rb +101 -0
  17. data/lib/compass/configuration/serialization.rb +17 -7
  18. data/lib/compass/errors.rb +1 -0
  19. data/lib/compass/installers/manifest.rb +10 -5
  20. data/lib/compass/sass_extensions/functions/display.rb +1 -0
  21. data/lib/compass/sass_extensions/functions/trig.rb +1 -1
  22. data/lib/compass/sass_extensions/sprites.rb +0 -1
  23. data/lib/compass/sass_extensions/sprites/image.rb +1 -1
  24. data/lib/compass/sprite_importer.rb +4 -1
  25. data/test/fixtures/stylesheets/compass/css/background-clip.css +10 -0
  26. data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
  27. data/test/fixtures/stylesheets/compass/sass/background-clip.scss +8 -0
  28. data/test/test_helper.rb +2 -2
  29. data/test/units/compiler_test.rb +11 -0
  30. data/test/units/configuration_test.rb +144 -0
  31. data/test/units/sprites/sprite_command_test.rb +4 -3
  32. metadata +12 -30
  33. data/examples/compass/compass_app_log.txt +0 -6
  34. data/features/rails_integration.feature +0 -32
  35. data/lib/compass/app_integration/merb.rb +0 -1
  36. data/lib/compass/app_integration/merb/runtime.rb +0 -63
  37. data/lib/compass/app_integration/rails.rb +0 -83
  38. data/lib/compass/app_integration/rails/actionpack2x.rb +0 -10
  39. data/lib/compass/app_integration/rails/actionpack2x/action_controller.rb +0 -15
  40. data/lib/compass/app_integration/rails/actionpack2x/sass_plugin.rb +0 -5
  41. data/lib/compass/app_integration/rails/actionpack2x/urls.rb +0 -18
  42. data/lib/compass/app_integration/rails/actionpack30.rb +0 -11
  43. data/lib/compass/app_integration/rails/actionpack30/railtie.rb +0 -46
  44. data/lib/compass/app_integration/rails/actionpack31.rb +0 -5
  45. data/lib/compass/app_integration/rails/actionpack31/helpers.rb +0 -28
  46. data/lib/compass/app_integration/rails/actionpack31/railtie.rb +0 -87
  47. data/lib/compass/app_integration/rails/configuration_defaults.rb +0 -123
  48. data/lib/compass/app_integration/rails/installer.rb +0 -182
  49. data/lib/compass/app_integration/rails/runtime.rb +0 -17
  50. data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +0 -78
  51. data/test/integrations/rails_integration_test.rb +0 -51
  52. data/test/integrations/test_rails_helper.rb +0 -20
  53. data/test/units/rails_configuration_test.rb +0 -50
@@ -1,6 +0,0 @@
1
- 2011-12-22 23:55:48 overwrite stylesheets/bp_layout.css
2
- 2011-12-22 23:55:48 identical stylesheets/compass.css
3
- 2011-12-22 23:55:49 overwrite stylesheets/pie.css
4
- 2011-12-22 23:59:05 identical stylesheets/bp_layout.css
5
- 2011-12-22 23:59:05 identical stylesheets/compass.css
6
- 2011-12-22 23:59:05 identical stylesheets/pie.css
@@ -1,32 +0,0 @@
1
- Feature: Rails Integration
2
- In order to provide an integrated experience
3
- As a Ruby on Rails user
4
- I want to easily access the Compass functionality
5
-
6
- Scenario: Configure Compass from my Application
7
- Given I'm in a rails3.1 application named 'exemplar'
8
- When I edit 'config/application.rb' and save it with the following value:
9
- """
10
- require File.expand_path('../boot', __FILE__)
11
- require 'rails/all'
12
- Bundler.require(:default, Rails.env) if defined?(Bundler)
13
- module Exemplar
14
- class Application < Rails::Application
15
- config.encoding = "utf-8"
16
- config.filter_parameters += [:password]
17
-
18
- config.compass.fonts_dir = "app/assets/fonts"
19
- end
20
- end
21
- """
22
- And I run: compass config -p fonts_dir
23
- Then the command should print out "app/assets/fonts"
24
- Scenario: Rails gets access to the compass config file
25
- Given I'm in a rails3.1 application named 'exemplar'
26
- When I edit 'config/compass.rb' and save it with the following value:
27
- """
28
- fonts_dir = "app/assets/fonts"
29
- """
30
- And I run: ruby -I. -rconfig/environment -e 'puts Compass.configuration.fonts_dir'
31
- Then the command should print out "app/assets/fonts"
32
-
@@ -1 +0,0 @@
1
- require 'compass/app_integration/merb/runtime' if defined?(Merb::Plugins)
@@ -1,63 +0,0 @@
1
- # To configure Merb to use compass do the following:
2
- #
3
- # Add dependencies to config/dependencies.rb
4
- #
5
- # dependency "haml", ">=2.2.0"
6
- # dependency "merb-haml", merb_gems_version
7
- # dependency "chriseppstein-compass", :require_as => 'compass'
8
- #
9
- #
10
- # To use a different sass stylesheets locations as is recommended by compass
11
- # add this configuration to your configuration block:
12
- #
13
- # Merb::BootLoader.before_app_loads do
14
- # Merb::Plugins.config[:compass] = {
15
- # :stylesheets => "app/stylesheets",
16
- # :compiled_stylesheets => "public/stylesheets/compiled"
17
- # }
18
- # end
19
- #
20
- module Compass
21
- def self.setup_template_location
22
- # default the compass configuration if they didn't set it up yet.
23
- Merb::Plugins.config[:compass] ||= {}
24
-
25
- # default sass stylesheet location unless configured to something else
26
- Merb::Plugins.config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass"
27
-
28
- # default sass css location unless configured to something else
29
- Merb::Plugins.config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet)
30
-
31
- #define the template hash for the project stylesheets as well as the framework stylesheets.
32
- template_location = {
33
- Merb::Plugins.config[:compass][:stylesheets] => Merb::Plugins.config[:compass][:compiled_stylesheets]
34
- }
35
- Compass::Frameworks::ALL.each do |framework|
36
- template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets]
37
- end
38
-
39
- # merge existing template locations if present
40
- if Merb::Plugins.config[:sass][:template_location].is_a?(Hash)
41
- template_location.merge!(Merb::Plugins.config[:sass][:template_location])
42
- Merb::Plugins.config[:sass][:template_location] = template_location
43
- end
44
-
45
- #configure Sass to know about all these sass locations.
46
- Sass::Plugin.options[:template_location] = template_location
47
- end
48
- end
49
-
50
- Merb::BootLoader.after_app_loads do
51
- #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location.
52
- unless defined?(Sass::Plugin)
53
- require "sass/plugin"
54
- if Merb::Plugins.config[:sass]
55
- Sass::Plugin.options = Merb::Plugins.config[:sass]
56
- # support old (deprecatd Merb::Config[:sass] option)
57
- elsif Merb::Config[:sass]
58
- Sass::Plugin.options = Merb::Config[:sass]
59
- end
60
- end
61
-
62
- Compass.setup_template_location
63
- end
@@ -1,83 +0,0 @@
1
- %w(configuration_defaults installer).each do |lib|
2
- require "compass/app_integration/rails/#{lib}"
3
- end
4
-
5
- require 'compass/app_integration/rails/runtime' if defined?(ActionController::Base)
6
-
7
-
8
- module Compass
9
- module AppIntegration
10
- module Rails
11
-
12
- extend self
13
-
14
- def booted!
15
- Compass::AppIntegration::Rails.const_set(:BOOTED, true)
16
- end
17
-
18
- def booted?
19
- defined?(Compass::AppIntegration::Rails::BOOTED) && Compass::AppIntegration::Rails::BOOTED
20
- end
21
-
22
- def installer(*args)
23
- Installer.new(*args)
24
- end
25
-
26
- def configuration
27
- config = Compass::Configuration::Data.new('rails')
28
- config.extend(ConfigurationDefaults)
29
- config.extend(ConfigurationDefaultsWithAssetPipeline) if Sass::Util.ap_geq?('3.1.0') || Sass::Util.ap_geq?('3.1.0.rc') || Sass::Util.ap_geq?('3.1.0.beta')
30
- config
31
- end
32
-
33
- def env
34
- env_production? ? :production : :development
35
- end
36
-
37
- def env_production?
38
- if defined?(::Rails) && ::Rails.respond_to?(:env)
39
- ::Rails.env.production?
40
- elsif defined?(RAILS_ENV)
41
- RAILS_ENV == "production"
42
- end
43
- end
44
-
45
- def root
46
- if defined?(::Rails) && ::Rails.respond_to?(:root)
47
- ::Rails.root
48
- elsif defined?(RAILS_ROOT)
49
- RAILS_ROOT
50
- end
51
- end
52
-
53
- def check_for_double_boot!
54
- if booted?
55
- Compass::Util.compass_warn("Warning: Compass was booted twice. Compass has a Railtie now; please remove your initializer.")
56
- else
57
- booted!
58
- end
59
- end
60
-
61
- def sass_plugin_enabled?
62
- unless Sass::Util.ap_geq?('3.1.0.beta')
63
- defined?(Sass::Plugin) && !Sass::Plugin.options[:never_update]
64
- end
65
- end
66
-
67
- def rails_compilation_enabled?
68
- Sass::Util.ap_geq?('3.1.0.beta') && defined?(Sass::Rails) # XXX check if there's some other way(s) to disable the asset pipeline.
69
- end
70
-
71
- # Rails 2.x projects use this in their compass initializer.
72
- def initialize!(config = nil)
73
- check_for_double_boot!
74
- config ||= Compass.detect_configuration_file(root)
75
- Compass.add_project_configuration(config, :project_type => :rails)
76
- Compass.discover_extensions!
77
- Compass.configure_sass_plugin!
78
- Compass.handle_configuration_change! if sass_plugin_enabled? || rails_compilation_enabled?
79
- end
80
- end
81
- end
82
- end
83
-
@@ -1,10 +0,0 @@
1
- %w(action_controller sass_plugin urls).each do |lib|
2
- require "compass/app_integration/rails/actionpack2x/#{lib}"
3
- end
4
-
5
- # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
6
- class Sass::Script::Functions::EvaluationContext
7
- include Sass::Script::Functions
8
- private
9
- include ActionView::Helpers::AssetTagHelper
10
- end
@@ -1,15 +0,0 @@
1
- # :stopdoc:
2
- module ActionController
3
- class Base
4
- def process_with_compass(*args)
5
- Sass::Plugin.rails_controller = self
6
- begin
7
- process_without_compass(*args)
8
- ensure
9
- Sass::Plugin.rails_controller = nil
10
- end
11
- end
12
- alias_method_chain :process, :compass
13
- end
14
- end
15
- # :startdoc:
@@ -1,5 +0,0 @@
1
- module Sass::Plugin
2
- class << self
3
- attr_accessor :rails_controller
4
- end
5
- end
@@ -1,18 +0,0 @@
1
- module Compass::SassExtensions::Functions::Urls::ImageUrl
2
- def image_url_with_rails_integration(path, only_path = Sass::Script::Bool.new(false), cache_buster = Sass::Script::Bool.new(true))
3
- if (@controller = Sass::Plugin.rails_controller) && @controller.respond_to?(:request) && @controller.request
4
- begin
5
- if only_path.to_bool
6
- Sass::Script::String.new image_path(path.value)
7
- else
8
- Sass::Script::String.new "url(#{image_path(path.value)})"
9
- end
10
- ensure
11
- @controller = nil
12
- end
13
- else
14
- image_url_without_rails_integration(path, only_path, cache_buster)
15
- end
16
- end
17
- alias_method_chain :image_url, :rails_integration
18
- end
@@ -1,11 +0,0 @@
1
- # TODO figure something out so image_path works with rails integration
2
- %w(railtie).each do |lib|
3
- require "compass/app_integration/rails/actionpack30/#{lib}"
4
- end
5
-
6
- # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
7
- class Sass::Script::Functions::EvaluationContext
8
- include Sass::Script::Functions
9
- private
10
- include ActionView::Helpers::AssetTagHelper
11
- end
@@ -1,46 +0,0 @@
1
- require 'compass'
2
- require 'rails'
3
-
4
- class Rails::Railtie::Configuration
5
- # Adds compass configuration accessor to the application configuration.
6
- #
7
- # If a configuration file for compass exists, it will be read in and
8
- # the project's configuration values will already be set on the config
9
- # object.
10
- #
11
- # For example:
12
- #
13
- # module MyApp
14
- # class Application < Rails::Application
15
- # config.compass.line_comments = !Rails.env.production?
16
- # config.compass.fonts_dir = "app/assets/fonts"
17
- # end
18
- # end
19
- #
20
- # It is suggested that you create a compass configuration file if you
21
- # want a quicker boot time when using the compass command line tool.
22
- #
23
- # For more information on available configuration options see:
24
- # http://compass-style.org/help/tutorials/configuration-reference/
25
- def compass
26
- @compass ||= begin
27
- data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file))
28
- config_data
29
- else
30
- Compass::Configuration::Data.new("project")
31
- end
32
- data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded.
33
- data
34
- end
35
- end
36
- end
37
-
38
- module Compass
39
- class Railtie < Rails::Railtie
40
- initializer "compass.initialize_rails" do |app|
41
- # Configure compass for use within rails, and provide the project configuration
42
- # that came via the rails boot process.
43
- Compass::AppIntegration::Rails.initialize!(app.config.compass)
44
- end
45
- end
46
- end
@@ -1,5 +0,0 @@
1
- # TODO figure something out so image_path works with rails integration
2
- %w(railtie helpers).each do |lib|
3
- require "compass/app_integration/rails/actionpack31/#{lib}"
4
- end
5
-
@@ -1,28 +0,0 @@
1
- module Sass::Script::Functions
2
- def generated_image_url(path, only_path = nil)
3
- asset_url(path, Sass::Script::String.new("image"))
4
- end
5
- end
6
-
7
-
8
- module Compass::RailsImageFunctionPatch
9
- private
10
-
11
- def image_path_for_size(image_file)
12
- begin
13
- file = ::Rails.application.assets.find_asset(image_file)
14
- return file
15
- rescue ::Sprockets::FileOutsidePaths
16
- return super(image_file)
17
- end
18
- end
19
- end
20
-
21
- module Sass::Script::Functions
22
- include Compass::RailsImageFunctionPatch
23
- end
24
-
25
- # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
26
- class Sass::Script::Functions::EvaluationContext
27
- include Sass::Script::Functions
28
- end
@@ -1,87 +0,0 @@
1
- require 'compass'
2
- require 'rails'
3
-
4
- class Rails::Railtie::Configuration
5
- # Adds compass configuration accessor to the application configuration.
6
- #
7
- # If a configuration file for compass exists, it will be read in and
8
- # the project's configuration values will already be set on the config
9
- # object.
10
- #
11
- # For example:
12
- #
13
- # module MyApp
14
- # class Application < Rails::Application
15
- # config.compass.line_comments = !Rails.env.production?
16
- # config.compass.fonts_dir = "app/assets/fonts"
17
- # end
18
- # end
19
- #
20
- # It is suggested that you create a compass configuration file if you
21
- # want a quicker boot time when using the compass command line tool.
22
- #
23
- # For more information on available configuration options see:
24
- # http://compass-style.org/help/tutorials/configuration-reference/
25
- def compass
26
- @compass ||= begin
27
- data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file))
28
- config_data
29
- else
30
- Compass::Configuration::Data.new("rails_config")
31
- end
32
- data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded.
33
- Compass.add_project_configuration(data)
34
- Compass.configuration.on_sprite_saved do |filename|
35
- # This is a huge hack based on reading through the sprockets internals.
36
- # Sprockets needs an API for adding assets during precompilation.
37
- # At a minimum sprockets should provide this API:
38
- #
39
- # #filename is a path in the asset source directory
40
- # Rails.application.assets.new_asset!(filename)
41
- #
42
- # # logical_path is how devs refer to it, data is the contents of it.
43
- # Rails.application.assets.new_asset!(logical_path, data)
44
- #
45
- # I would also like to select one of the above calls based on whether
46
- # the user is precompiling or not:
47
- #
48
- # Rails.application.assets.precompiling? #=> true or false
49
- #
50
- # But even the above is not an ideal API. The issue is that compass sprites need to
51
- # avoid generation if the sprite file is already generated (which can be quite time
52
- # consuming). To do this, compass has it's own uniqueness hash based on the user's
53
- # inputs instead of being based on the file contents. So if we could provide our own
54
- # hash or some metadata that is opaque to sprockets that could be read from the
55
- # asset's attributes, we could avoid cluttering the assets directory with generated
56
- # sprites and always just use the logical_path + data version of the api.
57
- if Rails.application.config.assets.digests.try(:any?)
58
- asset = Rails.application.assets.find_asset(filename)
59
- pathname = Pathname.new(filename)
60
- logical_path = filename[(Compass.configuration.generated_images_path.length+1)..-1]
61
- # Force the asset into the cache so find_asset will find it.
62
- cached_assets = Rails.application.assets.instance_variable_get("@assets")
63
- cached_assets[logical_path] = cached_assets[filename] = asset
64
-
65
- target = Pathname.new(File.join(Rails.public_path, Rails.application.config.assets.prefix))
66
- asset = Rails.application.assets.find_asset(logical_path)
67
- filename = target.join(asset.digest_path)
68
- asset.write_to(filename)
69
- end
70
- end
71
- data
72
- end
73
- @compass
74
- end
75
- end
76
-
77
- module Compass
78
- class Railtie < Rails::Railtie
79
- initializer "compass.initialize_rails", :group => :all do |app|
80
- # Configure compass for use within rails, and provide the project configuration
81
- # that came via the rails boot process.
82
- Compass::AppIntegration::Rails.check_for_double_boot!
83
- Compass.discover_extensions!
84
- Compass.configure_rails!(app)
85
- end
86
- end
87
- end
@@ -1,123 +0,0 @@
1
- module Compass
2
- module AppIntegration
3
- module Rails
4
-
5
- module ConfigurationDefaultsWithAssetPipeline
6
- # These methods overwrite the old rails defaults
7
- # when rails 3.1 is detected.
8
-
9
- def default_sass_dir
10
- File.join("app", "assets", "stylesheets")
11
- end
12
-
13
- def default_images_dir
14
- File.join("app", "assets", "images")
15
- end
16
-
17
- def default_fonts_dir
18
- File.join("app", "assets", "fonts")
19
- end
20
-
21
- def default_javascripts_dir
22
- File.join("app", "assets", "javascripts")
23
- end
24
-
25
- def default_http_path
26
- ::Rails.application.config.assets.prefix
27
- end
28
-
29
- def default_http_images_path
30
- "#{top_level.http_path}"
31
- end
32
-
33
- def default_http_generated_images_path
34
- "#{top_level.http_path}"
35
- end
36
-
37
- def default_http_javascripts_path
38
- "#{top_level.http_path}"
39
- end
40
-
41
- def default_http_fonts_path
42
- "#{top_level.http_path}"
43
- end
44
-
45
- def default_http_stylesheets_path
46
- "#{top_level.http_path}"
47
- end
48
- end
49
-
50
- module ConfigurationDefaults
51
-
52
- def project_type_without_default
53
- :rails
54
- end
55
-
56
- def default_sass_dir
57
- File.join("app", "stylesheets")
58
- end
59
-
60
- def default_css_dir
61
- File.join("public", "stylesheets")
62
- end
63
-
64
- def default_images_dir
65
- File.join("public", "images")
66
- end
67
-
68
- def default_fonts_dir
69
- File.join("public", "fonts")
70
- end
71
-
72
- def default_javascripts_dir
73
- File.join("public", "javascripts")
74
- end
75
-
76
- def default_http_images_path
77
- # Relies on the fact that this will be loaded after the "normal"
78
- # defaults, so that method_missing finds http_root_relative
79
- http_root_relative "images"
80
- end
81
-
82
- def default_http_generated_images_path
83
- # Relies on the fact that this will be loaded after the "normal"
84
- # defaults, so that method_missing finds http_root_relative
85
- http_root_relative "images"
86
- end
87
-
88
- def default_http_javascripts_path
89
- http_root_relative "javascripts"
90
- end
91
-
92
- def default_http_fonts_path
93
- http_root_relative "fonts"
94
- end
95
-
96
- def default_http_stylesheets_path
97
- http_root_relative "stylesheets"
98
- end
99
-
100
- def default_extensions_dir
101
- File.join("vendor", "plugins", "compass_extensions")
102
- end
103
-
104
- def default_cache_dir
105
- File.join("tmp", "sass-cache")
106
- end
107
-
108
- def default_project_path
109
- project_path = Compass::AppIntegration::Rails.root
110
- end
111
-
112
- def default_http_path
113
- "/" # XXX Where is/was this stored in the Rails config?
114
- end
115
-
116
- def default_environment
117
- Compass::AppIntegration::Rails.env
118
- end
119
-
120
- end
121
- end
122
- end
123
- end