Permalink
Browse files

Rename Repository to Bundle and add some specs for the next step

  • Loading branch information...
1 parent b1bb45c commit 4c2f79a7c3a279b954c0d6be2e3251d453b9f7bd Carlhuda committed Dec 10, 2009
View
@@ -14,7 +14,7 @@
require "bundler/environment"
require "bundler/dsl"
require "bundler/cli"
-require "bundler/repository"
+require "bundler/bundle"
require "bundler/dependency"
require "bundler/remote_specification"
@@ -1,7 +1,7 @@
module Bundler
class InvalidRepository < StandardError ; end
- class Repository
+ class Bundle
attr_reader :path
def initialize(path, bindir)
@@ -171,7 +171,7 @@ def default_sources
end
def repository
- @repository ||= Repository.new(gem_path, bindir)
+ @repository ||= Bundle.new(gem_path, bindir)
end
def gem_dependencies
@@ -40,7 +40,7 @@
end
it "works with repositories that don't provide Marshal.4.8.Z" do
- FileUtils.cp_r gem_repo1, gem_repo2
+ build_repo2
Dir["#{gem_repo2}/Marshal.*"].each { |f| File.unlink(f) }
install_manifest <<-Gemfile
@@ -185,4 +185,69 @@
out.should include("rake - 0.8.7")
end
end
+
+ describe "YAML description" do
+ before :each do
+ pending
+ build_repo2
+ end
+
+ it "it does not pull remote updates if the Gemfile did not change" do
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo2}"
+ gem "rack", ">= 1.0"
+ Gemfile
+
+ update_repo2
+
+ Dir.chdir bundled_app
+ gem_command :bundle
+ out = run_in_context "Bundler.require_env ; puts RACK"
+ out.should == "1.0"
+ end
+
+ it "it does not pull remote updates if the Gemfile did not *significantly* change" do
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo2}"
+ gem "rack", ">= 1.0"
+ Gemfile
+
+ update_repo2
+
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo2}"
+ # Save this newline kthx
+ gem "rack"
+ Gemfile
+
+ Dir.chdir bundled_app
+ gem_command :bundle
+ out = run_in_context "Bundler.require_env ; puts RACK"
+ out.should == "1.0"
+ end
+
+ it "it does pull remote updates if the Gemfile changed" do
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo2}"
+ gem "rack", ">= 1.0"
+ Gemfile
+
+ update_repo2
+
+ install_manifest <<-Gemfile
+ clear_sources
+ source "file://#{gem_repo2}"
+ gem "rack"
+ Gemfile
+
+ Dir.chdir bundled_app
+ gem_command :bundle
+ out = run_in_context "Bundler.require_env ; puts RACK"
+ out.should == "1.2"
+ end
+ end
end
@@ -84,8 +84,25 @@ def build_repo1
end
end
- def build_repo(path)
+ def build_repo2
+ FileUtils.rm_rf gem_repo2
+ FileUtils.cp_r gem_repo1, gem_repo2
+ end
+
+ def update_repo2
+ update_repo gem_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+ end
+ end
+
+ def build_repo(path, &blk)
return if File.directory?(path)
+ update_repo(path, &blk)
+ end
+
+ def update_repo(path)
@_build_path = "#{path}/gems"
yield
@_build_path = nil
@@ -38,6 +38,10 @@ def gem_repo2(*path)
tmp_path("repos/2")
end
+ def gem_repo2(*path)
+ tmp_path("repos/3")
+ end
+
def system_gem_path(*path)
tmp_path('system_gems', *path)
end

0 comments on commit 4c2f79a

Please sign in to comment.