Skip to content

Instantly share code, notes, and snippets.

@stefanpenner
Created August 2, 2011 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanpenner/1121538 to your computer and use it in GitHub Desktop.
Save stefanpenner/1121538 to your computer and use it in GitHub Desktop.
Ruby Turbo
# snip..
#unstable for prod but fine for development
# credit to @burkelibbey
function turbo(){
if [[ $RUBY_HEAP_MIN_SLOTS != 1000000 ]]
then
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_HEAP_FREE_MIN=500000
export RUBY_GC_MALLOC_LIMIT=1000000000
export turbo_tag="⚡"
else
unset RUBY_HEAP_MIN_SLOTS
unset RUBY_HEAP_SLOTS_INCREMENT
unset RUBY_HEAP_SLOTS_GROWTH_FACTOR
unset RUBY_HEAP_FREE_MIN
unset RUBY_GC_MALLOC_LIMIT
unset turbo_tag
fi
build_ps1
}
# snip..
# haxor rails/bundler to boot off specific load_paths,
# not the super massive one supplied by bundler
begin
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
$:.reject! {|path| path =~ /gem/}
$:.unshift "/tmp/crap/"
require 'pathname'
root = Pathname.new("").expand_path.to_s
$:.unshift root
$:.unshift root + "vendor/plugins/country_select"
require 'rubygems'
require 'bundler'
end
module Bundler
class Runtime < Environment
include SharedHelpers
def setup(*args)
self
end
end
end
#!/bin/sh
# brittle prototype
mkdir -p /tmp/crap
for file in `bundle exec rails runner "puts $:" | grep -e '/lib$' `
do
echo "$file/"* /tmp/crap
cp -R "$file/"* /tmp/crap
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment