rubybundlergemfilegem-bundler

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


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


Solution

  • 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.