#ruby #rubygems #jekyll #github-pages #gemfile
#ruby #rubygems #джекилл #github-страницы #gemfile
Вопрос:
Использование пользовательского gem с github-pages выдает следующую ошибку при запуске jekyll build
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'
Последние два драгоценных камня были созданы мной.
И это мой файл 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)
Комментарии:
1. эти драгоценные камни живут на ruby gems? или они уже установлены в вашей системе? Если нет, вам либо нужно установить эту версию, чтобы bundler мог ее найти, либо указать путь в вашем gemfile, например
gem "tabs", :path => "/path/to/gem"
2. ДА. Эти драгоценные камни уже были в действии. Я также пробовал метод path. Но результат тот же
Ответ №1:
Вы не можете использовать какие-либо дополнительные ruby gem на страницах Github, кроме gem github-pages
.
Ваш 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. Один из способов обойти это — создать сайт локально и передать выходные данные в другую ветку или репозиторий.
2. @RossPhillips Ага! вы можете легко интегрировать travis-ci для автоматического развертывания в определенную ветку, если требуются более конкретные драгоценные камни