bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -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/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -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_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,278 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle check" do
|
4
|
+
it "returns success when the Gemfile is satisfied" do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
|
10
|
+
bundle :check, :exitstatus => true
|
11
|
+
expect(@exitstatus).to eq(0)
|
12
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "works with the --gemfile flag when not in the directory" do
|
16
|
+
install_gemfile <<-G
|
17
|
+
source "file://#{gem_repo1}"
|
18
|
+
gem "rails"
|
19
|
+
G
|
20
|
+
|
21
|
+
Dir.chdir tmp
|
22
|
+
bundle "check --gemfile bundled_app/Gemfile"
|
23
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "creates a Gemfile.lock by default if one does not exist" do
|
27
|
+
install_gemfile <<-G
|
28
|
+
source "file://#{gem_repo1}"
|
29
|
+
gem "rails"
|
30
|
+
G
|
31
|
+
|
32
|
+
FileUtils.rm("Gemfile.lock")
|
33
|
+
|
34
|
+
bundle "check"
|
35
|
+
|
36
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
37
|
+
end
|
38
|
+
|
39
|
+
it "does not create a Gemfile.lock if --dry-run was passed" do
|
40
|
+
install_gemfile <<-G
|
41
|
+
source "file://#{gem_repo1}"
|
42
|
+
gem "rails"
|
43
|
+
G
|
44
|
+
|
45
|
+
FileUtils.rm("Gemfile.lock")
|
46
|
+
|
47
|
+
bundle "check --dry-run"
|
48
|
+
|
49
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
50
|
+
end
|
51
|
+
|
52
|
+
it "prints a generic error if the missing gems are unresolvable" do
|
53
|
+
system_gems ["rails-2.3.2"]
|
54
|
+
|
55
|
+
gemfile <<-G
|
56
|
+
source "file://#{gem_repo1}"
|
57
|
+
gem "rails"
|
58
|
+
G
|
59
|
+
|
60
|
+
bundle :check
|
61
|
+
expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
|
62
|
+
end
|
63
|
+
|
64
|
+
it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do
|
65
|
+
gemfile <<-G
|
66
|
+
source "file://#{gem_repo1}"
|
67
|
+
gem "rails"
|
68
|
+
G
|
69
|
+
|
70
|
+
bundle :check, :exitstatus => true
|
71
|
+
expect(@exitstatus).to be > 0
|
72
|
+
expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "prints a generic message if you changed your lockfile" do
|
76
|
+
install_gemfile <<-G
|
77
|
+
source "file://#{gem_repo1}"
|
78
|
+
gem 'rails'
|
79
|
+
G
|
80
|
+
install_gemfile <<-G
|
81
|
+
source "file://#{gem_repo1}"
|
82
|
+
gem 'rails_fail'
|
83
|
+
G
|
84
|
+
|
85
|
+
gemfile <<-G
|
86
|
+
source "file://#{gem_repo1}"
|
87
|
+
gem "rails"
|
88
|
+
gem "rails_fail"
|
89
|
+
G
|
90
|
+
|
91
|
+
bundle :check
|
92
|
+
expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "remembers --without option from install" do
|
96
|
+
gemfile <<-G
|
97
|
+
source "file://#{gem_repo1}"
|
98
|
+
group :foo do
|
99
|
+
gem "rack"
|
100
|
+
end
|
101
|
+
G
|
102
|
+
|
103
|
+
bundle "install --without foo"
|
104
|
+
bundle "check", :exitstatus => true
|
105
|
+
expect(@exitstatus).to eq(0)
|
106
|
+
expect(out).to include("The Gemfile's dependencies are satisfied")
|
107
|
+
end
|
108
|
+
|
109
|
+
it "ensures that gems are actually installed and not just cached" do
|
110
|
+
gemfile <<-G
|
111
|
+
source "file://#{gem_repo1}"
|
112
|
+
gem "rack", :group => :foo
|
113
|
+
G
|
114
|
+
|
115
|
+
bundle "install --without foo"
|
116
|
+
|
117
|
+
gemfile <<-G
|
118
|
+
source "file://#{gem_repo1}"
|
119
|
+
gem "rack"
|
120
|
+
G
|
121
|
+
|
122
|
+
bundle "check", :exitstatus => true
|
123
|
+
expect(out).to include("* rack (1.0.0)")
|
124
|
+
expect(@exitstatus).to eq(1)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "ignores missing gems restricted to other platforms" do
|
128
|
+
system_gems "rack-1.0.0"
|
129
|
+
|
130
|
+
gemfile <<-G
|
131
|
+
source "file://#{gem_repo1}"
|
132
|
+
gem "rack"
|
133
|
+
platforms :#{not_local_tag} do
|
134
|
+
gem "activesupport"
|
135
|
+
end
|
136
|
+
G
|
137
|
+
|
138
|
+
lockfile <<-G
|
139
|
+
GEM
|
140
|
+
remote: file:#{gem_repo1}/
|
141
|
+
specs:
|
142
|
+
activesupport (2.3.5)
|
143
|
+
rack (1.0.0)
|
144
|
+
|
145
|
+
PLATFORMS
|
146
|
+
#{local}
|
147
|
+
#{not_local}
|
148
|
+
|
149
|
+
DEPENDENCIES
|
150
|
+
rack
|
151
|
+
activesupport
|
152
|
+
G
|
153
|
+
|
154
|
+
bundle :check
|
155
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
156
|
+
end
|
157
|
+
|
158
|
+
it "works with env conditionals" do
|
159
|
+
system_gems "rack-1.0.0"
|
160
|
+
|
161
|
+
gemfile <<-G
|
162
|
+
source "file://#{gem_repo1}"
|
163
|
+
gem "rack"
|
164
|
+
env :NOT_GOING_TO_BE_SET do
|
165
|
+
gem "activesupport"
|
166
|
+
end
|
167
|
+
G
|
168
|
+
|
169
|
+
lockfile <<-G
|
170
|
+
GEM
|
171
|
+
remote: file:#{gem_repo1}/
|
172
|
+
specs:
|
173
|
+
activesupport (2.3.5)
|
174
|
+
rack (1.0.0)
|
175
|
+
|
176
|
+
PLATFORMS
|
177
|
+
#{local}
|
178
|
+
#{not_local}
|
179
|
+
|
180
|
+
DEPENDENCIES
|
181
|
+
rack
|
182
|
+
activesupport
|
183
|
+
G
|
184
|
+
|
185
|
+
bundle :check
|
186
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
187
|
+
end
|
188
|
+
|
189
|
+
it "outputs an error when the default Gemfile is not found" do
|
190
|
+
bundle :check, :exitstatus => true
|
191
|
+
expect(@exitstatus).to eq(10)
|
192
|
+
expect(out).to include("Could not locate Gemfile")
|
193
|
+
end
|
194
|
+
|
195
|
+
it "does not output fatal error message" do
|
196
|
+
bundle :check, :exitstatus => true
|
197
|
+
expect(@exitstatus).to eq(10)
|
198
|
+
expect(out).not_to include("Unfortunately, a fatal error has occurred. ")
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should not crash when called multiple times on a new machine" do
|
202
|
+
gemfile <<-G
|
203
|
+
gem 'rails', '3.0.0.beta3'
|
204
|
+
gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
|
205
|
+
G
|
206
|
+
|
207
|
+
simulate_new_machine
|
208
|
+
bundle "check"
|
209
|
+
last_out = out
|
210
|
+
3.times do |i|
|
211
|
+
bundle :check
|
212
|
+
expect(out).to eq(last_out)
|
213
|
+
expect(err).to be_empty
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
it "fails when there's no lock file and frozen is set" do
|
218
|
+
gemfile <<-G
|
219
|
+
source "file://#{gem_repo1}"
|
220
|
+
gem "foo"
|
221
|
+
G
|
222
|
+
|
223
|
+
bundle "install"
|
224
|
+
bundle "install --deployment"
|
225
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
226
|
+
|
227
|
+
bundle :check, :exitstatus => true
|
228
|
+
expect(exitstatus).not_to eq(0)
|
229
|
+
end
|
230
|
+
|
231
|
+
context "--path" do
|
232
|
+
before do
|
233
|
+
gemfile <<-G
|
234
|
+
source "file://#{gem_repo1}"
|
235
|
+
gem "rails"
|
236
|
+
G
|
237
|
+
bundle "install --path vendor/bundle"
|
238
|
+
|
239
|
+
FileUtils.rm_rf(bundled_app(".bundle"))
|
240
|
+
end
|
241
|
+
|
242
|
+
it "returns success" do
|
243
|
+
bundle "check --path vendor/bundle", :exitstatus => true
|
244
|
+
expect(@exitstatus).to eq(0)
|
245
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should write to .bundle/config" do
|
249
|
+
bundle "check --path vendor/bundle", :exitstatus => true
|
250
|
+
bundle "check", :exitstatus => true
|
251
|
+
expect(@exitstatus).to eq(0)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
describe "when locked" do
|
256
|
+
before :each do
|
257
|
+
system_gems "rack-1.0.0"
|
258
|
+
install_gemfile <<-G
|
259
|
+
source "file://#{gem_repo1}"
|
260
|
+
gem "rack", "1.0"
|
261
|
+
G
|
262
|
+
end
|
263
|
+
|
264
|
+
it "returns success when the Gemfile is satisfied" do
|
265
|
+
bundle :install
|
266
|
+
bundle :check, :exitstatus => true
|
267
|
+
expect(@exitstatus).to eq(0)
|
268
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
269
|
+
end
|
270
|
+
|
271
|
+
it "shows what is missing with the current Gemfile if it is not satisfied" do
|
272
|
+
simulate_new_machine
|
273
|
+
bundle :check
|
274
|
+
expect(out).to match(/The following gems are missing/)
|
275
|
+
expect(out).to include("* rack (1.0")
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,652 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle clean" do
|
4
|
+
def should_have_gems(*gems)
|
5
|
+
gems.each do |g|
|
6
|
+
expect(vendored_gems("gems/#{g}")).to exist
|
7
|
+
expect(vendored_gems("specifications/#{g}.gemspec")).to exist
|
8
|
+
expect(vendored_gems("cache/#{g}.gem")).to exist
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def should_not_have_gems(*gems)
|
13
|
+
gems.each do |g|
|
14
|
+
expect(vendored_gems("gems/#{g}")).not_to exist
|
15
|
+
expect(vendored_gems("specifications/#{g}.gemspec")).not_to exist
|
16
|
+
expect(vendored_gems("cache/#{g}.gem")).not_to exist
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "removes unused gems that are different" do
|
21
|
+
gemfile <<-G
|
22
|
+
source "file://#{gem_repo1}"
|
23
|
+
|
24
|
+
gem "thin"
|
25
|
+
gem "foo"
|
26
|
+
G
|
27
|
+
|
28
|
+
bundle "install --path vendor/bundle --no-clean"
|
29
|
+
|
30
|
+
gemfile <<-G
|
31
|
+
source "file://#{gem_repo1}"
|
32
|
+
|
33
|
+
gem "thin"
|
34
|
+
G
|
35
|
+
bundle "install"
|
36
|
+
|
37
|
+
bundle :clean
|
38
|
+
|
39
|
+
expect(out).to eq("Removing foo (1.0)")
|
40
|
+
|
41
|
+
should_have_gems 'thin-1.0', 'rack-1.0.0'
|
42
|
+
should_not_have_gems 'foo-1.0'
|
43
|
+
|
44
|
+
expect(vendored_gems("bin/rackup")).to exist
|
45
|
+
end
|
46
|
+
|
47
|
+
it "removes old version of gem if unused" do
|
48
|
+
gemfile <<-G
|
49
|
+
source "file://#{gem_repo1}"
|
50
|
+
|
51
|
+
gem "rack", "0.9.1"
|
52
|
+
gem "foo"
|
53
|
+
G
|
54
|
+
|
55
|
+
bundle "install --path vendor/bundle --no-clean"
|
56
|
+
|
57
|
+
gemfile <<-G
|
58
|
+
source "file://#{gem_repo1}"
|
59
|
+
|
60
|
+
gem "rack", "1.0.0"
|
61
|
+
gem "foo"
|
62
|
+
G
|
63
|
+
bundle "install"
|
64
|
+
|
65
|
+
bundle :clean
|
66
|
+
|
67
|
+
expect(out).to eq("Removing rack (0.9.1)")
|
68
|
+
|
69
|
+
should_have_gems 'foo-1.0', 'rack-1.0.0'
|
70
|
+
should_not_have_gems 'rack-0.9.1'
|
71
|
+
|
72
|
+
expect(vendored_gems("bin/rackup")).to exist
|
73
|
+
end
|
74
|
+
|
75
|
+
it "removes new version of gem if unused" do
|
76
|
+
gemfile <<-G
|
77
|
+
source "file://#{gem_repo1}"
|
78
|
+
|
79
|
+
gem "rack", "1.0.0"
|
80
|
+
gem "foo"
|
81
|
+
G
|
82
|
+
|
83
|
+
bundle "install --path vendor/bundle --no-clean"
|
84
|
+
|
85
|
+
gemfile <<-G
|
86
|
+
source "file://#{gem_repo1}"
|
87
|
+
|
88
|
+
gem "rack", "0.9.1"
|
89
|
+
gem "foo"
|
90
|
+
G
|
91
|
+
bundle "install"
|
92
|
+
|
93
|
+
bundle :clean
|
94
|
+
|
95
|
+
expect(out).to eq("Removing rack (1.0.0)")
|
96
|
+
|
97
|
+
should_have_gems 'foo-1.0', 'rack-0.9.1'
|
98
|
+
should_not_have_gems 'rack-1.0.0'
|
99
|
+
|
100
|
+
expect(vendored_gems("bin/rackup")).to exist
|
101
|
+
end
|
102
|
+
|
103
|
+
it "removes gems in bundle without groups" do
|
104
|
+
gemfile <<-G
|
105
|
+
source "file://#{gem_repo1}"
|
106
|
+
|
107
|
+
gem "foo"
|
108
|
+
|
109
|
+
group :test_group do
|
110
|
+
gem "rack", "1.0.0"
|
111
|
+
end
|
112
|
+
G
|
113
|
+
|
114
|
+
bundle "install --path vendor/bundle"
|
115
|
+
bundle "install --without test_group"
|
116
|
+
bundle :clean
|
117
|
+
|
118
|
+
expect(out).to eq("Removing rack (1.0.0)")
|
119
|
+
|
120
|
+
should_have_gems 'foo-1.0'
|
121
|
+
should_not_have_gems 'rack-1.0.0'
|
122
|
+
|
123
|
+
expect(vendored_gems("bin/rackup")).to_not exist
|
124
|
+
end
|
125
|
+
|
126
|
+
it "does not remove cached git dir if it's being used" do
|
127
|
+
build_git "foo"
|
128
|
+
revision = revision_for(lib_path("foo-1.0"))
|
129
|
+
git_path = lib_path('foo-1.0')
|
130
|
+
|
131
|
+
gemfile <<-G
|
132
|
+
source "file://#{gem_repo1}"
|
133
|
+
|
134
|
+
gem "rack", "1.0.0"
|
135
|
+
git "#{git_path}", :ref => "#{revision}" do
|
136
|
+
gem "foo"
|
137
|
+
end
|
138
|
+
G
|
139
|
+
|
140
|
+
bundle "install --path vendor/bundle"
|
141
|
+
|
142
|
+
bundle :clean
|
143
|
+
|
144
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
145
|
+
expect(vendored_gems("cache/bundler/git/foo-1.0-#{digest}")).to exist
|
146
|
+
end
|
147
|
+
|
148
|
+
it "removes unused svn gems" do
|
149
|
+
build_svn "foo", :path => lib_path("foo")
|
150
|
+
svn_path = lib_path('foo')
|
151
|
+
revision = 1
|
152
|
+
|
153
|
+
gemfile <<-G
|
154
|
+
source "file://#{gem_repo1}"
|
155
|
+
|
156
|
+
gem "rack", "1.0.0"
|
157
|
+
svn "file://#{svn_path}", :ref => "#{revision}" do
|
158
|
+
gem "foo"
|
159
|
+
end
|
160
|
+
G
|
161
|
+
|
162
|
+
bundle "install --path vendor/bundle"
|
163
|
+
|
164
|
+
gemfile <<-G
|
165
|
+
source "file://#{gem_repo1}"
|
166
|
+
|
167
|
+
gem "rack", "1.0.0"
|
168
|
+
G
|
169
|
+
bundle "install"
|
170
|
+
|
171
|
+
bundle :clean
|
172
|
+
|
173
|
+
expect(out).to eq("Removing foo (#{revision})")
|
174
|
+
|
175
|
+
expect(vendored_gems("gems/rack-1.0.0")).to exist
|
176
|
+
expect(vendored_gems("bundler/gems/foo-#{revision}")).not_to exist
|
177
|
+
expect(vendored_gems("cache/bundler/svn/foo-#{revision}")).not_to exist
|
178
|
+
|
179
|
+
expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist
|
180
|
+
|
181
|
+
expect(vendored_gems("bin/rackup")).to exist
|
182
|
+
end
|
183
|
+
|
184
|
+
it "removes unused git gems" do
|
185
|
+
build_git "foo", :path => lib_path("foo")
|
186
|
+
git_path = lib_path('foo')
|
187
|
+
revision = revision_for(git_path)
|
188
|
+
|
189
|
+
gemfile <<-G
|
190
|
+
source "file://#{gem_repo1}"
|
191
|
+
|
192
|
+
gem "rack", "1.0.0"
|
193
|
+
git "#{git_path}", :ref => "#{revision}" do
|
194
|
+
gem "foo"
|
195
|
+
end
|
196
|
+
G
|
197
|
+
|
198
|
+
bundle "install --path vendor/bundle"
|
199
|
+
|
200
|
+
gemfile <<-G
|
201
|
+
source "file://#{gem_repo1}"
|
202
|
+
|
203
|
+
gem "rack", "1.0.0"
|
204
|
+
G
|
205
|
+
bundle "install"
|
206
|
+
|
207
|
+
bundle :clean
|
208
|
+
|
209
|
+
expect(out).to eq("Removing foo (#{revision[0..11]})")
|
210
|
+
|
211
|
+
expect(vendored_gems("gems/rack-1.0.0")).to exist
|
212
|
+
expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).not_to exist
|
213
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
214
|
+
expect(vendored_gems("cache/bundler/git/foo-#{digest}")).not_to exist
|
215
|
+
|
216
|
+
expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist
|
217
|
+
|
218
|
+
expect(vendored_gems("bin/rackup")).to exist
|
219
|
+
end
|
220
|
+
|
221
|
+
it "removes old git gems" do
|
222
|
+
build_git "foo-bar", :path => lib_path("foo-bar")
|
223
|
+
revision = revision_for(lib_path("foo-bar"))
|
224
|
+
|
225
|
+
gemfile <<-G
|
226
|
+
source "file://#{gem_repo1}"
|
227
|
+
|
228
|
+
gem "rack", "1.0.0"
|
229
|
+
git "#{lib_path('foo-bar')}" do
|
230
|
+
gem "foo-bar"
|
231
|
+
end
|
232
|
+
G
|
233
|
+
|
234
|
+
bundle "install --path vendor/bundle"
|
235
|
+
|
236
|
+
update_git "foo", :path => lib_path("foo-bar")
|
237
|
+
revision2 = revision_for(lib_path("foo-bar"))
|
238
|
+
|
239
|
+
bundle "update"
|
240
|
+
bundle :clean
|
241
|
+
|
242
|
+
expect(out).to eq("Removing foo-bar (#{revision[0..11]})")
|
243
|
+
|
244
|
+
expect(vendored_gems("gems/rack-1.0.0")).to exist
|
245
|
+
expect(vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}")).not_to exist
|
246
|
+
expect(vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}")).to exist
|
247
|
+
|
248
|
+
expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist
|
249
|
+
|
250
|
+
expect(vendored_gems("bin/rackup")).to exist
|
251
|
+
end
|
252
|
+
|
253
|
+
it "does not remove nested gems in a git repo" do
|
254
|
+
build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport")
|
255
|
+
build_git "rails", "3.0", :path => lib_path("rails") do |s|
|
256
|
+
s.add_dependency "activesupport", "= 3.0"
|
257
|
+
end
|
258
|
+
revision = revision_for(lib_path("rails"))
|
259
|
+
|
260
|
+
gemfile <<-G
|
261
|
+
gem "activesupport", :git => "#{lib_path('rails')}", :ref => '#{revision}'
|
262
|
+
G
|
263
|
+
|
264
|
+
bundle "install --path vendor/bundle"
|
265
|
+
bundle :clean
|
266
|
+
expect(out).to eq("")
|
267
|
+
|
268
|
+
expect(vendored_gems("bundler/gems/rails-#{revision[0..11]}")).to exist
|
269
|
+
end
|
270
|
+
|
271
|
+
it "does not remove git sources that are in without groups" do
|
272
|
+
build_git "foo", :path => lib_path("foo")
|
273
|
+
git_path = lib_path('foo')
|
274
|
+
revision = revision_for(git_path)
|
275
|
+
|
276
|
+
gemfile <<-G
|
277
|
+
source "file://#{gem_repo1}"
|
278
|
+
|
279
|
+
gem "rack", "1.0.0"
|
280
|
+
group :test do
|
281
|
+
git "#{git_path}", :ref => "#{revision}" do
|
282
|
+
gem "foo"
|
283
|
+
end
|
284
|
+
end
|
285
|
+
G
|
286
|
+
bundle "install --path vendor/bundle --without test"
|
287
|
+
|
288
|
+
bundle :clean
|
289
|
+
|
290
|
+
expect(out).to eq("")
|
291
|
+
expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).to exist
|
292
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
293
|
+
expect(vendored_gems("cache/bundler/git/foo-#{digest}")).to_not exist
|
294
|
+
end
|
295
|
+
|
296
|
+
it "does not blow up when using without groups" do
|
297
|
+
gemfile <<-G
|
298
|
+
source "file://#{gem_repo1}"
|
299
|
+
|
300
|
+
gem "rack"
|
301
|
+
|
302
|
+
group :development do
|
303
|
+
gem "foo"
|
304
|
+
end
|
305
|
+
G
|
306
|
+
|
307
|
+
bundle "install --path vendor/bundle --without development"
|
308
|
+
|
309
|
+
bundle :clean, :exitstatus => true
|
310
|
+
expect(exitstatus).to eq(0)
|
311
|
+
end
|
312
|
+
|
313
|
+
it "displays an error when used without --path" do
|
314
|
+
install_gemfile <<-G
|
315
|
+
source "file://#{gem_repo1}"
|
316
|
+
|
317
|
+
gem "rack", "1.0.0"
|
318
|
+
G
|
319
|
+
|
320
|
+
bundle :clean, :exitstatus => true
|
321
|
+
|
322
|
+
expect(exitstatus).to eq(1)
|
323
|
+
expect(out).to eq("Can only use bundle clean when --path is set or --force is set")
|
324
|
+
end
|
325
|
+
|
326
|
+
# handling bundle clean upgrade path from the pre's
|
327
|
+
it "removes .gem/.gemspec file even if there's no corresponding gem dir" do
|
328
|
+
gemfile <<-G
|
329
|
+
source "file://#{gem_repo1}"
|
330
|
+
|
331
|
+
gem "thin"
|
332
|
+
gem "foo"
|
333
|
+
G
|
334
|
+
|
335
|
+
bundle "install --path vendor/bundle"
|
336
|
+
|
337
|
+
gemfile <<-G
|
338
|
+
source "file://#{gem_repo1}"
|
339
|
+
|
340
|
+
gem "foo"
|
341
|
+
G
|
342
|
+
bundle "install"
|
343
|
+
|
344
|
+
FileUtils.rm(vendored_gems("bin/rackup"))
|
345
|
+
FileUtils.rm_rf(vendored_gems("gems/thin-1.0"))
|
346
|
+
FileUtils.rm_rf(vendored_gems("gems/rack-1.0.0"))
|
347
|
+
|
348
|
+
bundle :clean
|
349
|
+
|
350
|
+
should_not_have_gems 'thin-1.0', 'rack-1.0'
|
351
|
+
should_have_gems 'foo-1.0'
|
352
|
+
|
353
|
+
expect(vendored_gems("bin/rackup")).not_to exist
|
354
|
+
end
|
355
|
+
|
356
|
+
it "does not call clean automatically when using system gems" do
|
357
|
+
gemfile <<-G
|
358
|
+
source "file://#{gem_repo1}"
|
359
|
+
|
360
|
+
gem "thin"
|
361
|
+
gem "rack"
|
362
|
+
G
|
363
|
+
bundle :install
|
364
|
+
|
365
|
+
gemfile <<-G
|
366
|
+
source "file://#{gem_repo1}"
|
367
|
+
|
368
|
+
gem "rack"
|
369
|
+
G
|
370
|
+
bundle :install
|
371
|
+
|
372
|
+
sys_exec "gem list"
|
373
|
+
expect(out).to include("rack (1.0.0)")
|
374
|
+
expect(out).to include("thin (1.0)")
|
375
|
+
end
|
376
|
+
|
377
|
+
it "--clean should override the bundle setting on install" do
|
378
|
+
gemfile <<-G
|
379
|
+
source "file://#{gem_repo1}"
|
380
|
+
|
381
|
+
gem "thin"
|
382
|
+
gem "rack"
|
383
|
+
G
|
384
|
+
bundle "install --path vendor/bundle --clean"
|
385
|
+
|
386
|
+
gemfile <<-G
|
387
|
+
source "file://#{gem_repo1}"
|
388
|
+
|
389
|
+
gem "rack"
|
390
|
+
G
|
391
|
+
bundle "install"
|
392
|
+
|
393
|
+
should_have_gems 'rack-1.0.0'
|
394
|
+
should_not_have_gems 'thin-1.0'
|
395
|
+
end
|
396
|
+
|
397
|
+
it "--clean should override the bundle setting on update" do
|
398
|
+
build_repo2
|
399
|
+
|
400
|
+
gemfile <<-G
|
401
|
+
source "file://#{gem_repo2}"
|
402
|
+
|
403
|
+
gem "foo"
|
404
|
+
G
|
405
|
+
bundle "install --path vendor/bundle --clean"
|
406
|
+
|
407
|
+
update_repo2 do
|
408
|
+
build_gem 'foo', '1.0.1'
|
409
|
+
end
|
410
|
+
|
411
|
+
bundle "update"
|
412
|
+
|
413
|
+
should_have_gems 'foo-1.0.1'
|
414
|
+
should_not_have_gems 'foo-1.0'
|
415
|
+
end
|
416
|
+
|
417
|
+
it "does not clean automatically on --path" do
|
418
|
+
gemfile <<-G
|
419
|
+
source "file://#{gem_repo1}"
|
420
|
+
|
421
|
+
gem "thin"
|
422
|
+
gem "rack"
|
423
|
+
G
|
424
|
+
bundle "install --path vendor/bundle"
|
425
|
+
|
426
|
+
gemfile <<-G
|
427
|
+
source "file://#{gem_repo1}"
|
428
|
+
|
429
|
+
gem "rack"
|
430
|
+
G
|
431
|
+
bundle "install"
|
432
|
+
|
433
|
+
should_have_gems 'rack-1.0.0', 'thin-1.0'
|
434
|
+
end
|
435
|
+
|
436
|
+
it "does not clean on bundle update with --path" do
|
437
|
+
build_repo2
|
438
|
+
|
439
|
+
gemfile <<-G
|
440
|
+
source "file://#{gem_repo2}"
|
441
|
+
|
442
|
+
gem "foo"
|
443
|
+
G
|
444
|
+
bundle "install --path vendor/bundle"
|
445
|
+
|
446
|
+
update_repo2 do
|
447
|
+
build_gem 'foo', '1.0.1'
|
448
|
+
end
|
449
|
+
|
450
|
+
bundle :update
|
451
|
+
should_have_gems 'foo-1.0', 'foo-1.0.1'
|
452
|
+
end
|
453
|
+
|
454
|
+
it "does not clean on bundle update when using --system" do
|
455
|
+
build_repo2
|
456
|
+
|
457
|
+
gemfile <<-G
|
458
|
+
source "file://#{gem_repo2}"
|
459
|
+
|
460
|
+
gem "foo"
|
461
|
+
G
|
462
|
+
bundle "install"
|
463
|
+
|
464
|
+
update_repo2 do
|
465
|
+
build_gem 'foo', '1.0.1'
|
466
|
+
end
|
467
|
+
bundle :update
|
468
|
+
|
469
|
+
sys_exec "gem list"
|
470
|
+
expect(out).to include("foo (1.0.1, 1.0)")
|
471
|
+
end
|
472
|
+
|
473
|
+
it "cleans system gems when --force is used" do
|
474
|
+
gemfile <<-G
|
475
|
+
source "file://#{gem_repo1}"
|
476
|
+
|
477
|
+
gem "foo"
|
478
|
+
gem "rack"
|
479
|
+
G
|
480
|
+
bundle :install
|
481
|
+
|
482
|
+
gemfile <<-G
|
483
|
+
source "file://#{gem_repo1}"
|
484
|
+
|
485
|
+
gem "rack"
|
486
|
+
G
|
487
|
+
bundle :install
|
488
|
+
bundle "clean --force"
|
489
|
+
|
490
|
+
expect(out).to eq("Removing foo (1.0)")
|
491
|
+
sys_exec "gem list"
|
492
|
+
expect(out).not_to include("foo (1.0)")
|
493
|
+
expect(out).to include("rack (1.0.0)")
|
494
|
+
end
|
495
|
+
|
496
|
+
it "cleans git gems with a 7 length git revision" do
|
497
|
+
build_git "foo"
|
498
|
+
revision = revision_for(lib_path("foo-1.0"))
|
499
|
+
|
500
|
+
gemfile <<-G
|
501
|
+
source "file://#{gem_repo1}"
|
502
|
+
|
503
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
504
|
+
G
|
505
|
+
|
506
|
+
bundle "install --path vendor/bundle"
|
507
|
+
|
508
|
+
# mimic 7 length git revisions in Gemfile.lock
|
509
|
+
gemfile_lock = File.read(bundled_app('Gemfile.lock')).split("\n")
|
510
|
+
gemfile_lock.each_with_index do |line, index|
|
511
|
+
gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
|
512
|
+
end
|
513
|
+
File.open(bundled_app('Gemfile.lock'), 'w') do |file|
|
514
|
+
file.print gemfile_lock.join("\n")
|
515
|
+
end
|
516
|
+
|
517
|
+
bundle "install --path vendor/bundle"
|
518
|
+
|
519
|
+
bundle :clean
|
520
|
+
|
521
|
+
expect(out).not_to include("Removing foo (1.0 #{revision[0..6]})")
|
522
|
+
|
523
|
+
expect(vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}")).to exist
|
524
|
+
end
|
525
|
+
|
526
|
+
it "when using --force on system gems, it doesn't remove binaries" do
|
527
|
+
build_repo2
|
528
|
+
update_repo2 do
|
529
|
+
build_gem 'bindir' do |s|
|
530
|
+
s.bindir = "exe"
|
531
|
+
s.executables = "foo"
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
gemfile <<-G
|
536
|
+
source "file://#{gem_repo2}"
|
537
|
+
|
538
|
+
gem "bindir"
|
539
|
+
G
|
540
|
+
bundle :install
|
541
|
+
|
542
|
+
bundle "clean --force"
|
543
|
+
|
544
|
+
sys_status "foo"
|
545
|
+
|
546
|
+
expect(exitstatus).to eq(0)
|
547
|
+
expect(out).to eq("1.0")
|
548
|
+
end
|
549
|
+
|
550
|
+
it "doesn't blow up on path gems without a .gempsec" do
|
551
|
+
relative_path = "vendor/private_gems/bar-1.0"
|
552
|
+
absolute_path = bundled_app(relative_path)
|
553
|
+
FileUtils.mkdir_p("#{absolute_path}/lib/bar")
|
554
|
+
File.open("#{absolute_path}/lib/bar/bar.rb", 'wb') do |file|
|
555
|
+
file.puts "module Bar; end"
|
556
|
+
end
|
557
|
+
|
558
|
+
gemfile <<-G
|
559
|
+
source "file://#{gem_repo1}"
|
560
|
+
|
561
|
+
gem "foo"
|
562
|
+
gem "bar", "1.0", :path => "#{relative_path}"
|
563
|
+
G
|
564
|
+
|
565
|
+
bundle "install --path vendor/bundle"
|
566
|
+
bundle :clean, :exitstatus => true
|
567
|
+
|
568
|
+
expect(exitstatus).to eq(0)
|
569
|
+
end
|
570
|
+
|
571
|
+
it "doesn't remove gems in dry-run mode" do
|
572
|
+
gemfile <<-G
|
573
|
+
source "file://#{gem_repo1}"
|
574
|
+
|
575
|
+
gem "thin"
|
576
|
+
gem "foo"
|
577
|
+
G
|
578
|
+
|
579
|
+
bundle "install --path vendor/bundle --no-clean"
|
580
|
+
|
581
|
+
gemfile <<-G
|
582
|
+
source "file://#{gem_repo1}"
|
583
|
+
|
584
|
+
gem "thin"
|
585
|
+
G
|
586
|
+
|
587
|
+
bundle :install
|
588
|
+
|
589
|
+
bundle "clean --dry-run"
|
590
|
+
|
591
|
+
expect(out).not_to eq("Removing foo (1.0)")
|
592
|
+
expect(out).to eq("Would have removed foo (1.0)")
|
593
|
+
|
594
|
+
should_have_gems 'thin-1.0', 'rack-1.0.0', 'foo-1.0'
|
595
|
+
|
596
|
+
expect(vendored_gems("bin/rackup")).to exist
|
597
|
+
end
|
598
|
+
|
599
|
+
it "doesn't store dry run as a config setting" do
|
600
|
+
gemfile <<-G
|
601
|
+
source "file://#{gem_repo1}"
|
602
|
+
|
603
|
+
gem "thin"
|
604
|
+
gem "foo"
|
605
|
+
G
|
606
|
+
|
607
|
+
bundle "install --path vendor/bundle --no-clean"
|
608
|
+
bundle "config dry_run false"
|
609
|
+
|
610
|
+
gemfile <<-G
|
611
|
+
source "file://#{gem_repo1}"
|
612
|
+
|
613
|
+
gem "thin"
|
614
|
+
G
|
615
|
+
|
616
|
+
bundle :install
|
617
|
+
|
618
|
+
bundle "clean"
|
619
|
+
|
620
|
+
expect(out).to eq("Removing foo (1.0)")
|
621
|
+
expect(out).not_to eq("Would have removed foo (1.0)")
|
622
|
+
|
623
|
+
should_have_gems 'thin-1.0', 'rack-1.0.0'
|
624
|
+
should_not_have_gems 'foo-1.0'
|
625
|
+
|
626
|
+
expect(vendored_gems("bin/rackup")).to exist
|
627
|
+
end
|
628
|
+
|
629
|
+
it "performs an automatic bundle install" do
|
630
|
+
gemfile <<-G
|
631
|
+
source "file://#{gem_repo1}"
|
632
|
+
|
633
|
+
gem "thin"
|
634
|
+
gem "foo"
|
635
|
+
G
|
636
|
+
|
637
|
+
bundle "install --path vendor/bundle --no-clean"
|
638
|
+
|
639
|
+
gemfile <<-G
|
640
|
+
source "file://#{gem_repo1}"
|
641
|
+
|
642
|
+
gem "thin"
|
643
|
+
gem "weakling"
|
644
|
+
G
|
645
|
+
|
646
|
+
bundle "config auto_install 1"
|
647
|
+
bundle :clean
|
648
|
+
expect(out).to include('Installing weakling 0.0.3')
|
649
|
+
should_have_gems 'thin-1.0', 'rack-1.0.0', 'weakling-0.0.3'
|
650
|
+
should_not_have_gems 'foo-1.0'
|
651
|
+
end
|
652
|
+
end
|