2013-10-11 89 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