Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Gemfile?

Tags:

ruby

rspec

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?

like image 728
Saurabh Juneja Avatar asked May 20 '15 19:05

Saurabh Juneja


People also ask

How is Gemfile created?

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.

How do I create a Gemfile lock?

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.

How do I get to Gemfile?

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.

What is a 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.


1 Answers

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" 
like image 195
Andy Waite Avatar answered Oct 19 '22 10:10

Andy Waite