background preloader

Ruby DSL

Facebook Twitter

Enough Ruby To Be Dangerous. I am a recovering System Administrator.

Enough Ruby To Be Dangerous

It's a title I was chained to for the first decade of my career. I've only recently decided to tackle Software Engineering full-time, and despite the challenges of changing careers, it has kept me free of on-call pager duties. That was until my company decided to start a new cloud-based service offering. This service was to be run 'DevOps' style - a perfect hybrid of my experience in both System Administration and Software Engineering. To scale this new service, we were going to use Chef for infrastructure automation. At this point, I was becoming well versed in Python.

I'm going to have to learn Enough Ruby to be Dangerous. What is Ruby, right? Ruby is a Python DSL for Hipsters. j/k. According to Yukihiro 'Matz' Matsumoto, the creator of Ruby: An interpreted scripting language for quick and easy object-oriented programming. Matz created Ruby in the 90's from a desire for a language more powerful than Perl, and more object-oriented than Python. Awesome. Just Enough Ruby for Chef. Ruby is a simple programming language that is designed to be easy to read and to behave in a predictable manner.

Just Enough Ruby for Chef

The chef-client uses Ruby as its reference language for creating cookbooks and defining recipes, with an extended DSL (domain-specific language) that is used for specific resources. Enough resources are available to support the most common infrastructure automation scenarios natively within Chef; however, this DSL can also be extended when additional resources and capabilities are required. The chef-client uses Ruby as its reference language for creating cookbooks and defining recipes, with an extended DSL (domain-specific language) that is used for specific resources.

These settings are saved as Ruby files and are stored in the chef-repo. When these files are uploaded to the Chef server, they are converted to JSON. Many people who are new to Ruby often find that it doesn’t take very long to get up to speed with the basics. . $ ruby -c my_cookbook_file.rb.

Ruby Language Ref

Learning Ruby. Ruby Cheat Sheets. Ruby is an easy language to learn, but it's often necessary to look up something we've forgotten.

Ruby Cheat Sheets

A combination of Google plus any Ruby books we have on our shelves can help, but sometimes it's handy to refer to a simpler set of notes - such as a "cheat sheet. " This post attempts to cover the most interesting ones. The idea for this initial list came from Scott Klarr's own list. Scott has been quite prolific lately in putting together lists of cheat sheets. Some of his lists are: Apache cheat sheets, MySQL cheat sheets, PHP cheat sheets, and JavaScript / AJAX cheat sheets. On with the Ruby cheat sheets: "Essential Ruby" RefCard (PDF) Essential Ruby is a combination of a cheat sheet and a tutorial. Ruby Cheatsheet (PDF and PNG) Ruby QuickRef (HTML) I often use this one myself! Ruby Reference (PDF) Cheat: Ruby Cheat Sheets on your Terminal! A Beginner's Notes (HTML) A set of notes made by a beginning Ruby developer as he works his way through a Ruby manual.

Strftime Parameters (HTML) Bobsh/puppet-rubydsl-examples. Puppet & Ruby DSL. Puppet & Ruby DSL. Re: [Puppet-dev] Converting to Ruby DSL. I've moved the doc and cleaned it up a bit now.

Re: [Puppet-dev] Converting to Ruby DSL

Its a very rudimentary start: As far as recommended DSL conventions for bits that aren't supported yet, here are some suggestions to open up the discussion as I'm sure people have their own opinions: Imports: import "file.pp" Resource Defaults: resource_defaults "foo", :param1 => value1 Resource Collections on exports: resource_collect "foo", :tag => "tagme" Resource Realisation on virtuals: resource_realise "foo", :title => "ken" Resource override: resource_override :service, [:title => "apache"], :require => "Package[apache2]" Resource utilisation: This already exists but I would actually change this to noun_verb to fit the rest.