RubyGems installing wrong code - ruby-on-rails

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) } .
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'

Related

Bundler could not find compatible versions for gem "ruby"

I was trying to bundle install, but I keep on getting this error message.
My attempt was to update the version of ruby. However, this did not work. I also researched the compatible version of activerecord that corresponds to ruby version 2.2.5., but I was not able to find any.
I would truly appreciate it if you could resolve this error.
Here below is my gemfile for reference:
ruby '2.2.5'
source 'https://rubygems.org'
gem 'sinatra', '~> 2.1'
gem 'sinatra-contrib', '~> 2.1'
gem 'webrick', '~> 1.7'
gem 'sinatra-activerecord', '~> 2.0'
gem 'activerecord', '~> 6.1'
gem 'pg', '~> 1.2'
gem 'rake', '~> 13.0'
gem 'bcrypt'
gem 'sinatra-flash'
group :development do
gem 'debase'
gem 'fastri'
gem 'rcodetools'
gem 'rubocop'
gem 'ruby-debug-ide'
end
Reinstalling updated ruby version worked:
rvm reinstall ruby-2.6.3
bundle install

rails server command is not working "using weBrick" "rails"

I have searched or similar problems , but none of the solutions worked for me .
I will describe the problem in details:
The server works as normal when i create a new rails app , our instructor have told us to replace the existing gem file with another -shown below- and run bundle or bundle update to resolve the gems
source 'https://rubygems.org'
gem 'rails', '4.2.3'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'therubyracer', platforms: :ruby
gem 'capybara', '~> 2.4.4'
gem 'poltergeist', '~> 1.6.0'
gem 'phantomjs', '~> 1.9.8.0'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty'
The problem appear when I do replace the existing gem file with the new one ,the server don't work and here is my command line logs.
if you need any further information, leave a comment.
edit: more info >>>rails version installed 5.0.1
I have found a solution for the problem , and I want to leave it here ,so anyone have the same problem could use .
The problem was that I had rails v5.0.1 installed , and that caused problems related to comparability with other gems , so I downgraded my rails to 4.2.3
1-first you need to run gem uninstall rails ,and gem uninstall railties
2-now , go ahead and install rails again ,you could search for rails 4.2.3 to download and install it or you could do this through the command , I'm working on windows and I don't know how the command looks on others ,but I believe it's something similar , you could try this gem install rails '4.2.3' and that it!

Heroku failed to deploy detecting sqlite3

I do not have sqlite installed I am using pg here is my gemfile:
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'jquery-turbolinks'
gem 'momentjs-rails'
gem 'font-awesome-rails'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'turbolinks'
gem 'omniauth-facebook'
gem 'jbuilder', '~> 2.0'
gem 'paperclip', '~> 4.1'
gem 'geoip'
gem 'ziptastic'
gem 'rest-client', '~> 1.7.2'
group :test, :development do
gem 'guard'
gem 'guard-livereload'
gem 'spring'
gem 'rspec-rails', '~> 3.0.0'
gem 'meta_request'
end
I deleted gemfile.lock and ran bundle. For some reason sqlite3 (1.3.9) is appearing in my gemfile.lock...
According to Heroku https://devcenter.heroku.com/articles/bundler
Running bundle install also generates a Gemfile.lock file, which
should be added to your git repository. Gemfile.lock ensures that your
deployed versions of gems on Heroku match the version installed
locally on your development machine.
Why is gemfile.lock showings sqlite3 if it's not in my Gemfile and how do I fix this? Thanks! =)
The problem I had was the gem ziptastic has a sqlite3 dependency which is why my gemfile.lock was including sqlite3. If you're having a similar issue I suggest you check the dependencies of each gem.

Activeadmin: Could not find arbre-1.0.1 in any of the sources

I'm trying to run rails g active_admin:install script after installing of activeadmin gem. When I run this script I get an error
Could not find arbre-1.0.1 in any of the sources
Run `bundle install` to install missing gems.
Although I've already installed all necessary gems and my app is using arbre gem:
Using arbre 1.0.1
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'
How can I fix that problem? Thanks!
Take a look at https://github.com/gregbell/active_admin/issues/3216. Although the cause of the problem is not mentioned they recommend deleting Gemfile.lock and running bundle install again.
The problem is the wrong gemset for the app. For me solution was rvm use 2.1.1#your_gemset and restarting terminal

Ruby on Rails sqlite3-ruby gem interfering with heroku push

I know this question has been answered a million times on SO, but I can't seem to find the right combination of things to fix my dilemma.
This is the error I'm getting:
An error occurred while installing sqlite-ruby (1.2.5), and Bundler cannot continue.
Make sure that 'gem install sqlite3-ruby -v '1.2.5'' succeeds before bundling.
Failed to install gems via bundler.
Detected sqlite gem that is not supported on Heroku
I already have Postgres installed on my laptop, and my Gemfile is as follows:
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'sqlite3-ruby', '1.2.5'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass'
group :doc do
gem 'sdoc', require: false
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Anyone have insight on what I'm doing wrong? I already made sure that my changes are committed via "bundle install" and "bundle".
Simply remove the line
gem 'sqlite3-ruby', '1.2.5'
because you already have the gem sqlite in development and test environments, run bundle install, and you should be good to go!

Resources