How to change bundle install from default to my project gemfile? - ruby

I am trying to install the gems from my Gemfile to my project, but when I have performed "bundle install", the bundler started installing the default gems, but not that one from my Gemfile.
Gemfile dir: C:\Users\ipinhei5\Desktop\Automation\napps-ANDROIDmation
See below:
[bundle installing default gems]
C:\Users\ipinhei5\Desktop\Automation\napps-ANDROIDmation>bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using CFPropertyList 3.0.0
Using to_boolean 1.0.2
Using android-adb-extension 0.1.2
Using awesome_print 1.8.0
Using backports 3.13.0
Using builder 3.2.3
Using bundler 2.0.1
Fetching byebug 11.0.1
Installing byebug 11.0.1 with native extensions
[My project Gemfile]:
source "https://rubygems.org"
gem "calabash-cucumber"
gem 'calabash-android'
gem 'cucumber'
gem 'rspec'
gem 'yml_reader'
gem 'rest-client'
gem 'android-adb-extension', '~> 0.1.1'
gem 'pry', '~> 0.10.4'
gem 'pry-byebug', '~> 3.4'
gem 'rubysl-rexml'
gem 'cpf_generator', '~> 1.0'
gem 'meglish', '~> 1.0', '>= 1.0.5'
gem 'pluoa-mapper', '~> 1.0', '>= 1.0.2'
Could you help me how to install the gems from my Gemfile?
Edit 1: I think I misunderstood gems with dependencies.
Edit 2:
I got some errors from installing json package
Fetching json 2.2.0
Installing json 2.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
C:/Ruby24-x64/bin/ruby.exe -I C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0 -r
./siteconf20190412-3460-119pn5l.rb extconf.rb
creating Makefile
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
make "DESTDIR=" clean
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
make "DESTDIR="
make failedNo such file or directory - make "DESTDIR="
Gem files will remain installed in
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0 for inspection.
Results logged to
C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/json-2.2.0/gem_make.out
An error occurred while installing json (2.2.0), and Bundler cannot continue.
Make sure that gem install json -v '2.2.0' --source 'https://rubygems.org/'
succeeds before bundling.
In Gemfile:
calabash-android was resolved to 0.9.8, which depends on
luffa was resolved to 2.1.0, which depends on
json

It's not installing "default" packages. It is installing the packages in your Gemfile and the dependencies of those packages. If you see that it's installing packages that you didn't specify in your Gemfile, it's because those packages are dependencies of one or more of the packages in your Gemfile.
From the bundle install documentation:
Install the dependencies specified in your Gemfile
...Bundler will fetch all remote sources, resolve dependencies and
install all needed gems.
You can use the gem dependency command with the --reverse-dependencies flag to see why a gem was installed. In your case use, for example, gem dependency CFPropertyList --reverse-dependencies to see why the CFPropertyList gem was installed. At the very bottom of the output of the command it will tell you which package required it as a dependency.
You can also check your Gemfile.lock file after you've run bundle install to see the list of packages you have installed and their dependencies. Under the specs header you'll see a list of all the packages that was installed. Some of the packages have a list of indented packages underneath them. Those are the dependencies of the package.
For example, let's see why the to_boolean package was installed:
specs:
android-adb-extension (0.1.2)
to_boolean (~> 1.0)
You had the android-adb-extension as a dependency in your Gemfile and if we check the android-adb-extension page on rubygems, we see that to_boolean it's (only) run-time dependency.

Related

Bundler could not find compatible versions for gem "globalize":

Hi everyone I have recently started developing with this framework, I am having difficulties in starting a project locally.
When I go to run a
bundle install
I get this error message:
Bundler could not find compatible versions for gem "globalize": In Gemfile:
globalize java
globalize-accessors java was resolved to 0.2.1, which depends on
globalize (>= 5.0.0, ~> 5.0)
Could not find gem 'globalize (>= 5.0.0, ~> 5.0)', which is required by gem 'globalize-accessors', in any of the relevant sources: https://github.com/globalize/globalize.git (at master#bcfa30f)
Bundler could not find compatible versions for gem "globalize-accessors": In snapshot (Gemfile.lock):
globalize-accessors (= 0.2.1)
In Gemfile:
globalize-accessors java
Running `bundle update` will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.
this is the part of the gemfile concerned:
########## Globalization
gem "route_translator", git: "https://github.com/enriclluelles/route_translator.git"
gem 'activemodel-serializers-xml'
gem 'globalize-accessors'
gem 'globalize', github: 'globalize/globalize'
gem 'kaminari', github: "amatsuda/kaminari", branch: '0-17-stable'
gem "kaminari-i18n"
i also tried to run bundle update but it didn't fix the problem
Ruby version:2.3.3
gem -v:2.5.2
The version of globalize in your gemfile seems not to correspond to the version required for globalize-accessors.
Try installing globalize like so :
gem 'globalize', "~> 5.0"

bundle install: 'minitest/autorun x64-mingw32' not in Gemfile

When trying to run bundle install on i receive the following exception:
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'minitest/autorun x64-mingw32' in any of the gem sources
listed in your Gemfile.
I was originally trying to run bundle exec rake, which suggests the same issue with gem 'minitest/autorun x64-mingw32'. Running them with rake test works fine; hence, I think I've done something wrong with bundler related to my OS (windows 7 x64). The install works properly without this package. I also tried using unit/test with the same result.
Ruby version is 2.4.4.
Gemfile:
source "https://rubygems.org"
gemspec
gem 'json', '~> 2.1.0', '>= 2.0.4'
gem 'addressable', '~> 2.5.2', '>= 2.5.2'
gem 'mongo', '~> 2.5.1', '>= 2.5.1'
group :test do
gem 'rake'
gem 'minitest/autorun'
end
Do I need to specify the platform or some other variable so that bundle looks for the right version of the gem on rubygems?
Any help would be much appreciated.

Could not find gem 'wdm (>= 0.1.0) x64-mingw32' in any of the gem sources listed in your Gemfile or available on this machine

When I run Jekyll serve on Git Bash I get the following warning:
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
After adding the Gemfile I get another error message.
Could not find gem 'wdm (>= 0.1.0) x64-mingw32' in any of the gem sources
listed in your Gemfile or available on this machine.
I tried installing Ruby Devkit to fix this issue but I only end up getting the following error messages.
$ ruby dk.rb install
[INFO] Skipping existing gem override for 'C:/Ruby200-x64'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby200-x64'
$ gem install json --platform=ruby
ERROR: Error installing json:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
You need to run bundle install after adding the wdm gem to your Gemfile to download it.
It seems you have installed devkit before, and it skips the new installation, try
ruby dk.rb install --force
Need to add wdm into bundle after downloading it. Try
bundle add wdm

How to install gems from Gemfile?

I want to add code coverage to my project and sign up coveralls.io and create Gemfile with:
gem 'coveralls', require: false
but how can I install the gem from Gemfile?
run the command bundle install in your shell, once you have your Gemfile created.
This command will look your Gemfile and install the relevant Gems on the indicated versions.
The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.
Your can create a Gemfile just by typing bundle init in your shell
I add a Gemfile example for your reference:
source "https://rubygems.org" # where gems will be downloaded from
ruby "2.2.3" # ruby version, change for the one you use
gem "sinatra"
gem "sinatra-flash"
gem "sinatra-partial"
gem "bcrypt"
gem "dm-validations"
gem "dm-transactions"
gem "data_mapper"
gem "dm-postgres-adapter"
gem "pg"
gem "database_cleaner"
group :test do # you can make groups for test, development, production..
gem "rspec"
gem "capybara"
gem "rspec-sinatra"
gem "cucumber"
gem "coveralls", require: false
end
First install bundler if you don't have it
gem install bundler or sudo gem install bundler if you don't have the required permissions. Bundler is a gem that manages gem dependencies.
then you can follow the above instruction for creating the gemfile, after which you can issue the command
bundle install

Missing gem Faraday

I'm new to Ruby and I'm just trying to run a script. Firstly, when I try to bundle install it says:
Daniels-Air:Documents Daniel$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Rubygems 2.0.3 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Installing ffi 1.9.10 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-8jiqebffi-1.9.10/gems/ffi-1.9.10 for inspection.
Results logged to /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-8jiqebffi-1.9.10/gems/ffi-1.9.10/ext/ffi_c/gem_make.out
Using multipart-post 2.0.0
Installing json 1.8.3 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-5mz4k9json-1.8.3/gems/json-1.8.3 for inspection.
Results logged to /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-5mz4k9json-1.8.3/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
Using multi_json 1.11.2
Using rubyzip 1.1.7
Using websocket 1.2.2
Using bundler 1.11.1
An error occurred while installing ffi (1.9.10), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.10'` succeeds before bundling.
When I then try to execute the file anyway I come across the problem:
Could not find gem 'faraday' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
Where do I get this 'faraday' gem from? Should it have come with the code I am trying to run, or should I update something? Sorry if I got some terminology wrong, I'm very new to Ruby.
I've just realised all I needed to do was install the gem. Its made clear from the RubyGems.org library. Just typed:
sudo gem install faraday
to the terminal

Resources