New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError for Sass::Script::Functions during Rails template app creation #310

Closed
ikezue opened this Issue Mar 27, 2011 · 13 comments

Comments

Projects
None yet
2 participants
@ikezue

ikezue commented Mar 27, 2011

See backtrace below. I believe this has to do with the sass gem not being loaded when Bundler.require tries to load compass. This happens when I try to install rails with a template and the template writes 'gem compass' to the gemfile:

gem 'compass', '0.11.beta.5', :group => :development

rails new appname --template=/path/to/template.rb 

The beta site looks great by the way! Thanks for compass!

/..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions/urls.rb:21:in `<module:Urls>': undefined method `declare' for Sass::Script::Functions:Module (NoMethodError)
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions/urls.rb:1:in `<top (required)>'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:9:in `require'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:9:in `block in <top (required)>'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:5:in `each'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:5:in `<top (required)>'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions.rb:4:in `require'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions.rb:4:in `<top (required)>'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:5:in `require'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:5:in `block in <top (required)>'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:4:in `each'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:4:in `<top (required)>'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `block in require'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
from /..../gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
from /..../rails/appname/config/application.rb:7:in `<top (required)>'
from /..../gems/railties-3.0.5/lib/rails/commands.rb:15:in `require'
from /..../gems/railties-3.0.5/lib/rails/commands.rb:15:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 27, 2011

Try removing the group development I'm curious to if that's the problem

Scott Davis

On Mar 27, 2011, at 3:25 AM, ikezuereply@reply.github.com wrote:

See backtrace below. I believe this has to do with the sass gem not being loaded when Bundler.require tries to load compass. This happens when I try to install rails with a template and the template writes 'gem compass' to the gemfile:

gem 'compass', '0.11.beta.5', :group => :development

rails new appname --template=/path/to/template.rb

The beta site looks great by the way! Thanks for compass!

/..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions/urls.rb:21:in <module:Urls>': undefined methoddeclare' for Sass::Script::Functions:Module (NoMethodError)
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions/urls.rb:1:in <top (required)>' from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:9:inrequire'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:9:in block in <top (required)>' from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:5:ineach'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions/functions.rb:5:in <top (required)>' from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions.rb:4:inrequire'
from /..../gems/compass-0.11.beta.5/lib/compass/sass_extensions.rb:4:in <top (required)>' from /..../gems/compass-0.11.beta.5/lib/compass.rb:5:inrequire'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:5:in block in <top (required)>' from /..../gems/compass-0.11.beta.5/lib/compass.rb:4:ineach'
from /..../gems/compass-0.11.beta.5/lib/compass.rb:4:in <top (required)>' from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:inrequire'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in block (2 levels) in require' from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:ineach'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in block in require' from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:ineach'
from /..../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in require' from /..../gems/bundler-1.0.10/lib/bundler.rb:120:inrequire'
from /..../rails/appname/config/application.rb:7:in <top (required)>' from /..../gems/railties-3.0.5/lib/rails/commands.rb:15:inrequire'
from /..../gems/railties-3.0.5/lib/rails/commands.rb:15:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Reply to this email directly or view it on GitHub:
#310

@ikezue

This comment has been minimized.

ikezue commented Mar 27, 2011

The problem starts with this line in application.rb:
Bundler.require(:default, Rails.env) if defined?(Bundler)

Current environment when this executes is :development, so placing the compass gem in any group other than :development should work. I tried :developments (note the 's'), for instance and that worked. Removing the group entirely also works as that places the gem in :default.

I also tried the following hoping this would force bundler to load the sass gem first but it still failed:
gem 'sass', '3.1.0.alpha.252', :group => :development
gem 'compass', '0.11.beta.5', :group => :development

Thanks.

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 28, 2011

im assuming this is breaking because of the railtie but I've never really run into this because I add compass to the default group. Anyway, can you make me a test rails template so I have something to test against and ill look into this?

@ikezue

This comment has been minimized.

ikezue commented Mar 29, 2011

This is the smallest template I was able to reproduce the error with. Removing either haml-rails or cucumber-rails would result in no errors, for some reason. Similarly, swapping compass gem statements should not bring up an error. Thanks, and let me know if you have other requests.

# gem 'compass', '>= 0.10.6', :group => :development
gem 'compass', '0.11.beta.5', :group => :development
gem 'haml-rails', '>= 0.3.4'
gem 'cucumber-rails', :group => :test
run 'bundle install'
run 'compass init rails'
generate 'cucumber:install'
@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

thanks

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

gem 'haml-rails', '>= 0.3.4'

is the issue its locking the version of haml and sass to the pre split version.

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

also wanted to note that

gem 'compass', '>= 0.10.6', :group => :development

is probaly not going to work since the 0.10x version of compass doesn't use a railtie it uses an initializer which isn't environment agnostic:

https://github.com/chriseppstein/compass/blob/stable/lib/compass/app_integration/rails/installer.rb#L105

@ikezue

This comment has been minimized.

ikezue commented Mar 29, 2011

So with haml-rails 0.3.4 and compass 0.11.beta.5, the versions of haml and sass installed are 3.0.25 and 3.1.0.alpha.252 respectively. Is this what it should be for 0.11.beta.5 to work ok, I don't see a --pre version for haml? Or isn't this what you mean when you say haml-rails is "locking the version of haml/sass".

With compass 0.10.6 the template install runs fine and I'm able to auto-compile sass files, by running 'compass watch', without problems.

Can you think of how I may be able to get compass beta to work with haml-rails? Mind you, I was wrong when I said it works when compass is placed in the :default group, it fails. The installation only completes ok if compass is in a group (any group) that is not named :development.

Thanks again.

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

gem 'haml', '>= 3.1.alpha.214' this is just from a project i had handy im sure theres a better version of 3.1 out

Is what i use but I never use haml-rails basicly anything > 3.1 is going to screw you over when using compass 0.11.beta's since it requires the latest sass

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

note:
https://rubygems.org/gems/haml-rails

requires 3.0 maybe fork the haml-rails repo and monkey patch it and send them a pull request?

@ikezue

This comment has been minimized.

ikezue commented Mar 29, 2011

It installed haml-3.1.0.alpha.147, and now the install at least runs ok. I'll follow your suggestion on monkey patching haml-rails. Thanks!

@scottdavis

This comment has been minimized.

Member

scottdavis commented Mar 29, 2011

no problem! are ok with me closing this?

@ikezue

This comment has been minimized.

ikezue commented Mar 29, 2011

Yes, cheers.

@ikezue ikezue closed this Mar 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment