簡體   English   中英

鶯:不支持路徑寶石

[英]Warbler: No Support for Path Gems

我的問題在這里:鶯不支持通過gemfile中的路徑包含的gem。 不過,我需要為自己的工作做這件事。 重要的是,將隨附的寶石打包和存儲為戰爭檔案中的簡單紅寶石。 到現在為止,我一直在嘗試操作捆綁程序,因此,當規范到達warbler / traits / bundler.rb(即將規范打包到存檔中的位置)時,它已經具有“ Bundler :: Source :: Rubygems”作為源。 問題是必須從路徑構建和安裝它,但是我無法處理它以在規范或源代碼中的任何地方傳遞路徑。 它已經可以將gem作為rubygem構建,安裝並打包到歸檔文件中,並在GEM下列在Lockfile中,但是僅使用了錯誤的編碼即可(所有代碼都與特定的gem有關,並且輸入了明確的路徑)

這是我的代碼:

warbler / lib / warbler / traits / 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

我不確定這是否是您的選擇,但是為了解決此問題,我在供應商/緩存中創建了指向包含寶石的路徑的符號鏈接。

例如vendor/cache/gem_name -> ../../../gem_name

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM