Skip to content

Instantly share code, notes, and snippets.

@skwak
Last active August 29, 2015 14:02
Show Gist options
  • Save skwak/4c9a6229b1776e3f9107 to your computer and use it in GitHub Desktop.
Save skwak/4c9a6229b1776e3f9107 to your computer and use it in GitHub Desktop.
Rubygems Reading Assessment
  1. The command bundle gem foodie creates a scaffold directory named foodie. This command will also start saving files to a Git repository if Git is installed.

  2. The test files are put into the spec directory.

  3. We write spec.add_dependency "activesupport", "4.0.0"

  4. Steps to write a generator:

  • First, we define a generator class called recipe, and we require the file for the class.
  • We make sure to set inheritance so that recipe inherits from Thor::Group, and we include Thor::Actions to define helper methods.
  • We define arguments by calling argument, and define the methods in the class.
  • Next, we run the generator (without running Cucumber) by running bundle exec bin/foodie recipe dinner steak.
  • After we run bundle exec bin/foodie recipe dinner steak, we'll be asked define the source_root method, so we define it as a class method in Foodie::Generators::Recipe.
  • Then, we put a template in lib/foodie/generators/recipe/recipe.txt using the template method.
  • Lastly, we run bundle exec cucumber features and see everything pass!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment