This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ spec -cf specdoc perl_spec.rb | |
Ohai::System plugin perl | |
- should run perl -V:version -V:archname | |
- should close perl command's stdin | |
- should iterate over each line of perl command's stdout | |
- should set languages[:perl][:version] (ERROR - 1) | |
- should set languages[:perl][:archname] (ERROR - 2) | |
- should set languages[:perl] if perl command succeeds (FAILED - 3) | |
- should not set languages[:perl] if perl command fails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1st install Apple's XCode (dev tools, gcc, etc) | |
# Then... Setup | |
cat >$HOME/.bash_profile <<\THEEND | |
export PATH=$HOME/bin:/opt/local/bin:$PATH | |
export MANPATH=$HOME/man:/opt/local/man:$MANPATH | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestCLI | |
include Mixlib::CLI | |
option :config_file, | |
:short => "-c CONFIG", | |
:long => "--config CONFIG", | |
:default => 'config.rb', | |
:description => "The configuration file to use" | |
option :log_level, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = service "apache" { action :nothing } | |
r.updated = true | |
r.notifies(:start, r, :delayed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: apt | |
# Recipe:: default | |
# | |
# Copyright 2008, OpsCode, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
`git checkout opscode/master` | |
Dir.glob("*").select {|x| FileTest.directory?(x) }.each do |path| | |
`git br -D #{path}` | |
`git checkout -b #{path} opscode/master` | |
`git filter-branch --tree-filter \ | |
'rm -rf #{Dir.glob("*").reject {|x| x == path }.join(" ")}' --prune-empty HEAD` | |
`rm -rf .git/refs/original` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# nagios apache configuration | |
# | |
# Generated by Chef for <%= @node[:fqdn] %> | |
# | |
<VirtualHost *:80> | |
ServerAdmin noc@example.com | |
ServerName nagios.prod.example.com | |
ServerAlias nagios |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chef | |
class Recipe | |
def has_gem?(name, version=nil) | |
if !$GEM_LIST | |
gems = {} | |
`gem list --local`.each_line do |line| | |
gems[$1.to_sym] = $2.split(/, /) if line =~ /^(.*) \(([^\)]*)\)$/ | |
end | |
$GEM_LIST = gems | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define :memcached_instance, :enable => true do | |
runit_service "memcached-#{params[:name]}" do | |
template_name "memcached" | |
options({:max_memory => node[:memcached][:max_memory], | |
:port => node[:memcached][:port], :user => node[:memcached][:user], | |
:max_connections => node[:memcached][:port]}.merge(params)) | |
end | |
service params[:name] do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu2vm:~/chef | |
$ rake install | |
(in /home/jtimberman/chef) | |
rake install | |
(in /home/jtimberman/chef/chef) | |
/usr/lib/ruby/1.8/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. | |
sudo gem install pkg/chef-0.5.7 --no-rdoc --no-ri | |
Successfully installed chef-0.5.7 | |
1 gem installed | |
rake install |