Skip to content

Instantly share code, notes, and snippets.

@schleary
Last active August 29, 2015 14:02
Show Gist options
  • Save schleary/da0b4afb73b703efa50a to your computer and use it in GitHub Desktop.
Save schleary/da0b4afb73b703efa50a to your computer and use it in GitHub Desktop.
RubyGem Bundler Reading Assessment

###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?


  1. First, we will need to define a generator class with the arguments passed to the generator as the first arguments for the method.

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

  3. Put the generator class in a new namespace called "generators."

  4. Define methods in the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment