简体   繁体   中英

RubyGems installing wrong code

When I install the gem ipa_reader the code does not install correctly. In the file /lib/ipa_reader/ipa_file.rb , the code that I get is

Zip::ZipFile.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) } Zip::ZipFile.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) } . Which I guess is from an older version. What I should get, and what shows up on github is

Zip::File.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) }.

What is going on?

Gemfile

source 'https://rubygems.org'

gem 'rails', '4.1.4'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc

group :development do
  gem 'spring'
  gem 'pry-rails'
end

gem 'CFPropertyList', '~> 2.1.1'
gem 'rubyzip'
gem 'aws-sdk'
gem 'rufus-scheduler'
gem 'omniauth-google-oauth2'
gem 'figaro'
gem 'ipa_reader' , '~> 0.7.1'

When you are installing from rubygems you are downloading stable 0.7.1 version, while at github there is latest development version. If you want to use this one (although it is not recommended to live on the bleeding edge), specify git url in your gemfile

gem 'ipa_reader', git: 'https://github.com/schlu/Ipa-Reader.git'

refer here for more info http://bundler.io/v1.3/git.html

This looks like a mistake from the gem author. A github repo is not synched to rubygems, so the gem published to rubygems does not necessarily have to be the exact same thing as on github.

You can easily tell bundler to user the code from github, by doing:

gem 'ipa_reader', github: 'schlu/Ipa-Reader'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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