Skip to content

Instantly share code, notes, and snippets.

View agibralter's full-sized avatar
:shipit:

Aaron Gibralter agibralter

:shipit:
View GitHub Profile
bash 'install rvm' do
creates node.rvm[:bin]
cwd '/tmp'
user 'root'
code <<-EOH
tar zxf #{node.rvm[:rvm]}.tar.gz
su - #{user} -c "cd /tmp/#{node.rvm[:rvm]}; sudo ./install"
cp /tmp/#{node.rvm[:rvm]}/archives/* #{node.rvm[:dir]}/archives/
chown root:rvm #{node.rvm[:dir]}/archives/*
su - #{user} -c "source /usr/local/rvm/scripts/rvm && rvm install 1.9.3-p0"
remote_file "/tmp/#{node.rvm[:rvm]}.tar.gz" do
source "#{node.rvm[:rvm]}.tar.gz"
action :create_if_missing
end
group 'rvm' do
members [node.rvm[:user]]
end
bash 'install rvm' do
@agibralter
agibralter / gist:1402092
Created November 28, 2011 21:12
Get ruby-debug19 working on ruby-1.9.3-p0 with rvm.
$ rvm 1.9.3-p0
$ gem install path/to/gem/linecache19 -v "0.5.13"
$ gem install path/to/gem/ruby-debug-base19 -v "0.11.26" -- --with-ruby-include="${rvm_path}/src/`rvm tools strings`"
@agibralter
agibralter / nginx.conf
Created November 28, 2011 20:20
Rewrite http requests coming from upstream proxy.
server {
server_name example.com;
if ($http_X_forwarded_proto = http) {
rewrite ^(.*) https://$server_name$1 permanent;
}
}
ruby_block "Remove from config, if in config file" do
block do
cfg_cmd = "/opt/rightscale/lb/bin/haproxy_config_server.rb"
args = "-a del -w"
args += " -l \"#{node.lb_urtak[:applistener_name]}\""
args += " -s \"#{node.remote_recipe[:backend_id]}\""
args += " -t \"#{node.remote_recipe[:backend_ip]}:8000\""
Chef::Log.info("running command: #{cfg_cmd} #{args}")
@agibralter
agibralter / exception_helper.rb
Created November 7, 2011 06:21
Accessing app errors when using Capybara/Selenium with RSpec
# -*- encoding : utf-8 -*-
# Because Capybara.app gets run by Thin in a separate thread, errors raised in
# the application during request_specs get hidden and just show up in the
# selenium-controller browser as 500 errors with no extra info. This module
# helps us dig into those errors.
module RequestSpecs
module ExceptionHelper
@@last_exception = nil
$ gem install rb-fsevent -v '0.9.0.pre1'
Building native extensions. This could take a while...
ERROR: Error installing rb-fsevent:
ERROR: Failed to build gem native extension.
"/Users/aarongibralter/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby" -rubygems /Users/aarongibralter/.rvm/gems/ruby-1.9.3-rc1@global/gems/rake-0.9.2/bin/rake RUBYARCHDIR=/Users/aarongibralter/.rvm/gems/ruby-1.9.3-rc1@foo/gems/rb-fsevent-0.9.0.pre1/lib RUBYLIBDIR=/Users/aarongibralter/.rvm/gems/ruby-1.9.3-rc1@foo/gems/rb-fsevent-0.9.0.pre1/lib
Build settings from configuration file '/Users/aarongibralter/.rvm/gems/ruby-1.9.3-rc1@foo/gems/rb-fsevent-0.9.0.pre1/ext/rb-fsevent.xcconfig':
ARCHS = $(NATIVE_ARCH_ACTUAL)
DSTROOT = ../../
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
@agibralter
agibralter / 0
Created September 16, 2011 20:04
.............
Finished in 9.15 seconds
13 examples, 0 failures
GC 338 invokes.
Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)
1 0.251 1719160 2260992 56442 4.46699999999999874944
2 0.272 1882160 2277376 56851 3.33300000000003038281
3 0.324 2395800 4014080 100205 6.31100000000001060130
4 0.368 2633240 4063232 101432 5.80100000000000015632
$ time rails r "puts 'foo'"
foo
real 0m22.491s
user 0m20.641s
sys 0m1.854s
$ time rspec spec/controllers/admin/users_controller_spec.rb
No DRb server is running. Running in local process instead ...
.............
@agibralter
agibralter / .rspec
Created September 15, 2011 22:35
Is this the correct setup for spork + rspec + guard? It still seems like the specs are quite slow...
--colour
--drb