blob: cf9cf354c6c4e27892907ee64adf9668db1a87eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
require File.expand_path('../../spec_helper', __FILE__)
describe "bundle cache" do
describe "when there are only gemsources" do
before :each do
gemfile <<-G
gem 'rack'
G
system_gems "rack-1.0.0"
bundle :cache
end
it "copies the .gem file to vendor/cache" do
bundled_app("vendor/cache/rack-1.0.0.gem").should exist
end
it "uses the cache as a source when installing gems" do
system_gems []
bundle :install
should_be_installed("rack 1.0.0")
end
it "does not reinstall gems from the cache if they exist on the system" do
build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
s.write "lib/rack.rb", "RACK = 'FAIL'"
end
install_gemfile <<-G
gem "rack"
G
should_be_installed("rack 1.0.0")
end
it "does not reinstall gems from the cache if they exist in the bundle" do
system_gems []
install_gemfile <<-G
gem "rack"
G
build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
s.write "lib/rack.rb", "RACK = 'FAIL'"
end
bundle :install
should_be_installed("rack 1.0.0")
end
end
describe "when there are also git sources" do
it "still works" do
build_git "foo"
system_gems "rack-1.0.0"
install_gemfile <<-G
git "#{lib_path("foo-1.0")}"
gem 'rack'
gem 'foo'
G
bundle :cache
system_gems []
bundle :install
should_be_installed("rack 1.0.0", "foo 1.0")
end
end
describe "when previously cached" do
before :each do
build_repo2
install_gemfile <<-G
source "file://#{gem_repo2}"
gem "rack"
gem "actionpack"
G
bundle :cache
cached_gem("rack-1.0.0").should exist
cached_gem("actionpack-2.3.2").should exist
cached_gem("activesupport-2.3.2").should exist
end
it "re-caches during install" do
cached_gem("rack-1.0.0").rmtree
bundle :install
out.should include("Copying .gem files into vendor/cache")
cached_gem("rack-1.0.0").should exist
end
it "adds updated gems" do
update_repo2
bundle :install
cached_gem("rack-1.2").should exist
end
it "adds new gems and dependencies" do
install_gemfile <<-G
source "file://#{gem_repo2}"
gem "rails"
G
cached_gem("rails-2.3.2").should exist
cached_gem("activerecord-2.3.2").should exist
end
it "removes .gems for removed gems and dependencies" do
install_gemfile <<-G
source "file://#{gem_repo2}"
gem "rack"
G
cached_gem("rack-1.0.0").should exist
cached_gem("actionpack-2.3.2").should_not exist
cached_gem("activesupport-2.3.2").should_not exist
end
it "doesn't remove gems with mismatched :rubygems_version or :date" do
cached_gem("rack-1.0.0").rmtree
build_gem "rack", "1.0.0",
:path => bundled_app('vendor/cache'),
:rubygems_version => "1.3.2"
simulate_new_machine
bundle :install
cached_gem("rack-1.0.0").should exist
end
end
end
|