2016-10-11 40 views
2

使用自定義的寶石與以下錯誤GitHub上的頁面拋出運行jekyll build使用自定義紅寶石寶石與GitHub的頁面拋出錯誤

C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:356:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'tabs (= 0.0.3) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. (Bundler::GemNotFound) 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:331:in `each' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:331:in `verify_gemfile_dependencies_are_found!' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:200:in `start' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:184:in `resolve' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/definition.rb:200:in `resolve' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/definition.rb:185:in `specs_for' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in `requested_specs' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/environment.rb:19:in `requested_specs' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:14:in `setup' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-3.2.1/lib/jekyll/plugin_manager.rb:36:in `require_from_bundler' 
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-3.2.1/exe/jekyll:9:in `<top (required)>' 
    from C:/Ruby200/bin/jekyll:23:in `load' 
    from C:/Ruby200/bin/jekyll:23:in `<main>' 

我的Gemfile

source "http://rubygems.org" 
gem 'kramdown' 
gem 'jekyll-sitemap' 
gem 'nokogiri' 
gem 'tabs', '0.0.3' 
gem 'tabs-id', '0.0.1' 

最後兩種寶石被造由我。

這是我的紅寶石寶石文件

require 'kramdown' 
module Tags 
    class TabsBlock < Liquid::Block 
     def render(context) 
      content = super(context) 
      content = convert(content) 
     end 
     def convert(context) 
      liArray = context.gsub(/<li role="presentation" class="">(.+)<\/li>/) 
      nextLine = "\n" 
      tabOpenTag = nextLine + '<div class="tabs">' + nextLine 
      ulOpenTag = nextLine + '<ul class="nav nav-tabs" role="tablist">' + nextLine 
      tabContentOpenTag = nextLine + '<div class="tab-content">' + nextLine 
      closedivTag = nextLine + '</div>' + nextLine 
      ulCloseTag = nextLine + '</ul>' + nextLine 
      lis = '' + nextLine 
      liArray.each do|li| 
       lis = lis + li + nextLine 
      end  
      return tabOpenTag + ulOpenTag + lis + ulCloseTag + tabContentOpenTag +context.gsub(/<li role="presentation" class="">(.+)<\/li>/,'') + closedivTag + ulCloseTag + closedivTag 
     end 
    end 
end 

Liquid::Template.register_tag("tabs", Tags::TabsBlock) 
+1

做那些寶石住在紅寶石的寶石?或者他們已經安裝在您的系統上?如果沒有,您需要安裝該版本以便捆綁器可以找到它或在您的gemfile中提供路徑,例如'gem「選項卡」,:path =>「/ path/to/gem」 – Doon

+0

是的。那些寶石已經在現場。我也嘗試過路徑方法。但結果相同 –

回答

4

不能使用在除寶石github-pages其他Github的頁面的任何額外的紅寶石寶石。

您的Gemfile應該閱讀:

source 'https://rubygems.org' 
gem 'github-pages', group: :jekyll_plugins 

https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/

+1

解決此問題的一種方法是在本地構建站點並將輸出提交到不同的分支或回購站。 –

+0

@RossPhillips是!如果需要更具體的寶石,你可以輕鬆地將Travis-ci自動部署到特定的分支 – StephenG