bootstrapを使ってみる
参考
Ruby on Rails 3.2.10でとりあえずプロジェクト立ち上げるメモ
http://qiita.com/items/e2427141443a90d66a35
Gehirn RS2 に nginx + unicorn 環境で Rails3 を動かしてみる("おまけ" twitter-bootstrap-rails も動かしてみよう)
http://qiita.com/items/c1edfa84b34dba2211ac
インストール
/mnt/hgfs/railsを共有フォルダとしたのでここで作っていきます
rails new bootstrap
cd bootstrap
bootstrapつかうよーとGemfileに書いて
bundle install
すると
sqlite3がないよ とか言われるので
sudo apt-get install -y sqlite3 libsqlite3-dev
gem install sqlite3 -v '1.3.7'
再度 bundle install
bundle install
意気揚々と
rails g bootstrap:install
とかやると
/.rvm/gems/ruby-1.9.3-p392/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
みたいに怒られます
どうやらランタイムエンジンがないよ ということで
ExecJS supports these runtimes:
therubyracer - Google V8 embedded within Ruby
therubyrhino - Mozilla Rhino embedded within JRuby
Node.js
Apple JavaScriptCore - Included with Mac OS X
のどれかをつかえってことなんですけど
定番?の therubyracerを使っていきます
http://qiita.com/items/e2427141443a90d66a35
Gemfileに
gem 'execjs'
gem 'therubyracer'
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
とかいて
bundle install
rails g bootstrap:install less
うまく
insert app/assets/javascripts/application.js
create app/assets/javascripts/bootstrap.js.coffee
create app/assets/stylesheets/bootstrap_and_overrides.css.less
create config/locales/en.bootstrap.yml
gsub app/assets/stylesheets/application.css
gsub app/assets/stylesheets/application.css
とかでたら成功です