When using lono if you sometimes forgot to regenerate the templates after making changes you can use lono with guard to never have to remember again.
Setup lono and guard
If you have created a lono project with the
lono new command then the Guardfile should have already been set up for you. Then all you have to do is run:
bundle exec guard
If you manually set up the lono project, then you can have to install the gem and setup the Guardfile. Add
guard-lono to your Gemfile and run bundle. Then set up the Guardfile by running the following.
guard init lono bundle exec guard
Watching lono and guard
Once guard is running you should see something like this:
$ bundle exec guard  guard(main)>
As you edit and save any files in the templates or config folders, the lono generate command will automatically run 😊 Here’s what it looks like after I’ve saved some files twice:
$ bundle exec guard  guard(main)> Generating both CloudFormation template and parameter files. Generating CloudFormation templates: output/single-instance.yml output/instance-and-route53.yml output/asg.yml Generating params files Params file generated for asg at output/params/stag/asg.json Params file generated for instance-and-route53 at output/params/stag/instance-and-route53.json Params file generated for single-instance at output/params/stag/single-instance.json 14:13:02 - INFO - Guard is now watching at '/Users/tung/src/tongueroo/cloudformation-examples-lono'  guard(main)>
Hope this was helpful! If you enjoyed this post, you also might like these: