Strapping Young Lad is a tokenised solution template substitution engine. A bit of a mouthful I know but it actually much simpler than it sounds (and hopefully much more useful that you'd think). So what does it do? Well running
lad /path/to/git/repo MyNewProject
Will do the following things,
- Clone the repo at
path/to/git/repointo a temporary folder
- Remove the
.gitfolder from the repo
- Check for the existence of a
.ladconfigin the freshly cloned repo
- If one exists it loads the config setting
- Otherwise it falls back to the defaults
- Replace all instances of the configured token (eg.
__NAME__) in all files, directories and file contents with the project name (in our case
- Copy the new folder over to your current working directory (
What this allows you to do is have a standard project template for pretty much anything (.NET, Ruby, Scala - listen I mean anything - if it a collection of folders and files in a git repo then you set) and create a new instance with a few keystrokes - saving you time and potential RSI.
SYL was inspired by WarmuP which is itself a gem but it requires you to be running .NET which for a lot of my requirement isn't going to cut it.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install lad
The example above shows you how to use the gem,
lad <PathToRepo> <ProjectName>
PathToRepois the git repository url that will be cloned
ProjectNameis the name of the project. This will replace the
__NAME__token in the repository directories, files and contents. It is possible to declare other tokens as well via the
SYL, once the repository has been cloned will check for the existence of file with the name
.ladconfig from which it will load the settings. If it doesn't exist the default setting will be applied.
token- this is the token/indetifier that will be replaced in the template with the name of the project (defaults to
__NAME__). This option will also accept and array of tokens ['NAME', 'NAMESPACE']. In this case the user will be prompted for the values of these tokens.
ignore- a list of extensions that SYL will ignore when it comes to replacing CONTENTS. It will still RENAME the file if the file name includes the token. This allows us to ignore binary files whose contents should not change.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
20 Apr 2012 - Version 0.1.2 released. .ladconfig now accepts multiple tokens to be specified. 17 Apr 2012 - Version 0.0.2 released. Addition of simple help text on the command line. 17 Apr 2012 - Version 0.0.1 released.
- zip support (generate project from zip file)
- other things as yet undetermined