rkh-bundler 1.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +42 -0
- data/CHANGELOG.md +1105 -0
- data/ISSUES.md +67 -0
- data/LICENSE +23 -0
- data/README.md +31 -0
- data/Rakefile +208 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +31 -0
- data/bundler.gemspec +31 -0
- data/lib/bundler.rb +353 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +693 -0
- data/lib/bundler/definition.rb +568 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +134 -0
- data/lib/bundler/deployment.rb +58 -0
- data/lib/bundler/dsl.rb +256 -0
- data/lib/bundler/endpoint_specification.rb +78 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +225 -0
- data/lib/bundler/gem_helper.rb +162 -0
- data/lib/bundler/gem_helpers.rb +23 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +148 -0
- data/lib/bundler/index.rb +187 -0
- data/lib/bundler/installer.rb +190 -0
- data/lib/bundler/lazy_specification.rb +79 -0
- data/lib/bundler/lockfile_parser.rb +127 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/psyched_yaml.rb +15 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +486 -0
- data/lib/bundler/ruby_version.rb +94 -0
- data/lib/bundler/rubygems_ext.rb +153 -0
- data/lib/bundler/rubygems_integration.rb +394 -0
- data/lib/bundler/runtime.rb +233 -0
- data/lib/bundler/settings.rb +128 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +71 -0
- data/lib/bundler/source.rb +869 -0
- data/lib/bundler/spec_set.rb +137 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +29 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +17 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
- data/lib/bundler/ui.rb +88 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +468 -0
- data/lib/bundler/vendor/thor.rb +358 -0
- data/lib/bundler/vendor/thor/actions.rb +314 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
- data/lib/bundler/vendor/thor/base.rb +576 -0
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
- data/lib/bundler/vendor/thor/error.rb +30 -0
- data/lib/bundler/vendor/thor/group.rb +273 -0
- data/lib/bundler/vendor/thor/invocation.rb +168 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
- data/lib/bundler/vendor/thor/parser/option.rb +120 -0
- data/lib/bundler/vendor/thor/parser/options.rb +172 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
- data/lib/bundler/vendor/thor/runner.rb +309 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
- data/lib/bundler/vendor/thor/shell/color.rb +108 -0
- data/lib/bundler/vendor/thor/shell/html.rb +121 -0
- data/lib/bundler/vendor/thor/task.rb +113 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_thor.rb +7 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +130 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +335 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +83 -0
- data/man/gemfile.5.ronn +324 -0
- data/man/index.txt +6 -0
- data/spec/bundler/dsl_spec.rb +48 -0
- data/spec/bundler/gem_helper_spec.rb +174 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +239 -0
- data/spec/cache/git_spec.rb +124 -0
- data/spec/cache/path_spec.rb +103 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +211 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +402 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +268 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/post_install_spec.rb +47 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +814 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +74 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +170 -0
- data/spec/install/git_spec.rb +796 -0
- data/spec/install/invalid_spec.rb +35 -0
- data/spec/install/path_spec.rb +405 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +809 -0
- data/spec/other/check_spec.rb +265 -0
- data/spec/other/clean_spec.rb +492 -0
- data/spec/other/config_spec.rb +138 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +229 -0
- data/spec/other/ext_spec.rb +37 -0
- data/spec/other/help_spec.rb +39 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +87 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/outdated_spec.rb +93 -0
- data/spec/other/platform_spec.rb +881 -0
- data/spec/other/show_spec.rb +88 -0
- data/spec/quality_spec.rb +62 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -0
- data/spec/runtime/executable_spec.rb +120 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +261 -0
- data/spec/runtime/setup_spec.rb +755 -0
- data/spec/runtime/with_clean_env_spec.rb +80 -0
- data/spec/spec_helper.rb +98 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +54 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_extra.rb +27 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +18 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/builders.rb +604 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +317 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +86 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +37 -0
- data/spec/support/rubygems_hax/platform.rb +22 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +134 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +338 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle help" do
|
4
|
+
# Rubygems 1.4+ no longer load gem plugins so this test is no longer needed
|
5
|
+
rubygems_under_14 = Gem::Requirement.new("< 1.4").satisfied_by?(Gem::Version.new(Gem::VERSION))
|
6
|
+
it "complains if older versions of bundler are installed", :if => rubygems_under_14 do
|
7
|
+
system_gems "bundler-0.8.1"
|
8
|
+
|
9
|
+
bundle "help", :expect_err => true
|
10
|
+
err.should include("Please remove Bundler 0.8 versions.")
|
11
|
+
err.should include("This can be done by running `gem cleanup bundler`.")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "uses groff when available" do
|
15
|
+
fake_groff!
|
16
|
+
|
17
|
+
bundle "help gemfile"
|
18
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|
|
19
|
+
end
|
20
|
+
|
21
|
+
it "prefixes bundle commands with bundle- when finding the groff files" do
|
22
|
+
fake_groff!
|
23
|
+
|
24
|
+
bundle "help install"
|
25
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|
|
26
|
+
end
|
27
|
+
|
28
|
+
it "simply outputs the txt file when there is no groff on the path" do
|
29
|
+
kill_path!
|
30
|
+
|
31
|
+
bundle "help install", :expect_err => true
|
32
|
+
out.should =~ /BUNDLE-INSTALL/
|
33
|
+
end
|
34
|
+
|
35
|
+
it "still outputs the old help for commands that do not have man pages yet" do
|
36
|
+
bundle "help check"
|
37
|
+
out.should include("Check searches the local machine")
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle init" do
|
4
|
+
it "generates a Gemfile" do
|
5
|
+
bundle :init
|
6
|
+
bundled_app("Gemfile").should exist
|
7
|
+
end
|
8
|
+
|
9
|
+
it "does not change existing Gemfiles" do
|
10
|
+
gemfile <<-G
|
11
|
+
gem "rails"
|
12
|
+
G
|
13
|
+
|
14
|
+
lambda {
|
15
|
+
bundle :init
|
16
|
+
}.should_not change { File.read(bundled_app("Gemfile")) }
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should generate from an existing gemspec" do
|
20
|
+
spec_file = tmp.join('test.gemspec')
|
21
|
+
File.open(spec_file, 'w') do |file|
|
22
|
+
file << <<-S
|
23
|
+
Gem::Specification.new do |s|
|
24
|
+
s.name = 'test'
|
25
|
+
s.add_dependency 'rack', '= 1.0.1'
|
26
|
+
s.add_development_dependency 'rspec', '1.2'
|
27
|
+
end
|
28
|
+
S
|
29
|
+
end
|
30
|
+
|
31
|
+
bundle :init, :gemspec => spec_file
|
32
|
+
|
33
|
+
gemfile = bundled_app("Gemfile").read
|
34
|
+
gemfile.should =~ /source :gemcutter/
|
35
|
+
gemfile.scan(/gem "rack", "= 1.0.1"/).size.should eq(1)
|
36
|
+
gemfile.scan(/gem "rspec", "= 1.2"/).size.should eq(1)
|
37
|
+
gemfile.scan(/group :development/).size.should eq(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle gem" do
|
4
|
+
before :each do
|
5
|
+
@git_name = `git config --global user.name`.chomp
|
6
|
+
`git config --global user.name "Bundler User"`
|
7
|
+
@git_email = `git config --global user.email`.chomp
|
8
|
+
`git config --global user.email user@example.com`
|
9
|
+
bundle 'gem test-gem'
|
10
|
+
# reset gemspec cache for each test because of commit 3d4163a
|
11
|
+
Bundler.clear_gemspec_cache
|
12
|
+
end
|
13
|
+
|
14
|
+
after :each do
|
15
|
+
`git config --global user.name "#{@git_name}"`
|
16
|
+
`git config --global user.email #{@git_email}`
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:generated_gem) { Bundler::GemHelper.new(bundled_app("test-gem").to_s) }
|
20
|
+
|
21
|
+
it "generates a gem skeleton" do
|
22
|
+
bundled_app("test-gem/test-gem.gemspec").should exist
|
23
|
+
bundled_app("test-gem/Gemfile").should exist
|
24
|
+
bundled_app("test-gem/Rakefile").should exist
|
25
|
+
bundled_app("test-gem/lib/test-gem.rb").should exist
|
26
|
+
bundled_app("test-gem/lib/test-gem/version.rb").should exist
|
27
|
+
end
|
28
|
+
|
29
|
+
it "starts with version 0.0.1" do
|
30
|
+
bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /VERSION = "0.0.1"/
|
31
|
+
end
|
32
|
+
|
33
|
+
it "nests constants so they work" do
|
34
|
+
bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /module Test\n module Gem/
|
35
|
+
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /module Test\n module Gem/
|
36
|
+
end
|
37
|
+
|
38
|
+
context "git config user.{name,email} present" do
|
39
|
+
it "sets gemspec author to git user.name if available" do
|
40
|
+
generated_gem.gemspec.authors.first.should == "Bundler User"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sets gemspec email to git user.email if available" do
|
44
|
+
generated_gem.gemspec.email.first.should == "user@example.com"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "git config user.{name,email} is not set" do
|
49
|
+
before :each do
|
50
|
+
`git config --global --unset user.name`
|
51
|
+
`git config --global --unset user.email`
|
52
|
+
reset!
|
53
|
+
in_app_root
|
54
|
+
bundle 'gem test-gem'
|
55
|
+
end
|
56
|
+
|
57
|
+
it "sets gemspec author to default message if git user.name is not set or empty" do
|
58
|
+
generated_gem.gemspec.authors.first.should == "TODO: Write your name"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "sets gemspec email to default message if git user.email is not set or empty" do
|
62
|
+
generated_gem.gemspec.email.first.should == "TODO: Write your email address"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "requires the version file" do
|
67
|
+
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /require "test-gem\/version"/
|
68
|
+
end
|
69
|
+
|
70
|
+
it "runs rake without problems" do
|
71
|
+
system_gems ["rake-0.8.7"]
|
72
|
+
|
73
|
+
rakefile = <<-RAKEFILE
|
74
|
+
task :default do
|
75
|
+
puts 'SUCCESS'
|
76
|
+
end
|
77
|
+
RAKEFILE
|
78
|
+
File.open(bundled_app("test-gem/Rakefile"), 'w') do |file|
|
79
|
+
file.puts rakefile
|
80
|
+
end
|
81
|
+
|
82
|
+
Dir.chdir(bundled_app("test-gem")) do
|
83
|
+
sys_exec("rake")
|
84
|
+
out.should include("SUCCESS")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle open" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
it "opens the gem with BUNDLER_EDITOR as highest priority" do
|
12
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor"}
|
13
|
+
out.should == "bundler_editor #{default_bundle_path('gems', 'rails-2.3.2')}"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "opens the gem with VISUAL as 2nd highest priority" do
|
17
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => ""}
|
18
|
+
out.should == "visual #{default_bundle_path('gems', 'rails-2.3.2')}"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "opens the gem with EDITOR as 3rd highest priority" do
|
22
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
23
|
+
out.should == "editor #{default_bundle_path('gems', 'rails-2.3.2')}"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "complains if no EDITOR is set" do
|
27
|
+
bundle "open rails", :env => {"EDITOR" => "", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
28
|
+
out.should == "To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "complains if gem not in bundle" do
|
32
|
+
bundle "open missing", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
33
|
+
out.should match(/could not find gem 'missing'/i)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle outdated" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
build_repo2 do
|
7
|
+
build_git "foo", :path => lib_path("foo")
|
8
|
+
end
|
9
|
+
|
10
|
+
install_gemfile <<-G
|
11
|
+
source "file://#{gem_repo2}"
|
12
|
+
gem "activesupport", "2.3.5"
|
13
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
14
|
+
G
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "with no arguments" do
|
18
|
+
it "returns list of outdated gems" do
|
19
|
+
update_repo2 do
|
20
|
+
build_gem "activesupport", "3.0"
|
21
|
+
update_git "foo", :path => lib_path("foo")
|
22
|
+
end
|
23
|
+
|
24
|
+
bundle "outdated"
|
25
|
+
out.should include("activesupport (3.0 > 2.3.5)")
|
26
|
+
out.should include("foo (1.0")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "with --local option" do
|
31
|
+
it "doesn't hit repo2" do
|
32
|
+
FileUtils.rm_rf(gem_repo2)
|
33
|
+
|
34
|
+
bundle "outdated --local"
|
35
|
+
out.should_not match(/Fetching/)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "with specified gems" do
|
40
|
+
it "returns list of outdated gems" do
|
41
|
+
update_repo2 do
|
42
|
+
build_gem "activesupport", "3.0"
|
43
|
+
update_git "foo", :path => lib_path("foo")
|
44
|
+
end
|
45
|
+
|
46
|
+
bundle "outdated foo"
|
47
|
+
out.should_not include("activesupport (3.0 > 2.3.5)")
|
48
|
+
out.should include("foo (1.0")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "pre-release gems" do
|
53
|
+
context "without the --pre option" do
|
54
|
+
it "ignores pre-release versions" do
|
55
|
+
update_repo2 do
|
56
|
+
build_gem "activesupport", "3.0.0.beta"
|
57
|
+
end
|
58
|
+
|
59
|
+
bundle "outdated"
|
60
|
+
out.should_not include("activesupport (3.0.0.beta > 2.3.5)")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "with the --pre option" do
|
65
|
+
it "includes pre-release versions" do
|
66
|
+
update_repo2 do
|
67
|
+
build_gem "activesupport", "3.0.0.beta"
|
68
|
+
end
|
69
|
+
|
70
|
+
bundle "outdated --pre"
|
71
|
+
out.should include("activesupport (3.0.0.beta > 2.3.5)")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "when current gem is a pre-release" do
|
76
|
+
it "includes the gem" do
|
77
|
+
update_repo2 do
|
78
|
+
build_gem "activesupport", "3.0.0.beta.1"
|
79
|
+
build_gem "activesupport", "3.0.0.beta.2"
|
80
|
+
end
|
81
|
+
|
82
|
+
install_gemfile <<-G
|
83
|
+
source "file://#{gem_repo2}"
|
84
|
+
gem "activesupport", "3.0.0.beta.1"
|
85
|
+
G
|
86
|
+
|
87
|
+
bundle "outdated"
|
88
|
+
out.should include("activesupport (3.0.0.beta.2 > 3.0.0.beta.1)")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,881 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle platform" do
|
4
|
+
context "without flags" do
|
5
|
+
it "returns all the output" do
|
6
|
+
gemfile <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
|
9
|
+
#{ruby_version_correct}
|
10
|
+
|
11
|
+
gem "foo"
|
12
|
+
G
|
13
|
+
|
14
|
+
bundle "platform"
|
15
|
+
out.should == <<-G.chomp
|
16
|
+
Your platform is: #{RUBY_PLATFORM}
|
17
|
+
|
18
|
+
Your app has gems that work on these platforms:
|
19
|
+
* ruby
|
20
|
+
|
21
|
+
Your Gemfile specifies a Ruby version requirement:
|
22
|
+
* ruby #{RUBY_VERSION}
|
23
|
+
|
24
|
+
Your current platform satisfies the Ruby version requirement.
|
25
|
+
G
|
26
|
+
end
|
27
|
+
|
28
|
+
it "doesn't print ruby version requirement if it isn't specified" do
|
29
|
+
gemfile <<-G
|
30
|
+
source "file://#{gem_repo1}"
|
31
|
+
|
32
|
+
gem "foo"
|
33
|
+
G
|
34
|
+
|
35
|
+
bundle "platform"
|
36
|
+
out.should == <<-G.chomp
|
37
|
+
Your platform is: #{RUBY_PLATFORM}
|
38
|
+
|
39
|
+
Your app has gems that work on these platforms:
|
40
|
+
* ruby
|
41
|
+
|
42
|
+
Your Gemfile does not specify a Ruby version requirement.
|
43
|
+
G
|
44
|
+
end
|
45
|
+
|
46
|
+
it "doesn't match the ruby version requirement" do
|
47
|
+
gemfile <<-G
|
48
|
+
source "file://#{gem_repo1}"
|
49
|
+
|
50
|
+
#{ruby_version_incorrect}
|
51
|
+
|
52
|
+
gem "foo"
|
53
|
+
G
|
54
|
+
|
55
|
+
bundle "platform"
|
56
|
+
out.should == <<-G.chomp
|
57
|
+
Your platform is: #{RUBY_PLATFORM}
|
58
|
+
|
59
|
+
Your app has gems that work on these platforms:
|
60
|
+
* ruby
|
61
|
+
|
62
|
+
Your Gemfile specifies a Ruby version requirement:
|
63
|
+
* ruby #{not_local_ruby_version}
|
64
|
+
|
65
|
+
Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}
|
66
|
+
G
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "--ruby" do
|
71
|
+
it "returns ruby version when explicit" do
|
72
|
+
gemfile <<-G
|
73
|
+
source "file://#{gem_repo1}"
|
74
|
+
ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
|
75
|
+
|
76
|
+
gem "foo"
|
77
|
+
G
|
78
|
+
|
79
|
+
bundle "platform --ruby"
|
80
|
+
|
81
|
+
out.should eq("ruby 1.9.3")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "engine defaults to MRI" do
|
85
|
+
gemfile <<-G
|
86
|
+
source "file://#{gem_repo1}"
|
87
|
+
ruby "1.9.3"
|
88
|
+
|
89
|
+
gem "foo"
|
90
|
+
G
|
91
|
+
|
92
|
+
bundle "platform --ruby"
|
93
|
+
|
94
|
+
out.should eq("ruby 1.9.3")
|
95
|
+
end
|
96
|
+
|
97
|
+
it "handles jruby" do
|
98
|
+
gemfile <<-G
|
99
|
+
source "file://#{gem_repo1}"
|
100
|
+
ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5'
|
101
|
+
|
102
|
+
gem "foo"
|
103
|
+
G
|
104
|
+
|
105
|
+
bundle "platform --ruby"
|
106
|
+
|
107
|
+
out.should eq("ruby 1.8.7 (jruby 1.6.5)")
|
108
|
+
end
|
109
|
+
|
110
|
+
it "handles rbx" do
|
111
|
+
gemfile <<-G
|
112
|
+
source "file://#{gem_repo1}"
|
113
|
+
ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
|
114
|
+
|
115
|
+
gem "foo"
|
116
|
+
G
|
117
|
+
|
118
|
+
bundle "platform --ruby"
|
119
|
+
|
120
|
+
out.should eq("ruby 1.8.7 (rbx 1.2.4)")
|
121
|
+
end
|
122
|
+
|
123
|
+
it "raises an error if engine is used but engine version is not" do
|
124
|
+
gemfile <<-G
|
125
|
+
source "file://#{gem_repo1}"
|
126
|
+
ruby "1.8.7", :engine => 'rbx'
|
127
|
+
|
128
|
+
gem "foo"
|
129
|
+
G
|
130
|
+
|
131
|
+
bundle "platform", :exitstatus => true
|
132
|
+
|
133
|
+
exitstatus.should_not == 0
|
134
|
+
end
|
135
|
+
|
136
|
+
it "raises an error if engine_version is used but engine is not" do
|
137
|
+
gemfile <<-G
|
138
|
+
source "file://#{gem_repo1}"
|
139
|
+
ruby "1.8.7", :engine_version => '1.2.4'
|
140
|
+
|
141
|
+
gem "foo"
|
142
|
+
G
|
143
|
+
|
144
|
+
bundle "platform", :exitstatus => true
|
145
|
+
|
146
|
+
exitstatus.should_not == 0
|
147
|
+
end
|
148
|
+
|
149
|
+
it "raises an error if engine version doesn't match ruby version for mri" do
|
150
|
+
gemfile <<-G
|
151
|
+
source "file://#{gem_repo1}"
|
152
|
+
ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4'
|
153
|
+
|
154
|
+
gem "foo"
|
155
|
+
G
|
156
|
+
|
157
|
+
bundle "platform", :exitstatus => true
|
158
|
+
|
159
|
+
exitstatus.should_not == 0
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" }
|
164
|
+
let(:ruby_version_incorrect) { "ruby \"#{not_local_ruby_version}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_ruby_version}\"" }
|
165
|
+
let(:engine_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{not_local_tag}\", :engine_version => \"#{RUBY_VERSION}\"" }
|
166
|
+
let(:engine_version_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" }
|
167
|
+
|
168
|
+
def should_be_ruby_version_incorrect(opts = {:exitstatus => true})
|
169
|
+
exitstatus.should eq(18) if opts[:exitstatus]
|
170
|
+
out.should be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}")
|
171
|
+
end
|
172
|
+
|
173
|
+
def should_be_engine_incorrect(opts = {:exitstatus => true})
|
174
|
+
exitstatus.should eq(18) if opts[:exitstatus]
|
175
|
+
out.should be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}")
|
176
|
+
end
|
177
|
+
|
178
|
+
def should_be_engine_version_incorrect(opts = {:exitstatus => true})
|
179
|
+
exitstatus.should eq(18) if opts[:exitstatus]
|
180
|
+
out.should be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
|
181
|
+
end
|
182
|
+
|
183
|
+
context "bundle install" do
|
184
|
+
it "installs fine when the ruby version matches" do
|
185
|
+
install_gemfile <<-G
|
186
|
+
source "file://#{gem_repo1}"
|
187
|
+
gem "rack"
|
188
|
+
|
189
|
+
#{ruby_version_correct}
|
190
|
+
G
|
191
|
+
|
192
|
+
bundled_app('Gemfile.lock').should exist
|
193
|
+
end
|
194
|
+
|
195
|
+
it "doesn't install when the ruby version doesn't match" do
|
196
|
+
install_gemfile <<-G, :exitstatus => true
|
197
|
+
source "file://#{gem_repo1}"
|
198
|
+
gem "rack"
|
199
|
+
|
200
|
+
#{ruby_version_incorrect}
|
201
|
+
G
|
202
|
+
|
203
|
+
bundled_app('Gemfile.lock').should_not exist
|
204
|
+
should_be_ruby_version_incorrect
|
205
|
+
end
|
206
|
+
|
207
|
+
it "doesn't install when engine doesn't match" do
|
208
|
+
install_gemfile <<-G, :exitstatus => true
|
209
|
+
source "file://#{gem_repo1}"
|
210
|
+
gem "rack"
|
211
|
+
|
212
|
+
#{engine_incorrect}
|
213
|
+
G
|
214
|
+
|
215
|
+
bundled_app('Gemfile.lock').should_not exist
|
216
|
+
should_be_engine_incorrect
|
217
|
+
end
|
218
|
+
|
219
|
+
it "doesn't install when engine version doesn't match" do
|
220
|
+
simulate_ruby_engine "jruby" do
|
221
|
+
install_gemfile <<-G, :exitstatus => true
|
222
|
+
source "file://#{gem_repo1}"
|
223
|
+
gem "rack"
|
224
|
+
|
225
|
+
#{engine_version_incorrect}
|
226
|
+
G
|
227
|
+
|
228
|
+
bundled_app('Gemfile.lock').should_not exist
|
229
|
+
should_be_engine_version_incorrect
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
context "bundle check" do
|
235
|
+
it "checks fine when the ruby version matches" do
|
236
|
+
install_gemfile <<-G
|
237
|
+
source "file://#{gem_repo1}"
|
238
|
+
gem "rack"
|
239
|
+
G
|
240
|
+
|
241
|
+
gemfile <<-G
|
242
|
+
source "file://#{gem_repo1}"
|
243
|
+
gem "rack"
|
244
|
+
|
245
|
+
#{ruby_version_correct}
|
246
|
+
G
|
247
|
+
|
248
|
+
bundle :check, :exitstatus => true
|
249
|
+
exitstatus.should eq(0)
|
250
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
251
|
+
end
|
252
|
+
|
253
|
+
it "fails when ruby version doesn't match" do
|
254
|
+
install_gemfile <<-G
|
255
|
+
source "file://#{gem_repo1}"
|
256
|
+
gem "rack"
|
257
|
+
G
|
258
|
+
|
259
|
+
gemfile <<-G
|
260
|
+
source "file://#{gem_repo1}"
|
261
|
+
gem "rack"
|
262
|
+
|
263
|
+
#{ruby_version_incorrect}
|
264
|
+
G
|
265
|
+
|
266
|
+
bundle :check, :exitstatus => true
|
267
|
+
should_be_ruby_version_incorrect
|
268
|
+
end
|
269
|
+
|
270
|
+
it "fails when engine doesn't match" do
|
271
|
+
install_gemfile <<-G
|
272
|
+
source "file://#{gem_repo1}"
|
273
|
+
gem "rack"
|
274
|
+
G
|
275
|
+
|
276
|
+
gemfile <<-G
|
277
|
+
source "file://#{gem_repo1}"
|
278
|
+
gem "rack"
|
279
|
+
|
280
|
+
#{engine_incorrect}
|
281
|
+
G
|
282
|
+
|
283
|
+
bundle :check, :exitstatus => true
|
284
|
+
should_be_engine_incorrect
|
285
|
+
end
|
286
|
+
|
287
|
+
it "fails when engine version doesn't match" do
|
288
|
+
simulate_ruby_engine "ruby" do
|
289
|
+
install_gemfile <<-G
|
290
|
+
source "file://#{gem_repo1}"
|
291
|
+
gem "rack"
|
292
|
+
G
|
293
|
+
|
294
|
+
gemfile <<-G
|
295
|
+
source "file://#{gem_repo1}"
|
296
|
+
gem "rack"
|
297
|
+
|
298
|
+
#{engine_version_incorrect}
|
299
|
+
G
|
300
|
+
|
301
|
+
bundle :check, :exitstatus => true
|
302
|
+
should_be_engine_version_incorrect
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
context "bundle update" do
|
308
|
+
before do
|
309
|
+
build_repo2
|
310
|
+
|
311
|
+
install_gemfile <<-G
|
312
|
+
source "file://#{gem_repo2}"
|
313
|
+
gem "activesupport"
|
314
|
+
gem "rack-obama"
|
315
|
+
G
|
316
|
+
end
|
317
|
+
|
318
|
+
it "updates successfully when the ruby version matches" do
|
319
|
+
gemfile <<-G
|
320
|
+
source "file://#{gem_repo2}"
|
321
|
+
gem "activesupport"
|
322
|
+
gem "rack-obama"
|
323
|
+
|
324
|
+
#{ruby_version_correct}
|
325
|
+
G
|
326
|
+
update_repo2 do
|
327
|
+
build_gem "activesupport", "3.0"
|
328
|
+
end
|
329
|
+
|
330
|
+
bundle "update"
|
331
|
+
should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
|
332
|
+
end
|
333
|
+
|
334
|
+
it "fails when ruby version doesn't match" do
|
335
|
+
gemfile <<-G
|
336
|
+
source "file://#{gem_repo2}"
|
337
|
+
gem "activesupport"
|
338
|
+
gem "rack-obama"
|
339
|
+
|
340
|
+
#{ruby_version_incorrect}
|
341
|
+
G
|
342
|
+
update_repo2 do
|
343
|
+
build_gem "activesupport", "3.0"
|
344
|
+
end
|
345
|
+
|
346
|
+
bundle :update, :exitstatus => true
|
347
|
+
should_be_ruby_version_incorrect
|
348
|
+
end
|
349
|
+
|
350
|
+
it "fails when ruby engine doesn't match" do
|
351
|
+
gemfile <<-G
|
352
|
+
source "file://#{gem_repo2}"
|
353
|
+
gem "activesupport"
|
354
|
+
gem "rack-obama"
|
355
|
+
|
356
|
+
#{engine_incorrect}
|
357
|
+
G
|
358
|
+
update_repo2 do
|
359
|
+
build_gem "activesupport", "3.0"
|
360
|
+
end
|
361
|
+
|
362
|
+
bundle :update, :exitstatus => true
|
363
|
+
should_be_engine_incorrect
|
364
|
+
end
|
365
|
+
|
366
|
+
it "fails when ruby engine version doesn't match" do
|
367
|
+
simulate_ruby_engine "jruby" do
|
368
|
+
gemfile <<-G
|
369
|
+
source "file://#{gem_repo2}"
|
370
|
+
gem "activesupport"
|
371
|
+
gem "rack-obama"
|
372
|
+
|
373
|
+
#{engine_version_incorrect}
|
374
|
+
G
|
375
|
+
update_repo2 do
|
376
|
+
build_gem "activesupport", "3.0"
|
377
|
+
end
|
378
|
+
|
379
|
+
bundle :update, :exitstatus => true
|
380
|
+
should_be_engine_version_incorrect
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
context "bundle show" do
|
386
|
+
before do
|
387
|
+
install_gemfile <<-G
|
388
|
+
source "file://#{gem_repo1}"
|
389
|
+
gem "rails"
|
390
|
+
G
|
391
|
+
end
|
392
|
+
|
393
|
+
it "prints path if ruby version is correct" do
|
394
|
+
gemfile <<-G
|
395
|
+
source "file://#{gem_repo1}"
|
396
|
+
gem "rails"
|
397
|
+
|
398
|
+
#{ruby_version_correct}
|
399
|
+
G
|
400
|
+
|
401
|
+
bundle "show rails"
|
402
|
+
out.should == default_bundle_path('gems', 'rails-2.3.2').to_s
|
403
|
+
end
|
404
|
+
|
405
|
+
it "fails if ruby version doesn't match" do
|
406
|
+
gemfile <<-G
|
407
|
+
source "file://#{gem_repo1}"
|
408
|
+
gem "rails"
|
409
|
+
|
410
|
+
#{ruby_version_incorrect}
|
411
|
+
G
|
412
|
+
|
413
|
+
bundle "show rails", :exitstatus => true
|
414
|
+
should_be_ruby_version_incorrect
|
415
|
+
end
|
416
|
+
|
417
|
+
it "fails if engine doesn't match" do
|
418
|
+
gemfile <<-G
|
419
|
+
source "file://#{gem_repo1}"
|
420
|
+
gem "rails"
|
421
|
+
|
422
|
+
#{engine_incorrect}
|
423
|
+
G
|
424
|
+
|
425
|
+
bundle "show rails", :exitstatus => true
|
426
|
+
should_be_engine_incorrect
|
427
|
+
end
|
428
|
+
|
429
|
+
it "fails if engine version doesn't match" do
|
430
|
+
simulate_ruby_engine "jruby" do
|
431
|
+
gemfile <<-G
|
432
|
+
source "file://#{gem_repo1}"
|
433
|
+
gem "rails"
|
434
|
+
|
435
|
+
#{engine_version_incorrect}
|
436
|
+
G
|
437
|
+
|
438
|
+
bundle "show rails", :exitstatus => true
|
439
|
+
should_be_engine_version_incorrect
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
context "bundle cache" do
|
445
|
+
before do
|
446
|
+
gemfile <<-G
|
447
|
+
gem 'rack'
|
448
|
+
G
|
449
|
+
|
450
|
+
system_gems "rack-1.0.0"
|
451
|
+
end
|
452
|
+
|
453
|
+
it "copies the .gem file to vendor/cache when ruby version matches" do
|
454
|
+
gemfile <<-G
|
455
|
+
gem 'rack'
|
456
|
+
|
457
|
+
#{ruby_version_correct}
|
458
|
+
G
|
459
|
+
|
460
|
+
bundle :cache
|
461
|
+
bundled_app("vendor/cache/rack-1.0.0.gem").should exist
|
462
|
+
end
|
463
|
+
|
464
|
+
it "fails if the ruby version doesn't match" do
|
465
|
+
gemfile <<-G
|
466
|
+
gem 'rack'
|
467
|
+
|
468
|
+
#{ruby_version_incorrect}
|
469
|
+
G
|
470
|
+
|
471
|
+
bundle :cache, :exitstatus => true
|
472
|
+
should_be_ruby_version_incorrect
|
473
|
+
end
|
474
|
+
|
475
|
+
it "fails if the engine doesn't match" do
|
476
|
+
gemfile <<-G
|
477
|
+
gem 'rack'
|
478
|
+
|
479
|
+
#{engine_incorrect}
|
480
|
+
G
|
481
|
+
|
482
|
+
bundle :cache, :exitstatus => true
|
483
|
+
should_be_engine_incorrect
|
484
|
+
end
|
485
|
+
|
486
|
+
it "fails if the engine version doesn't match" do
|
487
|
+
simulate_ruby_engine "jruby" do
|
488
|
+
gemfile <<-G
|
489
|
+
gem 'rack'
|
490
|
+
|
491
|
+
#{engine_version_incorrect}
|
492
|
+
G
|
493
|
+
|
494
|
+
bundle :cache, :exitstatus => true
|
495
|
+
should_be_engine_version_incorrect
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
context "bundle pack" do
|
501
|
+
before do
|
502
|
+
gemfile <<-G
|
503
|
+
gem 'rack'
|
504
|
+
G
|
505
|
+
|
506
|
+
system_gems "rack-1.0.0"
|
507
|
+
end
|
508
|
+
|
509
|
+
it "copies the .gem file to vendor/cache when ruby version matches" do
|
510
|
+
gemfile <<-G
|
511
|
+
gem 'rack'
|
512
|
+
|
513
|
+
#{ruby_version_correct}
|
514
|
+
G
|
515
|
+
|
516
|
+
bundle :pack
|
517
|
+
bundled_app("vendor/cache/rack-1.0.0.gem").should exist
|
518
|
+
end
|
519
|
+
|
520
|
+
it "fails if the ruby version doesn't match" do
|
521
|
+
gemfile <<-G
|
522
|
+
gem 'rack'
|
523
|
+
|
524
|
+
#{ruby_version_incorrect}
|
525
|
+
G
|
526
|
+
|
527
|
+
bundle :pack, :exitstatus => true
|
528
|
+
should_be_ruby_version_incorrect
|
529
|
+
end
|
530
|
+
|
531
|
+
it "fails if the engine doesn't match" do
|
532
|
+
gemfile <<-G
|
533
|
+
gem 'rack'
|
534
|
+
|
535
|
+
#{engine_incorrect}
|
536
|
+
G
|
537
|
+
|
538
|
+
bundle :pack, :exitstatus => true
|
539
|
+
should_be_engine_incorrect
|
540
|
+
end
|
541
|
+
|
542
|
+
it "fails if the engine version doesn't match" do
|
543
|
+
simulate_ruby_engine "jruby" do
|
544
|
+
gemfile <<-G
|
545
|
+
gem 'rack'
|
546
|
+
|
547
|
+
#{engine_version_incorrect}
|
548
|
+
G
|
549
|
+
|
550
|
+
bundle :pack, :exitstatus => true
|
551
|
+
should_be_engine_version_incorrect
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
context "bundle exec" do
|
557
|
+
before do
|
558
|
+
system_gems "rack-1.0.0", "rack-0.9.1"
|
559
|
+
end
|
560
|
+
|
561
|
+
it "activates the correct gem when ruby version matches" do
|
562
|
+
gemfile <<-G
|
563
|
+
gem "rack", "0.9.1"
|
564
|
+
|
565
|
+
#{ruby_version_correct}
|
566
|
+
G
|
567
|
+
|
568
|
+
bundle "exec rackup"
|
569
|
+
out.should == "0.9.1"
|
570
|
+
end
|
571
|
+
|
572
|
+
it "fails when the ruby version doesn't match" do
|
573
|
+
gemfile <<-G
|
574
|
+
gem "rack", "0.9.1"
|
575
|
+
|
576
|
+
#{ruby_version_incorrect}
|
577
|
+
G
|
578
|
+
|
579
|
+
bundle "exec rackup", :exitstatus => true
|
580
|
+
should_be_ruby_version_incorrect
|
581
|
+
end
|
582
|
+
|
583
|
+
it "fails when the engine doesn't match" do
|
584
|
+
gemfile <<-G
|
585
|
+
gem "rack", "0.9.1"
|
586
|
+
|
587
|
+
#{engine_incorrect}
|
588
|
+
G
|
589
|
+
|
590
|
+
bundle "exec rackup", :exitstatus => true
|
591
|
+
should_be_engine_incorrect
|
592
|
+
end
|
593
|
+
|
594
|
+
it "fails when the engine version doesn't match" do
|
595
|
+
simulate_ruby_engine "jruby" do
|
596
|
+
gemfile <<-G
|
597
|
+
gem "rack", "0.9.1"
|
598
|
+
|
599
|
+
#{engine_version_incorrect}
|
600
|
+
G
|
601
|
+
|
602
|
+
bundle "exec rackup", :exitstatus => true
|
603
|
+
should_be_engine_version_incorrect
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
context "bundle console" do
|
609
|
+
before do
|
610
|
+
install_gemfile <<-G
|
611
|
+
source "file://#{gem_repo1}"
|
612
|
+
gem "rack"
|
613
|
+
gem "activesupport", :group => :test
|
614
|
+
gem "rack_middleware", :group => :development
|
615
|
+
G
|
616
|
+
end
|
617
|
+
|
618
|
+
it "starts IRB with the default group loaded when ruby version matches" do
|
619
|
+
gemfile <<-G
|
620
|
+
source "file://#{gem_repo1}"
|
621
|
+
gem "rack"
|
622
|
+
gem "activesupport", :group => :test
|
623
|
+
gem "rack_middleware", :group => :development
|
624
|
+
|
625
|
+
#{ruby_version_correct}
|
626
|
+
G
|
627
|
+
|
628
|
+
bundle "console" do |input|
|
629
|
+
input.puts("puts RACK")
|
630
|
+
input.puts("exit")
|
631
|
+
end
|
632
|
+
out.should include("0.9.1")
|
633
|
+
end
|
634
|
+
|
635
|
+
it "fails when ruby version doesn't match" do
|
636
|
+
gemfile <<-G
|
637
|
+
source "file://#{gem_repo1}"
|
638
|
+
gem "rack"
|
639
|
+
gem "activesupport", :group => :test
|
640
|
+
gem "rack_middleware", :group => :development
|
641
|
+
|
642
|
+
#{ruby_version_incorrect}
|
643
|
+
G
|
644
|
+
|
645
|
+
bundle "console", :exitstatus => true
|
646
|
+
should_be_ruby_version_incorrect
|
647
|
+
end
|
648
|
+
|
649
|
+
it "fails when engine doesn't match" do
|
650
|
+
gemfile <<-G
|
651
|
+
source "file://#{gem_repo1}"
|
652
|
+
gem "rack"
|
653
|
+
gem "activesupport", :group => :test
|
654
|
+
gem "rack_middleware", :group => :development
|
655
|
+
|
656
|
+
#{engine_incorrect}
|
657
|
+
G
|
658
|
+
|
659
|
+
bundle "console", :exitstatus => true
|
660
|
+
should_be_engine_incorrect
|
661
|
+
end
|
662
|
+
|
663
|
+
it "fails when engine version doesn't match" do
|
664
|
+
simulate_ruby_engine "jruby" do
|
665
|
+
gemfile <<-G
|
666
|
+
source "file://#{gem_repo1}"
|
667
|
+
gem "rack"
|
668
|
+
gem "activesupport", :group => :test
|
669
|
+
gem "rack_middleware", :group => :development
|
670
|
+
|
671
|
+
#{engine_version_incorrect}
|
672
|
+
G
|
673
|
+
|
674
|
+
bundle "console", :exitstatus => true
|
675
|
+
should_be_engine_version_incorrect
|
676
|
+
end
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
context "Bundler.setup" do
|
681
|
+
before do
|
682
|
+
install_gemfile <<-G
|
683
|
+
source "file://#{gem_repo1}"
|
684
|
+
gem "yard"
|
685
|
+
gem "rack", :group => :test
|
686
|
+
G
|
687
|
+
end
|
688
|
+
|
689
|
+
it "makes a Gemfile.lock if setup succeeds" do
|
690
|
+
install_gemfile <<-G
|
691
|
+
source "file://#{gem_repo1}"
|
692
|
+
gem "yard"
|
693
|
+
gem "rack"
|
694
|
+
|
695
|
+
#{ruby_version_correct}
|
696
|
+
G
|
697
|
+
|
698
|
+
File.read(bundled_app("Gemfile.lock"))
|
699
|
+
|
700
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
701
|
+
|
702
|
+
run "1"
|
703
|
+
bundled_app("Gemfile.lock").should exist
|
704
|
+
end
|
705
|
+
|
706
|
+
it "fails when ruby version doesn't match" do
|
707
|
+
install_gemfile <<-G
|
708
|
+
source "file://#{gem_repo1}"
|
709
|
+
gem "yard"
|
710
|
+
gem "rack"
|
711
|
+
|
712
|
+
#{ruby_version_incorrect}
|
713
|
+
G
|
714
|
+
|
715
|
+
File.read(bundled_app("Gemfile.lock"))
|
716
|
+
|
717
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
718
|
+
|
719
|
+
ruby <<-R
|
720
|
+
require 'rubygems'
|
721
|
+
require 'bundler'
|
722
|
+
|
723
|
+
begin
|
724
|
+
Bundler.setup
|
725
|
+
rescue Bundler::RubyVersionMismatch => e
|
726
|
+
puts e.message
|
727
|
+
end
|
728
|
+
R
|
729
|
+
|
730
|
+
bundled_app("Gemfile.lock").should_not exist
|
731
|
+
should_be_ruby_version_incorrect(:exitstatus => false)
|
732
|
+
end
|
733
|
+
|
734
|
+
it "fails when engine doesn't match" do
|
735
|
+
install_gemfile <<-G
|
736
|
+
source "file://#{gem_repo1}"
|
737
|
+
gem "yard"
|
738
|
+
gem "rack"
|
739
|
+
|
740
|
+
#{engine_incorrect}
|
741
|
+
G
|
742
|
+
|
743
|
+
File.read(bundled_app("Gemfile.lock"))
|
744
|
+
|
745
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
746
|
+
|
747
|
+
ruby <<-R
|
748
|
+
require 'rubygems'
|
749
|
+
require 'bundler'
|
750
|
+
|
751
|
+
begin
|
752
|
+
Bundler.setup
|
753
|
+
rescue Bundler::RubyVersionMismatch => e
|
754
|
+
puts e.message
|
755
|
+
end
|
756
|
+
R
|
757
|
+
|
758
|
+
bundled_app("Gemfile.lock").should_not exist
|
759
|
+
should_be_engine_incorrect(:exitstatus => false)
|
760
|
+
end
|
761
|
+
|
762
|
+
it "fails when engine version doesn't match" do
|
763
|
+
simulate_ruby_engine "jruby" do
|
764
|
+
install_gemfile <<-G
|
765
|
+
source "file://#{gem_repo1}"
|
766
|
+
gem "yard"
|
767
|
+
gem "rack"
|
768
|
+
|
769
|
+
#{engine_version_incorrect}
|
770
|
+
G
|
771
|
+
|
772
|
+
File.read(bundled_app("Gemfile.lock"))
|
773
|
+
|
774
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
775
|
+
|
776
|
+
ruby <<-R
|
777
|
+
require 'rubygems'
|
778
|
+
require 'bundler'
|
779
|
+
|
780
|
+
begin
|
781
|
+
Bundler.setup
|
782
|
+
rescue Bundler::RubyVersionMismatch => e
|
783
|
+
puts e.message
|
784
|
+
end
|
785
|
+
R
|
786
|
+
|
787
|
+
bundled_app("Gemfile.lock").should_not exist
|
788
|
+
should_be_engine_version_incorrect(:exitstatus => false)
|
789
|
+
end
|
790
|
+
end
|
791
|
+
end
|
792
|
+
|
793
|
+
context "bundle outdated" do
|
794
|
+
before do
|
795
|
+
build_repo2 do
|
796
|
+
build_git "foo", :path => lib_path("foo")
|
797
|
+
end
|
798
|
+
|
799
|
+
install_gemfile <<-G
|
800
|
+
source "file://#{gem_repo2}"
|
801
|
+
gem "activesupport", "2.3.5"
|
802
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
803
|
+
G
|
804
|
+
end
|
805
|
+
|
806
|
+
it "returns list of outdated gems when the ruby version matches" do
|
807
|
+
update_repo2 do
|
808
|
+
build_gem "activesupport", "3.0"
|
809
|
+
update_git "foo", :path => lib_path("foo")
|
810
|
+
end
|
811
|
+
|
812
|
+
gemfile <<-G
|
813
|
+
source "file://#{gem_repo2}"
|
814
|
+
gem "activesupport", "2.3.5"
|
815
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
816
|
+
|
817
|
+
#{ruby_version_correct}
|
818
|
+
G
|
819
|
+
|
820
|
+
bundle "outdated"
|
821
|
+
out.should include("activesupport (3.0 > 2.3.5)")
|
822
|
+
out.should include("foo (1.0")
|
823
|
+
end
|
824
|
+
|
825
|
+
it "fails when the ruby version doesn't match" do
|
826
|
+
update_repo2 do
|
827
|
+
build_gem "activesupport", "3.0"
|
828
|
+
update_git "foo", :path => lib_path("foo")
|
829
|
+
end
|
830
|
+
|
831
|
+
gemfile <<-G
|
832
|
+
source "file://#{gem_repo2}"
|
833
|
+
gem "activesupport", "2.3.5"
|
834
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
835
|
+
|
836
|
+
#{ruby_version_incorrect}
|
837
|
+
G
|
838
|
+
|
839
|
+
bundle "outdated", :exitstatus => true
|
840
|
+
should_be_ruby_version_incorrect
|
841
|
+
end
|
842
|
+
|
843
|
+
it "fails when the engine doesn't match" do
|
844
|
+
update_repo2 do
|
845
|
+
build_gem "activesupport", "3.0"
|
846
|
+
update_git "foo", :path => lib_path("foo")
|
847
|
+
end
|
848
|
+
|
849
|
+
gemfile <<-G
|
850
|
+
source "file://#{gem_repo2}"
|
851
|
+
gem "activesupport", "2.3.5"
|
852
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
853
|
+
|
854
|
+
#{engine_incorrect}
|
855
|
+
G
|
856
|
+
|
857
|
+
bundle "outdated", :exitstatus => true
|
858
|
+
should_be_engine_incorrect
|
859
|
+
end
|
860
|
+
|
861
|
+
it "fails when the engine version doesn't match" do
|
862
|
+
simulate_ruby_engine "jruby" do
|
863
|
+
update_repo2 do
|
864
|
+
build_gem "activesupport", "3.0"
|
865
|
+
update_git "foo", :path => lib_path("foo")
|
866
|
+
end
|
867
|
+
|
868
|
+
gemfile <<-G
|
869
|
+
source "file://#{gem_repo2}"
|
870
|
+
gem "activesupport", "2.3.5"
|
871
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
872
|
+
|
873
|
+
#{engine_version_incorrect}
|
874
|
+
G
|
875
|
+
|
876
|
+
bundle "outdated", :exitstatus => true
|
877
|
+
should_be_engine_version_incorrect
|
878
|
+
end
|
879
|
+
end
|
880
|
+
end
|
881
|
+
end
|