lib/bowline/dependencies/lib/ext/rubygems.rb in maccman-bowline-0.4.4 vs lib/bowline/dependencies/lib/ext/rubygems.rb in maccman-bowline-0.4.5
- old
+ new
@@ -1,16 +1,15 @@
require 'erb'
require 'rubygems'
+require 'rubygems/uninstaller'
require 'rubygems/dependency_installer'
-Gem.pre_install_hooks.push(proc do |installer|
- unless File.file?(File.join(installer.bin_dir, "common.rb"))
- FileUtils.mkdir_p(installer.bin_dir)
- FileUtils.cp(File.join(File.dirname(__FILE__), "common.rb"),
- File.join(installer.bin_dir, "common.rb"))
- end
+# We only require this in 'rake gems:sync' since
+# it contains some advanced Gem features that aren't
+# available in earlier versions, such as pre_install_hooks
+Gem.pre_install_hooks.push(proc do |installer|
name = installer.spec.name
puts "+ #{name}"
if $GEMS && versions = ($GEMS.assoc(name) || [])[1]
@@ -101,18 +100,10 @@
old_fetch(*args)
end
end
end
-class ::Gem::Installer
- def app_script_text(bin_file_name)
- template = File.read(File.join(File.dirname(__FILE__), '..', 'template' , "app_script.rb"))
- erb = ERB.new(template)
- erb.result(binding)
- end
-end
-
class ::Gem::Specification
def recursive_dependencies(from, index = Gem.source_index)
specs = self.runtime_dependencies.map do |dep|
spec = index.search(dep).last
unless spec
@@ -120,6 +111,6 @@
end
spec
end
specs + specs.map {|s| s.recursive_dependencies(self, index)}.flatten.uniq
end
-end
+end
\ No newline at end of file