プログラミング的なSomething

プログラミング的なSomething

ITエンジニア(?)目線で生活・自転車・トレーニング話を綴ります

twitter-bootstrap-railsでハマった

ハマりました。
twitter-bootstrap-railsをインストールしたあとにrakeすると以下のようなエラーが。これではどうしようもない。

undefined method `less' for #
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/railtie/configuration.rb:85:in `method_missing'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/twitter-bootstrap-rails-2.1.6/lib/twitter/bootstrap/rails/engine.rb:15:in `block in '
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/yonetin/apps/sobas/config/environment.rb:5:in `'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/application.rb:103:in `require'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/application.rb:103:in `require_environment!'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/railties-3.2.3/lib/rails/application.rb:292:in `block (2 levels) in initialize_tasks'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/yonetin/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/yonetin/.rvm/gems/ruby-1.9.3-p125@soba1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'

解消方法ですが、Githubにありました。実際は友人に指摘されて気付いています。
https://github.com/seyhunak/twitter-bootstrap-rails

gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

gemが足りなかった様子。therubyracerとless-railsを追加してbundleします。
成功したらインストールします。

$ rails g bootstrap:install
insert app/assets/javascripts/application.js
create app/assets/javascripts/bootstrap.js.coffee
create app/assets/stylesheets/bootstrap_and_overrides.css.less
gsub app/assets/stylesheets/application.css
gsub app/assets/stylesheets/application.css

これで動きます。

広告を非表示にする