Skip to content

Instantly share code, notes, and snippets.

View rsanheim's full-sized avatar

Rob Sanheim rsanheim

View GitHub Profile
// only outputs if console available and does each argument on its own line
function log() {
if (window && window.console && window.console.log) {
var i, len;
for (i=0, len=arguments.length; i<len; i++) {
console.log(arguments[i]);
}
}
}
#!/bin/bash
echo "Setting up chef..."
sudo apt-get -y update
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert
cd /tmp
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
tar zxf rubygems-1.3.4.tgz
def self.log(method, options = {})
the_logger = options[:logger] || send(:logger)
meth = the_logger.respond_to?(:debug) ? :debug : :puts
define_method("#{method}_with_logging") do |*args|
the_logger.send(meth, "Before method: #{method} arguments: #{args.inspect}")
result = send("#{method}_without_logging", *args)
the_logger.send(meth, "After method: #{method} result: #{result.inspect}")
result
end
require 'test/unit'
class TestLibraryFileName < Test::Unit::TestCase
def teardown
puts "i run"
end
def test_case_name
assert_equal 1, 2
gem 'rspec'
require 'spec'
describe "something" do
after { puts "i run!" }
it 'fails' do
1.should == 2
end
end
(in /Users/rsanheim/src/oss/rspec)
Profiling enabled.
.........................................................................................................................................................................................................................................................................*.....*......................*....................................................*...............................................................................................................................................................................................................................................................................................................................................................*............................................................................................................................................................................................................................................................................
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com]
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] Setting up xsltproc (1.1.22-1ubuntu1) ...
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] Processing triggers for libc6 ...
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] ldconfig deferred processing now taking place
*** [err :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] E:
*** [err :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/glib2.0/libglib2.0-0_2.16.3-1ubuntu3_i386.deb: 404 Not Found [IP: 91.189.88.31 80]
*** [err :: admin@ec2-75-101-172-199.compute-1.amazonaws.com]
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] Reading package lists...
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com]
** [out :: admin@ec2-75-101-172-199.compute-1.amazonaws.com] Building dependency tree...
rsanheim@ares:~/src/relevance/obsidian (master)$ rake
(in /Users/rsanheim/src/relevance/obsidian)
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
/opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:147:in `activate': can't activate activesupport (= 2.1.1, runtime), already activated activesupport-2.1.2 (Gem::Exception)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:163:in `activate'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:162:in `each'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:162:in `activate'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
from ./test/test_helper.rb:6
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
(in /Users/rsanheim/src/oss/dm-core)
......*...................................................................**........*..................*...................*....*.........................................................................................*............................................................*........................*...............*............................................................*........................*..............................................*..........**.............******...***...*******..............................................................................................................................................................................................................*...................................................*****....*.......................................................................*.............................................F.................................................*.................................................
# module: audit2
class Audit < Thor
desc "all", "Run all audit tasks"
def all
%w(architecture database stats tests coverage flog roodi filesize queries).each do |task|
log "\n*** reviewing #{task}", true
log `thor audit:#{task}`, true
end
end