sstephenson / sprockets

Rack-based asset packaging system
2.55k stars 24 forks source link

undefined method `_get' for Sprockets::CachedEnvironment #687

Closed danielpclark closed 9 years ago

danielpclark commented 9 years ago

I'm using Ruby 2.2.0.preview1, Rails 4.2.0.rc3. And using: gem 'compass-rails', '~> 2.0.1' gem 'sprockets', '~> 3.0.0.beta.6' gem 'sass-rails', '~> 5.0.0' gem 'sass', '~> 3.4.9'

After applying fix to compass-rails #195 this is the error the comes from sprockets.

undefined method `_get' for #<Sprockets::CachedEnvironment

It happens in lib/sprockets/sass_processor.rb which loads CacheStore where _retrieve calls _get from Sass::CacheStores::Base which does not have the _get method in the current release.

josh commented 9 years ago

Hey Daniel, unfortunately the latest compass-rails isn't compatible with any of the newer versions of sprockets or sass-rails. See https://github.com/Compass/compass-rails/pull/191.

danielpclark commented 9 years ago

Okay. compass-rails aside. What about the fact that _get is still referenced in this code base when it's not in Sass?

It happens in lib/sprockets/sass_processor.rb which loads CacheStore where _retrieve calls _get from Sass::CacheStores::Base which does not have the _get method in the current release.

The only place I see _get defined is in lib/sprockets/cache.rb and that isn't scoped to the namespace in lib/sprockets/sass_processor.rb

josh commented 9 years ago

Those are defined on sprocket's Cache object.

https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/cache.rb On Sun, Dec 14, 2014 at 11:30 PM Daniel P. Clark notifications@github.com wrote:

Okay. compass-rails aside. What about the fact that _get is still referenced in this code base when it's not in Sass?

It happens in lib/sprockets/sass_processor.rb https://github.com/sstephenson/sprockets/blob/2c9333bd1b6a55f791a3f2ca1389bf152cea18ba/lib/sprockets/sass_processor.rb which loads CacheStore where _retrieve https://github.com/sstephenson/sprockets/blob/2c9333bd1b6a55f791a3f2ca1389bf152cea18ba/lib/sprockets/sass_processor.rb#L268 calls get_ from Sass::CacheStores::Base https://github.com/sass/sass/blob/6f192ce583577b41514c107ffb1c4d2133b4837f/lib/sass/cache_stores/base.rb which does not have the get_ method in the current release.

— Reply to this email directly or view it on GitHub https://github.com/sstephenson/sprockets/issues/687#issuecomment-66958070 .

danielpclark commented 9 years ago

The Cache object isn't referenced in sass_processor.rb. sass_processor.rb only calls CacheStore within iteself. The original error here makes sense since where _get is defined is not incorporated into where it's used. Sprockets::Cache isn't used in sass_processor.rb where _get is called since it uses the CacheStore class within the same file.

danielpclark commented 9 years ago

Forgive me I believe I see how you initialize it now. My mistake.

josh commented 9 years ago

input[:cache] is the Cache instance. On Sun, Dec 14, 2014 at 11:50 PM Daniel P. Clark notifications@github.com wrote:

After revewing the code I think I see how you incorporate it now. I believe you hand in the actual Cache object via the :version option?

— Reply to this email directly or view it on GitHub https://github.com/sstephenson/sprockets/issues/687#issuecomment-66959438 .