###T E C H N I C A L R E A D I N G A S S E S S M E N T
###1). What does the command “bundle gem foodie” do?
The command bundle gem foodie
creates a gem named foodie
, along with a corresponding scaffold directory consisting of files Gemfile, Rakefile, .gitignore, foodie.gemspec, lib/foodie.rb, lib/foodie, and lib/foodie/version.rb. If Git is installed, bundle gem foodie
will also initialize a Git repository within the directory to be used for commits.
###2). In what folder do we put our test files?
Test files are placed in a file called spec
, using the command mkdir spec
. For every class we want to test at the root of this directory, we create a new RSpec file.
###3). What do we need to write to add the activesupport (version 4.0.0) dependency to our gemspec?
We would write spec.add_dependency "activesupport", "4.0.0"
inside the Gem::Specification
object.
###4). What steps need to be taken to write a generator?
-
First, we will need to define a generator class with the arguments passed to the generator as the first arguments for the method.
-
Inherit from the parent
:: Group
and include the::Actions
module to define helper functions for the generator, which includes those able to create files and directories. -
Put the generator class in a new namespace called "generators."
-
Define methods in the class.