Permalink
Browse files

Test the CLI Happy Path

  • Loading branch information...
1 parent 5906ec2 commit 5928cfaf93a3386ff2b6bfdda5a189e4a4834282 Yehuda Katz + Carl Lerche committed Jul 20, 2009
Showing with 28 additions and 4 deletions.
  1. +2 −2 bin/gem_bundler
  2. +2 −2 lib/bundler/manifest.rb
  3. +24 −0 spec/bundler/cli_spec.rb
View
@@ -18,9 +18,9 @@ parser = OptionParser.new do |op|
end
parser.parse!
-options[:path] = ARGV.shift || File.join(Dir.pwd, "vendor", "gems")
+options[:path] = ARGV.shift || Bundler::CLI.default_path
-options[:manifest] ||= "Gemfile"
+options[:manifest] ||= Bundler::CLI.default_manifest
unless File.exist?(options[:manifest])
puts parser
@@ -68,8 +68,8 @@ def all_gems_installed?
gem_versions[name] = Gem::Version.new(version)
end
- ret = gem_dependencies.all? do |dep|
- # gem_versions[dep.name] &&
+ gem_dependencies.all? do |dep|
+ gem_versions[dep.name] &&
dep.version_requirements.satisfied_by?(gem_versions[dep.name])
end
end
@@ -39,4 +39,28 @@
@cli.default_path.should == tmp_file("vendor", "gems").to_s
end
+ it "works" do
+ File.open(tmp_file("Gemfile"), 'w') do |file|
+ file.puts <<-DSL
+ sources.clear
+ source "file://#{gem_repo1}"
+ gem "rake"
+ DSL
+ end
+
+ lib = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+ bin = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'gem_bundler'))
+
+ Dir.chdir(tmp_dir) do
+ `#{Gem.ruby} -I #{lib} #{bin}`
+ end
+
+ tmp_file("vendor", "gems").should have_cached_gems("rake-0.8.7")
+ tmp_file("vendor", "gems").should have_installed_gems("rake-0.8.7")
+
+ tmp_file('vendor', 'gems', 'environments', 'default.rb').should have_load_paths(tmp_file("vendor", "gems"),
+ "rake-0.8.7" => %w(bin lib)
+ )
+ end
+
end

0 comments on commit 5928cfa

Please sign in to comment.