Project Templater



gem install project_templater

Adds the project_templater executable.


project_templater {generator} {path}

Templates are listed within lib/generators.

Will default to the PWD if you don't define a path.


project_templater sinatra_basic

Run the sinatra_basic generator and output to the current directory

project_templater sinatra_basic foo/

Run the sinatra_basic generator and output to the pwd/foo/ directory.

Available Generators

  • sinatra_basic
  • js_project
  • ruby_project
  • html_proto
  • jekyll_basic

Adding a Generator

These exist within lib/generators. Create a new .rb file. The class must extend from Generator, and you need to define an instance method run.

You have two methods available to you, make_file and make_dir.

The best way to do it is to copy an existing one - they are all in lib/generators.

Define a run method that will be called. There are two methods available:

  • make_file can be called with just the file to create, and optionally a block. Whatever is returned from the block is then stored as the contents of the file.
  • make_dir will create a new directory.

You can also define a post_install method that is run after the run method has. You also have access to the @base variable, which is the directory the generator was run in.

Similarly, there is a pre_install method which is run just before run. Again, it has access to @base.



  • fix bug of not showing available templates


  • tidy up some internal code


  • logs to the terminal when it creates a file or folder


  • No nasty exception if the generator doesn't exist.
  • run project_templater without arguments to see a list of available generators
  • post_install command line output is now shown


  • Remove all references to nodefetch
  • Fix Sinatra generator. Makes views directory in right place and now sets up layout.erb properly.


  • release date within gemspec was incorrect.


  • added jekyll_basic generator
  • add pre_install method for generators


  • added html_proto generator, designed for quick HTML prototypes


  • updated ruby_basic generator so it creates a couple more folders


  • initial release