捆绑包无法找到已安装的宝石

时间:2018-06-29 09:08:06

标签: ruby bundler

我正在尝试为两个平台(ruby-2.3.7和jruby-9.1.17.0)捆绑和打包

这是我的Gemfile:

source 'https://rubygems.org'
gem 'pg_array_parser', git: 'https://github.com/kares/pg_array_parser'

这些是我发出的命令:

rm -rf vendor Gemfile.lock .bundle

rvm use jruby-9.1.17.0
bundle

rvm use 2.3.7
bundle
bundle lock --add_platform java
bundle package --all --all-platforms

一切正常,直到最后一行(bundle package --all --all-platforms)。

我希望最后一个命令能够正常工作,并为两个平台提供pg_array_parser gem。相反,这就是我得到的:

Using bundler 1.16.2
Using pg_array_parser 0.0.9 from https://github.com/kares/pg_array_parser (at master@bad0cad)
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Updating files in vendor/cache
Could not find pg_array_parser-0.0.9-java in any of the sources

对我来说,这似乎是捆绑程序中的错误。还是我错过了什么?


这是bundle env的输出:

环境

Bundler             1.16.2
  Platforms         ruby, x86_64-darwin-17
Ruby                2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin17]
  Full Path         /Users/alexander/.rvm/rubies/ruby-2.3.7/bin/ruby
  Config Dir        /Users/alexander/.rvm/rubies/ruby-2.3.7/etc
RubyGems            2.7.7
  Gem Home          /Users/alexander/.rvm/gems/ruby-2.3.7
  Gem Path          /Users/alexander/.rvm/gems/ruby-2.3.7:/Users/alexander/.rvm/gems/ruby-2.3.7@global
  User Path         /Users/alexander/.gem/ruby/2.3.0
  Bin Dir           /Users/alexander/.rvm/gems/ruby-2.3.7/bin
Tools
  Git               2.17.1
  RVM               1.29.3 (master)
  rbenv             not installed
  chruby            not installed
  rubygems-bundler  (1.4.4)

捆绑器构建元数据

Built At          2018-06-29
Git SHA
Released Version  false

捆绑器设置

specific_platform
  Set for the current user (/Users/alexander/.bundle/config): true
cache_all_platforms
  Set for your local app (/Users/alexander/projects/test/.bundle/config): true
cache_all
  Set for your local app (/Users/alexander/projects/test/.bundle/config): true

Gemfile

Gemfile

source 'https://rubygems.org'

gem 'pg_array_parser', git: 'https://github.com/kares/pg_array_parser'

Gemfile.lock

GIT
  remote: https://github.com/kares/pg_array_parser
  revision: bad0cad48b70ec9a6e4f67452384d4f72813b646
  specs:
    pg_array_parser (0.0.9)
    pg_array_parser (0.0.9-java)

GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  java
  ruby
  universal-java-1.8
  x86_64-darwin-17

DEPENDENCIES
  pg_array_parser!

BUNDLED WITH
   1.16.2

1 个答案:

答案 0 :(得分:0)

看起来像个错误。最可能的地方是捆扎机。可能没有将其更新为最新版本。

如果我使用的是MRI ruby-2.3.4jruby-9.1.13.0的旧版本,则它可以工作(在CentOS 7.x上):

这是bundle lock --add_platform java的日志:

[smalltalk@localhost so]$ bundle package --all --all-platforms
Writing lockfile to /home/smalltalk/build/so/Gemfile.lock
Using bundler 1.16.2
Using pg_array_parser 0.0.9 from https://github.com/kares/pg_array_parser (at master@bad0cad)
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Updating files in vendor/cache

请注意,没有错误-Could not find pg_array_parser-0.0.9-java in any of the sources

即使tree的输出对我来说也不错:

.
├── Gemfile
├── Gemfile.lock
└── vendor
    └── cache
        └── pg_array_parser-bad0cad48b70
            ├── CHANGELOG.md
            ├── ext
            │   └── pg_array_parser
            │       ├── extconf.rb
            │       ├── pg_array_parser.c
            │       ├── PgArrayParserEngine.java
            │       └── PgArrayParserEngineService.java
            ├── Gemfile
            ├── lib
            │   ├── pg_array_parser
            │   │   └── version.rb
            │   ├── pg_array_parser.jar
            │   └── pg_array_parser.rb
            ├── pg_array_parser.gemspec
            ├── Rakefile
            ├── README.md
            └── spec
                ├── parser_spec.rb
                └── spec_helper.rb

8 directories, 16 files

使用旧版本似乎可以工作。可以吗?