I'm very new to Ruby.
I was following a blog post that says that in order to install a required dependencies I need to create a Gemfile.
How do I create a Gemfile with rspec
as a dependency?
A gemfile is automatically created when you start a new rails application. type rails new appName and then it will be generated automatically. It will also be populated with some gems.
2 Answers. Show activity on this post. Once your Gemfile exists, run command bundle install that will install the gems and create Gemfile. lock file.
Gemfile is a file which must be located in root of your rails project. It is used for describing gem dependencies for Ruby programs. The first thing in your gemfile is a source in which you tell the Gemfile where to look for gems. Source can be called as a block and you can have multiple sources in your gemfile.
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
bundle init generates a Gemfile into the current working directory.
$ bundle init Writing new Gemfile to /app/Gemfile $ cat Gemfile # frozen_string_literal: true source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # gem "rails"
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