Nick Shek's Blog

git://github.com/reactjs/react-rails.git (at master) is not yet checked out. Run `bundle install` first.

根據https://github.com/bundler/bundler/blob/master/ISSUES.md,解決方是執行以下程式碼,重新安裝 dependencies :

# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# uninstall the rubygems-bundler and open_gem gems
rvm gemset use global # if using rvm
gem uninstall rubygems-bundler open_gem

# try to install one more time
bundle install

debug.py => IndexError: list index out of range

若該錯誤來自Django項目的debug.py,解決方法是修改_get_lines_from_file方法,把以下這一行:

source = f.readlines()

改為

source = f.read().splitlines()

從http://fontello.com/下載font icon,及使用Nokogiri製作一張font icon class 的名單

http://fontello.com/下載font icon,zip檔入面有demo.html,列出如何使用fontello icon ,我的目的是利Nokogiri在rake task以ruby list 形式列印出所有class name,以下是該rake task的程式碼 :

namespace :dev do
  task :font_icon_list do
    text = open(Rails.root.join('doc', 'fontello-c340d124','demo.html')).read
    html_doc = Nokogiri::HTML(text)
    font_icon_list = html_doc.xpath(%{//div[@class="row"]//div//span[@class="i-name"]//text()})
    font_icon_list_code = %{["#{font_icon_list.to_a.join(%{","})}"]}
    puts font_icon_list_code
  end
end

最後執行rake task輸出結果

rake dev:font_icon_list > result.txt