这就是我的问题: Warbler不支持gem,gem是通过路径包含在gemfile中的。然而,我需要为我的工作做这件事。重要的是,将包含的gem打包并作为war归档中的一个简单rubygem进行处理。到目前为止,我一直在尝试操纵捆绑器,所以当规范到达warbler/trait/bundler.rb(规范被打包到归档中的地方)时,它已经有了' bundler :: source ::Rubygems‘作为源代码。问题是它需要从路径构建和安装,但我不能处理它来传递规范或源代码中的任何路径。gem作为rubygem被构建、安装和打包到归档中,并在Lockfile中的GEM下列出,但只使用了错误的编码(它都引用了特定的gem,路径输入得很清楚)。
下面是我的代码:
warbler/lib/warbler/bunlder.rb/bunlder.rb行: 60
case spec.source
when ::Bundler::Source::Git
config.bundler[:git_specs] ||= []
config.bundler[:git_specs] << spec
when ::Bundler::Source::Path
$stderr.puts("warning: Bundler `path' components are not currently supported.",
"The `#{spec.full_name}' component was not bundled.",
"Your application may fail to boot!")
else
##################################################################### MINE
if spec.name == "charla_common"
path = ::Bundler::GemHelper.new("../../common/trunk", spec.name).install_gem
end
##################################################################### MINE END
config.gems << spec
end这是gem的安装路径
Bundler/lib/bundler/dsl.rb行: 120
def source(source, options = {})
############################################################### MINE
if source.class == Bundler::Source::Path
options[:path] = source.options["path"]
source = "https://rubygems.org"
end
############################################################### MINE END
case source
when :gemcutter, :rubygems, :rubyforge then
Bundler.ui.warn "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
@rubygems_source.add_remote "http://rubygems.org"
return
when String
# ensures that the source in the lockfile is shown only once
unless options[:prepend]
@rubygems_source.add_remiote source
end
return
else
@source = source
if options[:prepend]
@sources = [@source] | @sources
else
@sources = @sources | [@source]
end
yield if block_given?
return @source
end
ensure
@source = nil
end发布于 2014-01-28 21:48:29
我不确定这是否适合您,但是为了解决这个问题,我在供应商/缓存中创建了指向包含gem的路径的符号链接。
例如,vendor/cache/gem_name -> ../../../gem_name。
https://stackoverflow.com/questions/19314453
复制相似问题