Sutto / barista

Simple, transparent CoffeeScript support for Rails and Rack apps.
MIT License
398 stars 27 forks source link

[Barista] The coffeescript compiler at 'coffee' is currently unavailable. #4

Closed jvatic closed 14 years ago

jvatic commented 14 years ago

Hi, I get the following after including barista into the gem file, adding my coffee scripts to app/coffeescripts (Rails 3 app).

[Barista] Compiling all scripts
[Barista] Compiling all coffeescripts
[Barista] The coffeescript compiler at 'coffee' is currently unavailable.

Gemfile: gem 'barista', '>= 0.5.0'

(and no I didn't forget to run bundle install)

Any idea as to whats causing this issue?

jvatic commented 14 years ago

I have duplicated this problem with the following steps:

  1. rvm ree rvm gemset create rails3 rvm ree@rails3
  2. gem install rails rails new debug cd debug
  3. vim Gemfile and insert gem 'barista', '>= 0.5.0'
  4. mkdir app/coffeescripts
  5. vim app/coffeescripts/application.coffee and insert alert 'Hello Coffee'
  6. bundle install
  7. rails g scaffold Post title:string body:text rake db:create rake db:migrate
  8. vim app/views/layouts/application.html.erb and change <%= javascript_include_tag :defaults %> to <%= javascript_include_tag :defaults, 'application' %>
  9. rm public/index.html
  10. add root :to => "posts#index" to config/routes.rb
  11. rails server and in browser go to http://localhost:3000

In the console we get:

$ rails server
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-09-21 15:00:57] INFO  WEBrick 1.3.1
[2010-09-21 15:00:57] INFO  ruby 1.8.7 (2010-04-19) [i686-darwin10.4.0]
[2010-09-21 15:00:57] INFO  WEBrick::HTTPServer#start: pid=3874 port=3000

Started GET "/" for 127.0.0.1 at Tue Sep 21 15:00:58 -0400 2010
  Processing by PagesController#index as HTML

...and then the Barista part...

[Barista] Compiling all scripts
[Barista] Compiling all coffeescripts
[Barista] The coffeescript compiler at 'coffee' is currently unavailable.

In the browser, as expected by this output, there is no alert and application.js renders as:



  Action Controller: Exception caught
  



Barista::CompilerUnavailableError in BaristaController#show

The coffeescript compiler 'coffee' could not be found.

Rails.root: baristaDebug

Application Trace | Framework Trace | Full Trace

Request

Parameters:

{"js_path"=>"application"}

Show session dump

Show env dump

Response

Headers:

None

Is there a step missing in my setting up of Barista?

jvatic commented 14 years ago

Solution is to git://github.com/jashkenas/coffee-script.git and cd coffee-script sudo bin/cake install. Basically the problem was I didn't have coffee installed in /usr/local/bin, is bundling coffee with this gem an option? That would make it more plugin-play.

Sutto commented 14 years ago

Not really unfortunately - since it'd mean hardcoding the eversion. For what it's worth, I personally install node and npm then install coffee script via npm.