Skip to content

Instantly share code, notes, and snippets.

@gotascii
Created June 7, 2012 00:56
Show Gist options
  • Save gotascii/2885827 to your computer and use it in GitHub Desktop.
Save gotascii/2885827 to your computer and use it in GitHub Desktop.
def load_spec(name)
spec_path = Dir.glob("#{Gem.dir}/specifications/#{name}-*.gemspec").last
Gem::Specification.load(spec_path) unless spec_path.nil?
end
def load_outter_gem_19(name)
spec = load_spec(name)
unless spec.nil?
spec.dependencies.each do |dep|
dep_spec = load_spec(dep.name)
dep_spec.activate unless dep_spec.nil?
end
spec.activate
require name
end
end
def load_outter_gem_18(name)
Gem.source_index.refresh!
Gem.activate(name)
require name
end
def load_outter_gem(name)
version = RUBY_VERSION.split(".")[0..1].join
send("load_outter_gem_#{version}", name)
end
def spy
load_outter_gem "pry"
if Object.const_defined?("Pry")
Pry.start
exit
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment