gpt4 book ai didi

ruby - 将自定义 ruby​​ gem 与 github 页面一起使用会引发错误

转载 作者:数据小太阳 更新时间:2023-10-29 08:35:59 24 4
gpt4 key购买 nike

在运行 jekyll build 时,将自定义 gem 与 github-pages 结合使用会抛出以下错误

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>'

我的 gem 文件

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

最后两个 gem 是我创造的。

这是我的 ruby​​ gem 文件

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)

最佳答案

除了 gem github-pages 之外,您不能在 Github Pages 中使用任何其他 ruby​​ gem。

你的 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/

关于ruby - 将自定义 ruby​​ gem 与 github 页面一起使用会引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39976298/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com