sass 3.1.0.alpha.262 → 3.1.0.alpha.263

Sign up to get free protection for your applications and to get access to all the features.
data/REVISION CHANGED
@@ -1 +1 @@
1
- d9b9e527c5f56934fbf0db348796494ce5a7c576
1
+ 1f56925df17ec8196fd6687b9f16f2da2b6b2a2d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0.alpha.262
1
+ 3.1.0.alpha.263
@@ -11,18 +11,11 @@ unless defined?(Sass::RAILS_LOADED)
11
11
  :cache_location => Sass::Util.rails_root + '/tmp/sass-cache'
12
12
  }
13
13
 
14
- if Sass::Util.ap_geq?('3.1.0.beta')
15
- require 'sass/importers/rails'
16
- require 'sass/cache_stores/active_support'
17
- opts.merge!(:load_paths => [Sass::Importers::Rails.new])
18
- opts.merge!(:cache_store => Sass::CacheStores::ActiveSupport.new(Rails.cache)) if Rails.cache
19
- else
20
- opts.merge!(
21
- :always_update => false,
22
- :template_location => Sass::Util.rails_root + '/public/stylesheets/sass',
23
- :css_location => Sass::Util.rails_root + '/public/stylesheets',
24
- :always_check => Sass::Util.rails_env == "development")
25
- end
14
+ opts.merge!(
15
+ :always_update => false,
16
+ :template_location => Sass::Util.rails_root + '/public/stylesheets/sass',
17
+ :css_location => Sass::Util.rails_root + '/public/stylesheets',
18
+ :always_check => Sass::Util.rails_env == "development")
26
19
 
27
20
  @default_options = opts.freeze
28
21
  end
@@ -30,76 +23,9 @@ unless defined?(Sass::RAILS_LOADED)
30
23
 
31
24
  Sass::Plugin.options.reverse_merge!(Sass::Plugin.default_options)
32
25
 
33
- # Disable this for now, until we figure out how to get Rails
34
- # to pass in the view.
35
- if Sass::Util.ap_geq?('3.1.0.beta')
36
- class Sass::Plugin::TemplateHandler
37
- attr_reader :syntax
38
-
39
- def initialize(syntax)
40
- @syntax = syntax
41
- end
42
-
43
- def handles_encoding?; true; end
44
-
45
- def call(template, view)
46
- engine = Sass::Engine.new(template.source,
47
- Sass::Plugin.engine_options.merge(
48
- :syntax => @syntax,
49
- :filename => template.virtual_path,
50
- :_rails_lookup_context => view.lookup_context,
51
- :importer => Sass::Importers::Rails.new))
52
-
53
- template.data[:sass_importers] = engine.dependencies.map do |e|
54
- [e.options[:filename], e.options[:importer]]
55
- end
56
-
57
- stylesheet =
58
- begin
59
- engine.render
60
- rescue Sass::SyntaxError => e
61
- Sass::Plugin::TemplateHandler.munge_exception e, view.lookup_context
62
- Sass::SyntaxError.exception_to_css(e, Sass::Plugin.engine_options)
63
- end
64
-
65
- <<RUBY
66
- begin
67
- if Sass::Plugin::TemplateHandler.dependencies_changed?(
68
- @_template.data[:sass_importers], #{Time.now.to_i}, lookup_context)
69
- @_template.expire!
70
- @_template.rerender(self)
71
- else
72
- #{stylesheet.inspect}
73
- end
74
- rescue Sass::SyntaxError => e
75
- Sass::Plugin::TemplateHandler.munge_exception e, lookup_context
76
- Sass::SyntaxError.exception_to_css(e, Sass::Plugin.engine_options)
77
- end
78
- RUBY
79
- end
80
-
81
- def self.dependencies_changed?(deps, since, lookup_context)
82
- opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context)
83
- deps.any? do |d, i|
84
- return true unless time = i.mtime(d, opts)
85
- time.to_i > since
86
- end
87
- end
88
-
89
- def self.munge_exception(e, lookup_context)
90
- importer = Sass::Importers::Rails.new
91
- opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context)
92
- e.sass_backtrace.each do |bt|
93
- next unless engine = importer.find(bt[:filename], opts)
94
- bt[:filename] = engine.options[:_rails_filename]
95
- end
96
- end
97
- end
98
-
99
- ActionView::Template.register_template_handler(:sass, Sass::Plugin::TemplateHandler.new(:sass))
100
- ActionView::Template.register_template_handler(:scss, Sass::Plugin::TemplateHandler.new(:scss))
101
- elsif defined?(ActionController::Metal)
102
- # Rails >= 3.0
26
+ # Rails 3.1 loads and handles Sass all on its own
27
+ if defined?(ActionController::Metal)
28
+ # 3.1 > Rails >= 3.0
103
29
  require 'sass/plugin/rack'
104
30
  Rails.configuration.middleware.use(Sass::Plugin::Rack)
105
31
  elsif defined?(ActionController::Dispatcher) &&
@@ -1,5 +1,6 @@
1
- # Rails 3.0.0.beta.2+
2
- if defined?(ActiveSupport) && Sass::Util.has?(:public_method, ActiveSupport, :on_load)
1
+ # Rails 3.0.0.beta.2+, < 3.1
2
+ if defined?(ActiveSupport) && Sass::Util.has?(:public_method, ActiveSupport, :on_load) &&
3
+ !Sass::Util.ap_geq?('3.1.0.beta')
3
4
  require 'sass/plugin/configuration'
4
5
  ActiveSupport.on_load(:before_initialize) do
5
6
  require 'sass'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.alpha.262
4
+ version: 3.1.0.alpha.263
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -57,7 +57,6 @@ files:
57
57
  - lib/sass/script.rb
58
58
  - lib/sass/selector.rb
59
59
  - lib/sass/cache_stores.rb
60
- - lib/sass/cache_stores/active_support.rb
61
60
  - lib/sass/cache_stores/base.rb
62
61
  - lib/sass/cache_stores/chain.rb
63
62
  - lib/sass/cache_stores/filesystem.rb
@@ -74,7 +73,6 @@ files:
74
73
  - lib/sass/repl.rb
75
74
  - lib/sass/importers/base.rb
76
75
  - lib/sass/importers/filesystem.rb
77
- - lib/sass/importers/rails.rb
78
76
  - lib/sass/root.rb
79
77
  - lib/sass/script/bool.rb
80
78
  - lib/sass/script/color.rb
@@ -1,28 +0,0 @@
1
- module Sass
2
- module CacheStores
3
- # A cache store that wraps an ActiveSupport cache store.
4
- # This is useful for integrating with an app that uses ActiveSupport,
5
- # or for taking advantage of the wide variety of ActiveSupport cache backends.
6
- #
7
- # This is automatically used within Rails.
8
- class ActiveSupport < Base
9
- # @param store [::ActiveSupport::Cache::Store] The cache store to wrap.
10
- def initialize(store)
11
- @store = store
12
- end
13
-
14
- # @see Base#_retrieve
15
- def _retrieve(key, version, sha)
16
- return unless val = @store.fetch('_sass/' + key)
17
- return unless val[:version] == version
18
- return unless val[:sha] == sha
19
- return val[:contents]
20
- end
21
-
22
- # @see Base#_store
23
- def _store(key, version, sha, contents)
24
- @store.write('_sass/' + key, :version => version, :sha => sha, :contents => contents)
25
- end
26
- end
27
- end
28
- end
@@ -1,75 +0,0 @@
1
- module Sass
2
- module Importers
3
- # An importer that wraps the Rails 3.1 view infrastructure.
4
- # Loads Sass files as though they were views in Rails.
5
- # Currently doesn't support caching.
6
- #
7
- # This is different from standard Rails rendering
8
- # in that Sass doesn't have a concept of importing partials
9
- # as a distinct action from importing other Sass files.
10
- # Imports within Rails behave more like Sass imports:
11
- # they will first attempt to find a non-partial file,
12
- # and failing that will fall back on a partial.
13
- #
14
- # Each importer instance is local to a single request for a single view.
15
- # It contains the ActionView::LookupContext for that request,
16
- # as well as the controller prefix for the view being generated.
17
- class Rails < Base
18
- # Creates a new Rails importer that imports files as Rails views.
19
- def initialize; end
20
-
21
- # @see Base#find_relative
22
- def find_relative(uri, base, options)
23
- find_(uri, base.split('/')[0...-1].join('/'), options)
24
- end
25
-
26
- # @see Base#find
27
- def find(uri, options)
28
- find_(uri, nil, options)
29
- end
30
-
31
- # @see Base#mtime
32
- def mtime(uri, options)
33
- return unless template =
34
- find_template(uri, nil, !:partial, options) ||
35
- find_template(uri, nil, :partial, options)
36
- template.updated_at
37
- end
38
-
39
- # @see Base#key
40
- def key(uri, options)
41
- [self.class.name + ":" + uri.split('/')[0...-1].join('/'),
42
- uri.split('/')[-1] + "." + options[:syntax].to_s]
43
- end
44
-
45
- # @see Base#to_s
46
- def to_s
47
- "(Rails importer)"
48
- end
49
-
50
- private
51
-
52
- def find_(uri, prefix, options)
53
- prepare_template(
54
- find_template(uri, prefix, !:partial, options) ||
55
- find_template(uri, prefix, :partial, options),
56
- options)
57
- end
58
-
59
- def find_template(uri, prefix, partial, options)
60
- return options[:_rails_lookup_context].
61
- find_all(uri, prefix, partial).
62
- find {|t| t.handler.is_a?(Sass::Plugin::TemplateHandler)}
63
- end
64
-
65
- def prepare_template(template, options)
66
- return unless template
67
- options[:syntax] = template.handler.syntax
68
- options[:filename] = template.virtual_path
69
- options[:_rails_filename] = template.identifier
70
- options[:importer] = self
71
- Sass::Engine.new(template.source, options)
72
- end
73
- end
74
- end
75
- end