简体   繁体   English

莺:不支持路径宝石

[英]Warbler: No Support for Path Gems

Here My Problem: Warbler doesn't support gems which are included via path in the gemfile. 我的问题在这里:莺不支持通过gemfile中的路径包含的gem。 nevertheless i need to do that for my work. 不过,我需要为自己的工作做这件事。 it is important that the included gem is packed and handled as a simple rubygem in the war archive. 重要的是,将随附的宝石打包和存储为战争档案中的简单红宝石。 until now i have tried to manipulate the bundler so when the spec arrives in the warbler/traits/bundler.rb (that's where the specs are packed to the archive) it already has 'Bundler::Source::Rubygems' as source. 到现在为止,我一直在尝试操作捆绑程序,因此,当规范到达warbler / traits / bundler.rb(即将规范打包到存档中的位置)时,它已经具有“ Bundler :: Source :: Rubygems”作为源。 the problem is that it sill needs to be build and installed from the path, but i can't handle it to pass the path anywhere in the spec or in the source. 问题是必须从路径构建和安装它,但是我无法处理它以在规范或源代码中的任何地方传递路径。 it already works that the gem is built, installed and packed into the archive as a rubygem and listed under GEM in the Lockfile but only with bad coding (it is all with reference to a specific gem and the path is typed in clearly) 它已经可以将gem作为rubygem构建,安装并打包到归档文件中,并在GEM下列在Lockfile中,但是仅使用了错误的编码即可(所有代码都与特定的gem有关,并且输入了明确的路径)

Here my code: 这是我的代码:

warbler/lib/warbler/traits/bunlder.rb line: 60 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

This is where the gem is installed path 这是gem的安装路径

Bundler/lib/bundler/dsl.rb line: 120 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

I'm not sure if this is an option for you, but in order to work around this problem, I create symbolic links in vendor/cache to the path with the included gem. 我不确定这是否是您的选择,但是为了解决此问题,我在供应商/缓存中创建了指向包含宝石的路径的符号链接。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM