Skip to content

jackfranklin/project_templater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Templater

V0.3.4

Installation

gem install project_templater

Adds the project_templater executable.

Usage

project_templater {generator} {path}

Templates are listed within lib/generators.

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

Examples

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.

Changelog

0.3.4

  • fix bug of not showing available templates

0.3.3

  • tidy up some internal code

0.3.2

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

0.3.1

  • 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

0.3.0

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

0.2.1

  • release date within gemspec was incorrect.

0.2.0

  • added jekyll_basic generator
  • add pre_install method for generators

0.1.2

  • added html_proto generator, designed for quick HTML prototypes

0.1.1

  • updated ruby_basic generator so it creates a couple more folders

0.1.0

  • initial release

About

A gem for quickly creating project structures.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages