2013-10-11 60 views
0

这里我的问题:莺不支持通过gemfile中的路径包含的宝石。尽管如此,我需要为我的工作做到这一点。所包含的宝石在战争档案中被包装和处理为一个简单的rubygem是非常重要的。直到现在我已经试图操纵捆绑器,所以当规格到达warbler/traits/bundler.rb(这是规范压缩到存档的地方)时,它已经有'Bundler :: Source :: Rubygems'作为源代码。问题在于它需要从路径构建和安装,但我无法处理它以在规范或源代码中的任何位置传递路径。它已经可以工作,创建,安装和打包gem作为一个rubygem,并在GEM中的Lockfile下列出,但只有编码不正确(这是所有参考具体的宝石和路径输入清晰)莺:不支持路径宝石

这里我的代码:

莺/ lib目录/莺/特征/ 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 

这是创业板安装路径

捆扎机/ lib目录/捆扎机/ 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 

回答

0

我不确定这是否适合您,但为了解决此问题,我在供应商/缓存中创建了包含gem的路径中的符号链接。

E.g. vendor/cache/gem_name -> ../../../gem_name