Skip to content

Instantly share code, notes, and snippets.

View marcoow's full-sized avatar
🙈
🙉🙊

Marco Otte-Witte marcoow

🙈
🙉🙊
View GitHub Profile
require "#{File.dirname(__FILE__)}/../vendor/gems/environment"
class Rails::Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
Rails::Initializer.class_eval do
gem bundle
Calculating dependencies...
Updating source: http://gems.rubyforge.org
Downloading actionmailer-2.3.5.gem
Downloading actionpack-2.3.5.gem
Downloading activerecord-2.3.5.gem
Downloading activeresource-2.3.5.gem
Downloading activesupport-2.3.5.gem
Downloading addressable-2.1.1.gem
Downloading data_objects-0.10.0.gem
...
namespace :bundler do
task :symlink_gems do
shared_gems = File.join(shared_path, 'vendor/gems')
release_gems = "#{release_path}/vendor/gems/"
%w(cache gems specifications).each do |sub_dir|
shared_sub_dir = File.join(shared_gems, sub_dir)
run("mkdir -p #{shared_sub_dir} && mkdir -p #{release_gems} && ln -s #{shared_sub_dir} #{release_gems}/#{sub_dir}")
require 'melbourne'
'class Test; end'.to_ast # => #<Melbourne::AST::Class:0x10176dc28 @line=1, @body=#<Melbourne::AST::EmptyBody:0x10176db88 @line=1>, @name=#<Melbourne::AST::ClassName:0x10176dbb0 @line=1, @name=:Test, @superclass=#<Melbourne::AST::Nil:0x10176dbd8 @line=1>>, @superclass=#<Melbourne::AST::Nil:0x10176dbd8 @line=1>>
gem install highlight
require 'simplabs/highlight'
Simplabs::Highlight.highlight(:ruby, 'class Test; end')
gem install reportable
# which branch does contain the given commit
git branch --contains d590f2
class Purchase < ActiveRecord::Base
belongs_to :product
def product=(product)
write_attribute(:product_id, product)
freeze_product_data
product
end