USING RUBY & THOR FOR EASIER PUPPET
MODULE DEVELOPMENT
Tehmasp Chaudhri / @tehmaspc
Pearson North America (We're Hiring!)
WHAT IS THOR?
Thor is a Ruby toolkit for building powerful command-line
interfaces.
The developer can easily integrate Tho...
POPULAR PROJECTS USING THOR:
berkshelf
bundler
rails
vagrant
...
MORE INFO:
Thor (main)
Thor (GitHub wiki)
WHY DID WE USE THOR?
Technical Reasons:
Thor is written in Ruby, our Puppet code is in a Ruby DSL.
Thor's custom project g...
TOOLS WE LIKE TO USE WITH PUPPET MODULE
DEVELOPMENT:
puppet-lint
puppet-git-hooks
puppetlabs_spec_helper
rspec-puppet
serv...
THOR CUSTOM GENERATOR EXAMPLE:
..
.
dfwieepyis
e rt_mtdr
epydrcoytre.on'ie'
mt_ietr agtji(fls)
epydrcoytre.on'aiet'
mt_iet...
MODULEFILE.ERB EXAMPLE:
nm '% mdl_ae%'
ae <= ouenm >
vrin'..'
eso 010
suc 'NNW'
ore UKON
ato '% mitie_mi %'
uhr <= ananrea...
CURRENT LIST OF TEMPLATE FILES:
.gtgtgoeeb
/i/iinr.r
.gtppe-i-ok-r-omteb
/i/uptgthospecmi.r
.lcne/pce2eb
/iessaahv.r
.lcne...
DEMO
Magnum (our custom Thor based tool)
QUESTIONS?
Upcoming SlideShare
Loading in …5
×

Using Ruby & Thor For Easier Puppet Module Development

1,045 views

Published on

Using Ruby & Thor For Easier Puppet Module Development
Magnum site: https://github.com/tehmaspc/magnum

Original slides: http://goo.gl/syiOUW

2 Comments
2 Likes
Statistics
Notes
No Downloads
Views
Total views
1,045
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
9
Comments
2
Likes
2
Embeds 0
No embeds

No notes for slide

Using Ruby & Thor For Easier Puppet Module Development

  1. 1. USING RUBY & THOR FOR EASIER PUPPET MODULE DEVELOPMENT Tehmasp Chaudhri / @tehmaspc Pearson North America (We're Hiring!)
  2. 2. WHAT IS THOR? Thor is a Ruby toolkit for building powerful command-line interfaces. 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')
  3. 3. POPULAR PROJECTS USING THOR: berkshelf bundler rails vagrant ...
  4. 4. MORE INFO: Thor (main) Thor (GitHub wiki)
  5. 5. WHY DID WE USE THOR? Technical Reasons: 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. Business Reasons: 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.
  6. 6. TOOLS WE LIKE TO USE WITH PUPPET MODULE DEVELOPMENT: puppet-lint puppet-git-hooks puppetlabs_spec_helper rspec-puppet serverspec vagrant bundler rake jenkins Shoutout to Phil Zimmerman's Puppet Testing For The Win
  7. 7. THOR CUSTOM GENERATOR EXAMPLE: .. . dfwieepyis e rt_mtdr epydrcoytre.on'ie' mt_ietr agtji(fls) epydrcoytre.on'aiet' mt_ietr agtji(mnfss) epydrcoytre.on'epae' mt_ietr agtji(tmlts) epydrcoytre.on'pc) mt_ietr agtji(se' epydrcoytre.on'evrpcse' mt_ietr agtji(srese/pc) epydrcoytre.on'vgatppe' mt_ietr agtji(.arn_upt) ed n dfwieram e rt_ede tmlt 'EDEm.r' tre.on'EDEm' epae RAM.deb, agtji(RAM.d) ed n dfwiemdlfl e rt_oueie tmlt 'uptMdlFl.r' tre.on'oueie) epae ppe/oueieeb, agtji(MdlFl' ed n .. .
  8. 8. MODULEFILE.ERB EXAMPLE: nm '% mdl_ae%' ae <= ouenm > vrin'..' eso 010 suc 'NNW' ore UKON ato '% mitie_mi %' uhr <= ananreal > lcne'% lcnenm %' ies <= ies_ae > smay'NNW' umr UKON dsrpin'NNW' ecito UKON poetpg 'NNW' rjc_ae UKON # Addpnece,i ay # d eednis f n: #dpnec 'sraenm' '=120 eedny uenm/ae, > ..'
  9. 9. CURRENT LIST OF TEMPLATE FILES: .gtgtgoeeb /i/iinr.r .gtppe-i-ok-r-omteb /i/uptgthospecmi.r .lcne/pce2eb /iessaahv.r .lcne/i.r /iessmteb .lcne/eevdeb /iessrsre.r .ppe/ntp.r /uptii.peb .ppe/oueieeb /uptMdlFl.r .RAM.deb /EDEm.r .se/itrsyleb /pcfxue.m.r .se/se/ntse.beb /pcrpcii_pcr.r .se/se/pchle.beb /pcrpcse_eprr.r .se/evrpcii_pcr.r /pcsrese/ntse.beb .se/evrpcse_eprr.r /pcsrese/pchle.beb .ui/efl.r /tlGmieeb .ui/aeieeb /tlRkfl.r .vgatii.peb /arn/ntp.r .vgatVgatieeb /arn/arnfl.r
  10. 10. DEMO Magnum (our custom Thor based tool)
  11. 11. QUESTIONS?

×