LoginSignup
4
4

More than 5 years have passed since last update.

Bundlerでgithubから直接ソースを取得してgemを構築する

Last updated at Posted at 2012-05-04

tilt-1.3.3ではTwitter Bootstrapのbootstrap.lessはコンパイルできないが、最新版ではできる。

Sinatraから以下のようなパスで、Twitter Bootstrapのbootstrap.lessを実行時コンパイルしようとしたが出来なかった。

web.rb
get '/css/bootstrap.css' do
  less :bootstrap, :views => ["bootstrap/less"], :paths => ["bootstrap/less"]
end

調べたところ、指定したpathsオプションがless.rbまで渡っていないもよう。これは、tilt-1.3.3の以下の実装の問題。

lib/tilt/css.rb
parser  = ::Less::Parser.new(:filename => eval_file, :line => line)

これは以下のコミットで修正されている。

lib/tilt/css.rb
parser  = ::Less::Parser.new(options.merge :filename => eval_file, :line => line)

と言うことで、最新版では起きないはず。
こういう場合、Gemfileでgitオプションを使えばよい。

Gemfile
source :rubygems
gem 'tilt', :git => "git://github.com/rtomayko/tilt.git"
gem 'sinatra'
gem 'thin'
gem 'less'
gem 'therubyracer'

bundle listすると、gitのコミットがちゃんと明記されている。

$ bundle list
…
tilt (1.3.3 10a8ffa)
…

このtiltを使うと、bootstrap.cssが生成されることを確認できた。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4