aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-05-14 13:03:01 -0700
committerCarl Lerche <carllerche@mac.com>2010-05-14 13:03:01 -0700
commit64b8b5c2f83e5ec9831ef3e99c6e7c2bd2ed6d98 (patch)
tree636d21872160ed3ee164998d56cde6957e941f01
parentb0665682e3c3781632eae667e39b24a6d9a0dd95 (diff)
downloadbundler-64b8b5c2f83e5ec9831ef3e99c6e7c2bd2ed6d98.tar.gz
Remove Bundler::Specification
-rw-r--r--lib/bundler/rubygems_ext.rb19
-rw-r--r--lib/bundler/shared_helpers.rb21
-rw-r--r--lib/bundler/source.rb3
3 files changed, 19 insertions, 24 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 6daa2782..e8936c9a 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -1,3 +1,5 @@
+require 'pathname'
+
unless defined? Gem
require 'rubygems'
require 'rubygems/specification'
@@ -7,7 +9,22 @@ module Gem
@loaded_stacks = Hash.new { |h,k| h[k] = [] }
class Specification
- attr_accessor :source, :location
+ attr_accessor :source, :location, :relative_loaded_from
+
+ alias_method :rg_full_gem_path, :full_gem_path
+ alias_method :rg_loaded_from, :loaded_from
+
+ def full_gem_path
+ source.respond_to?(:path) ?
+ Pathname.new(loaded_from).dirname.expand_path.to_s :
+ rg_full_gem_path
+ end
+
+ def loaded_from
+ relative_loaded_from ?
+ source.path.join(relative_loaded_from).to_s :
+ rg_loaded_from
+ end
def load_paths
require_paths.map do |require_path|
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 14727090..0353055d 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -13,27 +13,6 @@ module Gem
end
module Bundler
- class Specification < Gem::Specification
- attr_accessor :relative_loaded_from
-
- def self.from_gemspec(gemspec)
- spec = allocate
- gemspec.instance_variables.each do |ivar|
- spec.instance_variable_set(ivar, gemspec.instance_variable_get(ivar))
- end
- spec
- end
-
- def loaded_from
- return super unless relative_loaded_from
- source.path.join(relative_loaded_from).to_s
- end
-
- def full_gem_path
- Pathname.new(loaded_from).dirname.expand_path.to_s
- end
- end
-
module SharedHelpers
attr_accessor :gem_loaded
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index e2bb947a..575f9608 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -249,7 +249,6 @@ module Bundler
end
if spec
- spec = Specification.from_gemspec(spec)
spec.loaded_from = file.to_s
spec.source = self
index << spec
@@ -257,7 +256,7 @@ module Bundler
end
if index.empty? && @name && @version
- index << Specification.new do |s|
+ index << Gem::Specification.new do |s|
s.name = @name
s.source = self
s.version = Gem::Version.new(@version)