Using Ruby & Thor For Easier Puppet Module Development
USING RUBY & THOR FOR EASIER PUPPET
Tehmasp Chaudhri / @tehmaspc
Pearson North America (We're Hiring!)
WHAT IS THOR?
Thor is a Ruby toolkit for building powerful command-line
The developer can easily integrate Thor into their Ruby code.
Classes such as Groups, Actions, and Shell are provided which
make tasks such as file system interaction and command line
user dialogue easier.
Thor can be leveraged to make custom project generators (e.g.
'bundle gem -b mygem')
POPULAR PROJECTS USING THOR:
WHY DID WE USE THOR?
Thor is written in Ruby, our Puppet code is in a Ruby DSL.
Thor's custom project generator use case was appealing and
works well. It's easy to add and update template files.
We wanted to create a framework for Puppet module
development which provided the Puppet tools we like, so that
we could create standalone & well tested Puppet modules.
Thor let us glue all this together.
We allow (many) dev teams to contribute to our Puppet
module development; thus we needed a way to make creating
Puppet modules quick & easy, consistent, manageable, and
with 'best practices' baked in.
TOOLS WE LIKE TO USE WITH PUPPET MODULE
Shoutout to Phil Zimmerman's Puppet Testing For The Win
THOR CUSTOM GENERATOR EXAMPLE:
tmlt 'EDEm.r' tre.on'EDEm'
epae RAM.deb, agtji(RAM.d)
tmlt 'uptMdlFl.r' tre.on'oueie)
epae ppe/oueieeb, agtji(MdlFl'