Can't compile with a less filter

77 views
Skip to first unread message

godbout

unread,
Feb 11, 2012, 6:24:44 AM2/11/12
to nanoc
Hi,

I can't get the compilation to work when I add a :less filter. I've
got this error message:
- NameError: uninitialized constant Less

Latest version of rubygems is installed, and latest version of less
too.
Any help?

Thanks.

Denis Defreyne

unread,
Feb 12, 2012, 2:15:16 AM2/12/12
to na...@googlegroups.com
Hi,

That is odd. What version of nanoc are you running? Can you provide the full backtrace?

Cheers,

Denis

> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en

godbout

unread,
Feb 24, 2012, 5:22:53 AM2/24/12
to nanoc
Hi Denis.

I'm using 3.2.4. I've just noticed there is a new version but I
haven't tried it yet. I'll give it a shot in a couple of days.

Meanwhile, here's the full backtrace:

=== MESSAGE:

NameError: uninitialized constant Less

=== COMPILATION STACK:

(empty)

=== BACKTRACE:

0. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/filters/less.rb:48:in `run'
1. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/result_data/item_rep.rb:335:in `filter'
2. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/item_rep_proxy.rb:47:in
`filter'
3. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/rule_context.rb:54:in
`filter'
4. ./Rules:43:in `block in load'
5. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/rule.rb:68:in `instance_eval'
6. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/rule.rb:68:in `apply_to'
7. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:237:in `block (2
levels) in route_reps'
8. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:235:in
`each_pair'
9. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:235:in `block in
route_reps'
10. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:230:in `each'
11. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:230:in
`route_reps'
12. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:119:in `load'
13. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/compilation/compiler.rb:82:in `run'
14. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/base/source_data/site.rb:57:in `compile'
15. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/commands/compile.rb:61:in `run'
16. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/command.rb:51:in `block in call'
17. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/error_handler.rb:42:in `handle_while'
18. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/error_handler.rb:23:in `handle_while'
19. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/command.rb:50:in `call'
20. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/command.rb:43:in `call'
21. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/commands/compile.rb:24:in `block in
define'
22. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
cri-2.0.2/lib/cri/command.rb:255:in `call'
23. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
cri-2.0.2/lib/cri/command.rb:255:in `run'
24. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
cri-2.0.2/lib/cri/command.rb:272:in `run'
25. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli.rb:40:in `block in run'
26. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/error_handler.rb:42:in `handle_while'
27. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli/error_handler.rb:23:in `handle_while'
28. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/lib/nanoc3/cli.rb:37:in `run'
29. /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/
nanoc3-3.2.4/bin/nanoc3:12:in `<top (required)>'
30. /usr/local/Cellar/ruby/1.9.3-p0/bin/nanoc3:19:in `load'
31. /usr/local/Cellar/ruby/1.9.3-p0/bin/nanoc3:19:in `<main>'


On Feb 12, 3:15 pm, Denis Defreyne <denis.defre...@stoneship.org>
wrote:

Denis Defreyne

unread,
Feb 24, 2012, 8:39:28 AM2/24/12
to na...@googlegroups.com
Hi,

Do you have the "less" gem installed?

Does your load path contain anything unusual, such as the directory
./lib/nanoc3/filters/? If it does, then require "less" would load the
file itself, not the actual less gem, so that would explain the error.

Denis

godbout

unread,
Feb 28, 2012, 12:57:23 AM2/28/12
to nanoc
Hi Denis,

Thanks for the answer. Actually you're probably right, less might not
be installed... anymore. It used to be, but I updated ruby through
Homebrew and changed my PATH to point to the new version. I thought
that some symlinks would point to the correct gems folder but it seems
not, or I might have done something wrong. So each time I update ruby,
the previous gems are not accessible anymore. I need to check how I
install/use/update my PATH correctly because I'm pretty sure I did
something wrong with Homebrew.

I'll probably find the solution by myself but I'll keep you updated.
Thanks,

On Feb 24, 9:39 pm, Denis Defreyne <denis.defre...@stoneship.org>
wrote:
> Hi,
>

Denis Defreyne

unread,
Feb 28, 2012, 3:14:46 AM2/28/12
to na...@googlegroups.com
Hi,

If you're on OS X I recommend using rvm [1] for managing your Ruby
installation. It takes care of setting up paths for you and it also
makes it much easier to stay up-to-date with new Ruby versions.

Cheers,

Denis

[1]: https://rvm.beginrescueend.com/

godbout

unread,
Feb 28, 2012, 3:58:02 AM2/28/12
to nanoc
Alright, thanks.

I think it's a bit harder than what I thought. For the moment I've
installed the last ruby and gem correctly, and corrected my path. I've
installed the less gem but the less.rb file is not accessible (from
what I understand) from any directory in the path, and no symlinks
added. I don't really understand how it's supposed to work...

I'll have a look with rvm. I read about it but I'm trying to keep as
little package managers as possible.

On Feb 28, 4:14 pm, Denis Defreyne <denis.defre...@stoneship.org>
wrote:
> Hi,
>

godbout

unread,
Feb 28, 2012, 4:34:22 AM2/28/12
to nanoc
Hi again Denis,

Thanks to your advise, I was able to install the last ruby version and
all the needed packages in an environment and I can now compile my
website using LESS. I'm still not 100% sure why it didn't work before
or even how could some other gems be loaded correctly. I'll try to
spend some time to understand that.

Thanks again!

On Feb 28, 4:14 pm, Denis Defreyne <denis.defre...@stoneship.org>
wrote:
> Hi,
>

godbout

unread,
Feb 28, 2012, 4:52:53 AM2/28/12
to nanoc
I think I got it. If I'm not mistaken, Homebrew installed correctly
the latest version of ruby, my $PATH was correct, and the symlinks
also. But what was symlinked was the less compiler (lessc), correcly
symlinked to /usr/local/bin. There was no way, if nanoc if loading the
less.rb file, that it can find it.
Or there's also a gem path/ruby path loading but in that case I don't
really know, because I don't really remember any place where all the
gems were, physically or symlinked. I've deleted all the ruby versions
installed by Homebrew now.
Reply all
Reply to author
Forward
0 new messages