jump to navigation

Run a single cookbook recipe with chef-solo November 25, 2009

Posted by John Dewey in Chef, Code, Example, Rake.
1 comment so far

I generally build my systems with chef-solo cookbooks. I do not want to maintain a central server for recipes. However, I’m getting to the point where I’d like to share my cookbooks from one solo project to another. Anyways, I
wanted to run an individual recipe of a given cookbook. The following gist allows for this. Although, it may not be necessary, since cookbooks are generally idempotent. Seemed like a good idea earlier in the evening, meh.

http://gist.github.com/242526

Advertisements

Using Ohai to obtain platform September 1, 2009

Posted by John Dewey in Chef, Code, Deployment, Ohai.
add a comment

I have found myself needing to know the operating system platform. Rather than explicitly checking for /etc/lsb-base or /etc/issue to determine if it’s Ubuntu or Debian respectively. Let Ohai do the work for you.

This small gist prints the platform. You can access just about anything you want to know about your system via this method.

Changing the default error text in the Rails reCAPTCHA plugin July 15, 2009

Posted by John Dewey in Configuration, Example, Plugins & Gems, Rails.
add a comment

I couldn’t find information on changing the default “Captcha response is incorrect, please try again.” text returned by the reCAPTCHA Rails plugin.

This gist uses Rails 2.2’s internationalization (I18n) to change the message.

Sinatra utf-8 Content-Type before filter April 22, 2009

Posted by John Dewey in Code, Example, Sinatra.
add a comment

I wanted to learn Sinatra, so I started converting my personal Rails site over to Sinatra. I scrape my Twitterholic rating, and redisplay it on my site. I need the css and html to have a Content-Type of utf-8.

I came up with the following before filter. There is probably a better way to do this, I just wanted my controllers to be less “wet”.

I also use the following to render all css.

gem install that (well kind-of) April 11, 2009

Posted by John Dewey in Code, Plugins & Gems.
add a comment

Geminstallthat is a pretty groovy name, which reidmix came up with. What would be really geeky is a gem named ‘that‘, which allows you to read my blog. I didn’t feel like dealing with rubyforge (to get the non-githuby gem name) , so here is a sneak peek at that.

$ gem sources -a http://gems.github.com
$ sudo sudo gem install retr0h-that
Successfully installed retr0h-that-0.0.0
1 gem installed
Installing ri documentation for retr0h-that-0.0.0...
Installing RDoc documentation for retr0h-that-0.0.0...
$ that

It will display all posts from the time the gem was built to Time.now.

Find missing RSpec view tests March 16, 2009

Posted by John Dewey in Code, Rake, RSpec.
2 comments

I created a quick little rake task which finds missing RSpec view tests. It assumes the extension is .haml, however, this can be overridden with the EXTENSION environment variable.

rake spec:missing_view_templates
or
EXTENSION=erb rake spec:missing_view_templates 

using geminstaller with vlad the deployer February 28, 2009

Posted by John Dewey in Configuration, Deployment, Example, Rake, Vlad.
1 comment so far

I really really really like vlad the deployer. I recently switched my apps over to geminstaller vs Rails’ config.gem.

This gist adds in geminstaller functionality to vlad’s update task.

ActionMailer Timeouts February 22, 2009

Posted by John Dewey in Code, Monkey Patch, Rails.
add a comment

The following gist contains a monkeypatch allowing configurable timeouts on ActionMailer.  Since ActionMailer is blocking, it is nice to set a reasonable timeout, rather than wrapping each of your ActionMailer calls with a Timeout (alarm).  I actually monkeypatch all of ‘net/smtp’, so just rescue ‘Timeout::Error’ where needed.

chef-solo VPS provisioning February 21, 2009

Posted by John Dewey in Apache, Automation, Chef, Code, Configuration.
add a comment

I probably built a naive chef solo configuration. I also know I could have used one of the many “Ready Stack” solutions VPS providers are creating. However, I like my systems setup a particular way.

Take a peek the configuration is pretty cool. The code is on github.

Ideally chef would have built my system from the ground up, installing ruby, libs, etc… Since I do not control this piece, there are a few prerequisites to setting up chef.

Once complete, drop in your virtualhost, and deploy your code. This is not intended as zero-conf. Merely a standard base configuration for all of my hosts.

icanhasrspec – lolspek sneak peek February 17, 2009

Posted by John Dewey in Example, RSpec.
2 comments

mah frend reid addd lolspeak 2 rspec. i am bloggin dis as wai 2 persuade him 2 post hims gist. 🙂

updat0rz: teh gist addded – kthxbye