繁体   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