aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-11-02 03:52:15 +0530
committerPratik Naik <pratiknaik@gmail.com>2008-11-02 03:52:15 +0530
commit1147453fce0890ea229c3af5f43c909ebe53061e (patch)
tree221d816ef0c908044fd6029950ccad064866ab8f /railties/lib/rails
parenta3aa0c17ef8594a0084511f4852be7b5dc66e5e2 (diff)
parent5a02f0bccf55191c2cfbcc69bd8165df6d7a2012 (diff)
downloadrails-1147453fce0890ea229c3af5f43c909ebe53061e.tar.gz
rails-1147453fce0890ea229c3af5f43c909ebe53061e.tar.bz2
rails-1147453fce0890ea229c3af5f43c909ebe53061e.zip
Merge commit 'mainstream/master'
Conflicts: railties/doc/guides/html/layouts_and_rendering.html railties/doc/guides/source/active_record_basics.txt railties/doc/guides/source/layouts_and_rendering.txt
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/gem_dependency.rb37
1 files changed, 24 insertions, 13 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index 46d5fd3a47..cd280ac023 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -18,11 +18,14 @@ module Rails
def self.add_frozen_gem_path
@@paths_loaded ||= begin
- Gem.source_index = Rails::VendorGemSourceIndex.new(Gem.source_index)
+ source_index = Rails::VendorGemSourceIndex.new(Gem.source_index)
+ Gem.clear_paths
+ Gem.source_index = source_index
# loaded before us - we can't change them, so mark them
Gem.loaded_specs.each do |name, spec|
@@framework_gems[name] = spec
end
+ true
end
end
@@ -170,19 +173,27 @@ module Rails
exact_dep = Gem::Dependency.new(name, "= #{specification.version}")
matches = real_gems.search(exact_dep)
installed_spec = matches.first
- if installed_spec
- # we have a real copy
- # get a fresh spec - matches should only have one element
- # note that there is no reliable method to check that the loaded
- # spec is the same as the copy from real_gems - Gem.activate changes
- # some of the fields
- real_spec = Gem::Specification.load(matches.first.loaded_from)
- write_spec(directory, real_spec)
- puts "Reloaded specification for #{name} from installed gems."
+ if File.exist?(File.dirname(spec_filename(directory)))
+ if installed_spec
+ # we have a real copy
+ # get a fresh spec - matches should only have one element
+ # note that there is no reliable method to check that the loaded
+ # spec is the same as the copy from real_gems - Gem.activate changes
+ # some of the fields
+ real_spec = Gem::Specification.load(matches.first.loaded_from)
+ write_spec(directory, real_spec)
+ puts "Reloaded specification for #{name} from installed gems."
+ else
+ # the gem isn't installed locally - write out our current specs
+ write_spec(directory, specification)
+ puts "Gem #{name} not loaded locally - writing out current spec."
+ end
else
- # the gem isn't installed locally - write out our current specs
- write_spec(directory, specification)
- puts "Gem #{name} not loaded locally - writing out current spec."
+ if framework_gem?
+ puts "Gem directory for #{name} not found - check if it's loading before rails."
+ else
+ puts "Something bad is going on - gem directory not found for #{name}."
+ end
end
end