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.
To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With