README.md in lono-0.2.4 vs README.md in lono-0.3.0

- old
+ new

@@ -20,13 +20,13 @@ <pre> $ lono generate </pre> -This generates the templates that have been defined in config folder of the lono project. +This generates the templates that have been defined in the config folder of the lono project. -The one of starter lono config files looks like this: +The starter lono template project config files looks like [this](lib/starter_project/config/lono.rb) and [this](lib/starter_project/config/lono/api.rb). Here's a snippet from one of the config files with the template call: ```ruby template "prod-api-app.json" do env,app,role = name.sub('.json','').split('-') source "app.json.erb" @@ -52,11 +52,11 @@ The corresponding ERB template example file is [here](lib/starter_project/templates/app.json.erb). ## Template helper methods -There are helper methods that available in templates. +There are helper methods that are available in templates. * partial - can be use to embed other files in a template. The partial should be placed in the templates/partial folder of the project. So: * partial('launch_config.json.erb') -> templates/partial/launch_config.json.erb * user_data - can be used to include a user data script which is written in bash script form. The user data script should be placed in the templates/user_data folder of the project. So: @@ -73,14 +73,21 @@ <%= user_data('bootstrap.sh.erb') %> ] } ``` -Within a user_data script you can call another helper method called ref. +Within a user_data script you can user helper methods that correspond to Cloud Formation [Instrinic Functions](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/concept-intrinsic-functions.html). Currently, base64, find_in_map, get_att, get_azs, join, and ref are supported. Examples of their usage are found in the starter [project template](https://github.com/tongueroo/lono/blob/master/lib/starter_project/templates/user_data/db.sh.erb) -* ref - can be use to reference other parameter or resource value within the cloud formation template. An [example](lib/starter_project/templates/user_data/db.sh.erb) is in the [starter_project](lib/starter_project). +## Converting UserData scripts -* find_in_map - can be use to call the find_in_map function within the cloud formation template. An [example](lib/starter_project/templates/user_data/db.sh.erb) is in the [starter_project](lib/starter_project). +You can convert UserData scripts in existing Cloud Formation Templates to a starter bash script via: + +<pre> +$ lono bashify cloud_formation_template.json +$ lono bash cloud_formation_template.json # shorthand +</pre> + +This is useful if you want to take an existing [Cloud Formation Template example](http://aws.amazon.com/cloudformation/aws-cloudformation-templates/) and quicklly change the UserData section into a bash script. The bashify command will generate a snippet that is meant to be copied and pasted into a bash script and used with user_data helper method. The bash script should work right off the bat as lono will transform the generated Cloud Formation object references to json objects, there's no need to manually change what is generated to the helper methods, though you can if you prefer the look of the helper methods. ## Breaking up config/lono.rb If you have a lot of templates, the config/lono.rb file can get unwieldy long. You can break up the lono.rb file and put template defintions in the config/lono directory. Any file in this directory will be automatically loaded. An [example](lib/starter_project/config/lono/api.rb) is in the starter project. \ No newline at end of file