Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
$ 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
#!/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
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,
r = service "apache" { action :nothing }
r.updated = true
r.notifies(:start, r, :delayed)
@jtimberman
jtimberman / apt.rb
Created March 25, 2009 13:43 — forked from btm/apt.rb
#
# 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
#
#!/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`
#
# nagios apache configuration
#
# Generated by Chef for <%= @node[:fqdn] %>
#
<VirtualHost *:80>
ServerAdmin noc@example.com
ServerName nagios.prod.example.com
ServerAlias nagios
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
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
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