librarian 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --color
2
- --tag ~slow
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.0.9
2
+
3
+ * \#11 Fixes a problem where, if the repo is in a path where a component has a space, attempting to resolve a
4
+ site-sourced dependency fails.
5
+
1
6
  ## 0.0.8
2
7
 
3
8
  * A `version` task.
@@ -257,9 +257,14 @@ module Librarian
257
257
  version_package_cache_path = version_package_cache_path(dependency, version_uri)
258
258
  unless version_package_cache_path.exist?
259
259
  dependency_cache_path = dependency_cache_path(dependency)
260
- Dir.chdir(dependency_cache_path) do
261
- `tar -xzf #{version_archive_cache_path}`
262
- end
260
+ Process.waitpid2(fork do
261
+ $stdin.reopen("/dev/null")
262
+ $stdout.reopen("/dev/null")
263
+ $stderr.reopen("/dev/null")
264
+ Dir.chdir(dependency_cache_path)
265
+ exec("tar", "-xzf", version_archive_cache_path.to_s)
266
+ end)
267
+ raise StandardError, "Caching #{version_uri} failed with #{$?.inspect}!" unless $?.success?
263
268
  version_unpacked_temp_path = dependency_cache_path.join(dependency.name)
264
269
  FileUtils.move(version_unpacked_temp_path, version_package_cache_path)
265
270
  end
@@ -2,6 +2,7 @@ require 'librarian/helpers/debug'
2
2
 
3
3
  require 'librarian/manifest'
4
4
  require 'librarian/dependency'
5
+ require 'librarian/manifest_set'
5
6
 
6
7
  module Librarian
7
8
  class Lockfile
@@ -90,7 +91,7 @@ module Librarian
90
91
  dependencies
91
92
  )
92
93
  end
93
- Resolver.new(root_module).sort(manifests)
94
+ ManifestSet.sort(manifests)
94
95
  end
95
96
 
96
97
  def dsl_class
@@ -1,3 +1,3 @@
1
1
  module Librarian
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -10,33 +10,42 @@ module Librarian
10
10
  module Source
11
11
  describe Git do
12
12
 
13
- project_path = Pathname.new(__FILE__).expand_path
14
- project_path = project_path.dirname until project_path.join("Rakefile").exist?
15
- tmp_path = project_path.join("tmp/spec/chef/git-source")
13
+ let(:project_path) do
14
+ project_path = Pathname.new(__FILE__).expand_path
15
+ project_path = project_path.dirname until project_path.join("Rakefile").exist?
16
+ project_path
17
+ end
18
+ let(:tmp_path) { project_path.join("tmp/spec/chef/git-source") }
16
19
 
17
- cookbooks_path = tmp_path.join('cookbooks')
20
+ let(:cookbooks_path) { tmp_path.join("cookbooks") }
18
21
 
19
22
  context "a single dependency with a git source" do
20
23
 
21
- sample_path = tmp_path.join('sample')
22
- sample_metadata = Helpers.strip_heredoc(<<-METADATA)
23
- version '0.6.5'
24
- METADATA
24
+ let(:sample_path) { tmp_path.join("sample") }
25
+ let(:sample_metadata) do
26
+ Helpers.strip_heredoc(<<-METADATA)
27
+ version "0.6.5"
28
+ METADATA
29
+ end
25
30
 
26
- first_sample_path = cookbooks_path.join('first-sample')
27
- first_sample_metadata = Helpers.strip_heredoc(<<-METADATA)
28
- version '3.2.1'
29
- METADATA
31
+ let(:first_sample_path) { cookbooks_path.join("first-sample") }
32
+ let(:first_sample_metadata) do
33
+ Helpers.strip_heredoc(<<-METADATA)
34
+ version "3.2.1"
35
+ METADATA
36
+ end
30
37
 
31
- second_sample_path = cookbooks_path.join('second-sample')
32
- second_sample_metadata = Helpers.strip_heredoc(<<-METADATA)
33
- version '4.3.2'
34
- METADATA
38
+ let(:second_sample_path) { cookbooks_path.join("second-sample") }
39
+ let(:second_sample_metadata) do
40
+ Helpers.strip_heredoc(<<-METADATA)
41
+ version "4.3.2"
42
+ METADATA
43
+ end
35
44
 
36
45
  before :all do
37
46
  sample_path.rmtree if sample_path.exist?
38
47
  sample_path.mkpath
39
- sample_path.join('metadata.rb').open('wb') { |f| f.write(sample_metadata) }
48
+ sample_path.join("metadata.rb").open("wb") { |f| f.write(sample_metadata) }
40
49
  Dir.chdir(sample_path) do
41
50
  `git init`
42
51
  `git add metadata.rb`
@@ -46,9 +55,9 @@ module Librarian
46
55
  cookbooks_path.rmtree if cookbooks_path.exist?
47
56
  cookbooks_path.mkpath
48
57
  first_sample_path.mkpath
49
- first_sample_path.join('metadata.rb').open('wb') { |f| f.write(first_sample_metadata) }
58
+ first_sample_path.join("metadata.rb").open("wb") { |f| f.write(first_sample_metadata) }
50
59
  second_sample_path.mkpath
51
- second_sample_path.join('metadata.rb').open('wb') { |f| f.write(second_sample_metadata) }
60
+ second_sample_path.join("metadata.rb").open("wb") { |f| f.write(second_sample_metadata) }
52
61
  Dir.chdir(cookbooks_path) do
53
62
  `git init`
54
63
  `git add .`
@@ -57,79 +66,79 @@ module Librarian
57
66
  end
58
67
 
59
68
  it "should resolve" do
60
- repo_path = tmp_path.join('repo/resolve')
69
+ repo_path = tmp_path.join("repo/resolve")
61
70
  repo_path.rmtree if repo_path.exist?
62
71
  repo_path.mkpath
63
- repo_path.join('cookbooks').mkpath
72
+ repo_path.join("cookbooks").mkpath
64
73
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
65
74
  #!/usr/bin/env ruby
66
75
  cookbook "sample", :git => #{sample_path.to_s.inspect}
67
76
  CHEFFILE
68
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
77
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
69
78
  Chef.stub!(:project_path) { repo_path }
70
79
 
71
80
  Chef.resolve!
72
- repo_path.join('Cheffile.lock').should be_exist
73
- repo_path.join('cookbooks/sample').should_not be_exist
81
+ repo_path.join("Cheffile.lock").should exist
82
+ repo_path.join("cookbooks/sample").should_not exist
74
83
  end
75
84
 
76
85
  it "should install" do
77
- repo_path = tmp_path.join('repo/install')
86
+ repo_path = tmp_path.join("repo/install")
78
87
  repo_path.rmtree if repo_path.exist?
79
88
  repo_path.mkpath
80
- repo_path.join('cookbooks').mkpath
89
+ repo_path.join("cookbooks").mkpath
81
90
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
82
91
  #!/usr/bin/env ruby
83
92
  cookbook "sample", :git => #{sample_path.to_s.inspect}
84
93
  CHEFFILE
85
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
94
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
86
95
  Chef.stub!(:project_path) { repo_path }
87
96
 
88
97
  Chef.install!
89
- repo_path.join('Cheffile.lock').should be_exist
90
- repo_path.join('cookbooks/sample').should be_exist
91
- repo_path.join('cookbooks/sample/metadata.rb').should be_exist
98
+ repo_path.join("Cheffile.lock").should exist
99
+ repo_path.join("cookbooks/sample").should exist
100
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
92
101
  end
93
102
 
94
103
  it "should resolve and separately install" do
95
- repo_path = tmp_path.join('repo/resolve-install')
104
+ repo_path = tmp_path.join("repo/resolve-install")
96
105
  repo_path.rmtree if repo_path.exist?
97
106
  repo_path.mkpath
98
- repo_path.join('cookbooks').mkpath
107
+ repo_path.join("cookbooks").mkpath
99
108
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
100
109
  #!/usr/bin/env ruby
101
110
  cookbook "sample", :git => #{sample_path.to_s.inspect}
102
111
  CHEFFILE
103
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
112
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
104
113
  Chef.stub!(:project_path) { repo_path }
105
114
 
106
115
  Chef.resolve!
107
- repo_path.join('tmp').rmtree if repo_path.join('tmp').exist?
116
+ repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
108
117
  Chef.install!
109
- repo_path.join('cookbooks/sample').should be_exist
110
- repo_path.join('cookbooks/sample/metadata.rb').should be_exist
118
+ repo_path.join("cookbooks/sample").should exist
119
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
111
120
  end
112
121
 
113
122
  it "should resolve, change, and resolve" do
114
- repo_path = tmp_path.join('repo/resolve-update')
123
+ repo_path = tmp_path.join("repo/resolve-update")
115
124
  repo_path.rmtree if repo_path.exist?
116
125
  repo_path.mkpath
117
- repo_path.join('cookbooks').mkpath
126
+ repo_path.join("cookbooks").mkpath
118
127
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
119
128
  git #{cookbooks_path.to_s.inspect}
120
129
  cookbook "first-sample"
121
130
  CHEFFILE
122
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
131
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
123
132
  Chef.stub!(:project_path) { repo_path }
124
133
  Chef.resolve!
125
- repo_path.join('Cheffile.lock').should exist
134
+ repo_path.join("Cheffile.lock").should exist
126
135
 
127
136
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
128
137
  git #{cookbooks_path.to_s.inspect}
129
138
  cookbook "first-sample"
130
139
  cookbook "second-sample"
131
140
  CHEFFILE
132
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
141
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
133
142
  Chef.stub!(:project_path) { repo_path }
134
143
  Chef.resolve!
135
144
  end
@@ -138,17 +147,19 @@ module Librarian
138
147
 
139
148
  context "with a path" do
140
149
 
141
- git_path = tmp_path.join('big-git-repo')
142
- sample_path = git_path.join('buttercup')
143
- sample_metadata = Helpers.strip_heredoc(<<-METADATA)
144
- version '0.6.5'
145
- METADATA
150
+ let(:git_path) { tmp_path.join("big-git-repo") }
151
+ let(:sample_path) { git_path.join("buttercup") }
152
+ let(:sample_metadata) do
153
+ Helpers.strip_heredoc(<<-METADATA)
154
+ version "0.6.5"
155
+ METADATA
156
+ end
146
157
 
147
158
  before :all do
148
159
  git_path.rmtree if git_path.exist?
149
160
  git_path.mkpath
150
161
  sample_path.mkpath
151
- sample_path.join('metadata.rb').open('wb') { |f| f.write(sample_metadata) }
162
+ sample_path.join("metadata.rb").open("wb") { |f| f.write(sample_metadata) }
152
163
  Dir.chdir(git_path) do
153
164
  `git init`
154
165
  `git add .`
@@ -158,16 +169,16 @@ module Librarian
158
169
 
159
170
  context "if no path option is given" do
160
171
  it "should not resolve" do
161
- repo_path = tmp_path.join('repo/resolve')
172
+ repo_path = tmp_path.join("repo/resolve")
162
173
  repo_path.rmtree if repo_path.exist?
163
174
  repo_path.mkpath
164
- repo_path.join('cookbooks').mkpath
175
+ repo_path.join("cookbooks").mkpath
165
176
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
166
177
  #!/usr/bin/env ruby
167
178
  cookbook "sample",
168
179
  :git => #{git_path.to_s.inspect}
169
180
  CHEFFILE
170
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
181
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
171
182
  Chef.stub!(:project_path) { repo_path }
172
183
 
173
184
  expect{ Chef.resolve! }.to raise_error
@@ -176,17 +187,17 @@ module Librarian
176
187
 
177
188
  context "if the path option is wrong" do
178
189
  it "should not resolve" do
179
- repo_path = tmp_path.join('repo/resolve')
190
+ repo_path = tmp_path.join("repo/resolve")
180
191
  repo_path.rmtree if repo_path.exist?
181
192
  repo_path.mkpath
182
- repo_path.join('cookbooks').mkpath
193
+ repo_path.join("cookbooks").mkpath
183
194
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
184
195
  #!/usr/bin/env ruby
185
196
  cookbook "sample",
186
197
  :git => #{git_path.to_s.inspect},
187
198
  :path => "jelly"
188
199
  CHEFFILE
189
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
200
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
190
201
  Chef.stub!(:project_path) { repo_path }
191
202
 
192
203
  expect{ Chef.resolve! }.to raise_error
@@ -205,19 +216,19 @@ module Librarian
205
216
  :git => #{git_path.to_s.inspect},
206
217
  :path => "buttercup"
207
218
  CHEFFILE
208
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
219
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
209
220
  Chef.stub!(:project_path) { repo_path }
210
221
 
211
222
  Chef.resolve!
212
- repo_path.join('Cheffile.lock').should be_exist
213
- repo_path.join('cookbooks/sample').should_not be_exist
223
+ repo_path.join("Cheffile.lock").should exist
224
+ repo_path.join("cookbooks/sample").should_not exist
214
225
  end
215
226
  end
216
227
 
217
228
  end
218
229
 
219
230
  context "missing a metadata" do
220
- git_path = tmp_path.join('big-git-repo')
231
+ let(:git_path) { tmp_path.join("big-git-repo") }
221
232
 
222
233
  it "should explain the problem" do
223
234
  repo_path = tmp_path.join("repo/resolve")
@@ -233,8 +244,8 @@ module Librarian
233
244
 
234
245
  expect { Chef.resolve! }.
235
246
  to raise_error(Librarian::Error, /no metadata file found/i)
236
- repo_path.join("Cheffile.lock").should_not be_exist
237
- repo_path.join("cookbooks/sample").should_not be_exist
247
+ repo_path.join("Cheffile.lock").should_not exist
248
+ repo_path.join("cookbooks/sample").should_not exist
238
249
  end
239
250
  end
240
251
 
@@ -0,0 +1,156 @@
1
+ require 'webmock'
2
+
3
+ require 'librarian'
4
+ require 'librarian/helpers'
5
+ require 'librarian/chef'
6
+
7
+ module Librarian
8
+ module Chef
9
+ module Source
10
+ describe Site do
11
+
12
+ include WebMock::API
13
+
14
+ let(:project_path) do
15
+ project_path = Pathname.new(__FILE__).expand_path
16
+ project_path = project_path.dirname until project_path.join("Rakefile").exist?
17
+ project_path
18
+ end
19
+ let(:tmp_path) { project_path.join("tmp/spec/chef/site-source") }
20
+ let(:sample_path) { tmp_path.join("sample") }
21
+ let(:sample_metadata) do
22
+ Helpers.strip_heredoc(<<-METADATA)
23
+ version "0.6.5"
24
+ METADATA
25
+ end
26
+
27
+ let(:api_url) { "http://site.cookbooks.com" }
28
+
29
+ let(:sample_index_data) do
30
+ {
31
+ "name" => "sample",
32
+ "versions" => [
33
+ "#{api_url}/cookbooks/sample/versions/0_6_5"
34
+ ]
35
+ }
36
+ end
37
+ let(:sample_0_6_5_data) do
38
+ {
39
+ "version" => "0.6.5",
40
+ "file" => "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz"
41
+ }
42
+ end
43
+
44
+ before :all do
45
+ sample_path.rmtree if sample_path.exist?
46
+ sample_path.mkpath
47
+ sample_path.join('metadata.rb').open('wb') { |f| f.write(sample_metadata) }
48
+ Dir.chdir(sample_path.dirname) do
49
+ system "tar --create --gzip --file sample.tar.gz #{sample_path.basename}"
50
+ end
51
+ end
52
+
53
+ before do
54
+ stub_request(:get, "#{api_url}/cookbooks/sample").
55
+ to_return(:body => JSON.dump(sample_index_data))
56
+
57
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5").
58
+ to_return(:body => JSON.dump(sample_0_6_5_data))
59
+
60
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz").
61
+ to_return(:body => sample_path.dirname.join("sample.tar.gz").read)
62
+ end
63
+
64
+ after do
65
+ WebMock.reset!
66
+ end
67
+
68
+ context "a single dependency with a site source" do
69
+
70
+ it "should resolve" do
71
+ repo_path = tmp_path.join("repo/resolve")
72
+ repo_path.rmtree if repo_path.exist?
73
+ repo_path.mkpath
74
+ repo_path.join("cookbooks").mkpath
75
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
76
+ #!/usr/bin/env ruby
77
+ cookbook "sample", :site => #{api_url.inspect}
78
+ CHEFFILE
79
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
80
+ Chef.stub!(:project_path) { repo_path }
81
+
82
+ Chef.resolve!
83
+ repo_path.join("Cheffile.lock").should exist
84
+ repo_path.join("cookbooks/sample").should_not exist
85
+ end
86
+
87
+ it "should install" do
88
+ repo_path = tmp_path.join("repo/install")
89
+ repo_path.rmtree if repo_path.exist?
90
+ repo_path.mkpath
91
+ repo_path.join("cookbooks").mkpath
92
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
93
+ #!/usr/bin/env ruby
94
+ cookbook "sample", :site => #{api_url.inspect}
95
+ CHEFFILE
96
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
97
+ Chef.stub!(:project_path) { repo_path }
98
+
99
+ Chef.install!
100
+ repo_path.join("Cheffile.lock").should exist
101
+ repo_path.join("cookbooks/sample").should exist
102
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
103
+ end
104
+
105
+ it "should resolve and separately install" do
106
+ repo_path = tmp_path.join("repo/resolve-install")
107
+ repo_path.rmtree if repo_path.exist?
108
+ repo_path.mkpath
109
+ repo_path.join("cookbooks").mkpath
110
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
111
+ #!/usr/bin/env ruby
112
+ cookbook "sample", :site => #{api_url.inspect}
113
+ CHEFFILE
114
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
115
+ Chef.stub!(:project_path) { repo_path }
116
+
117
+ Chef.resolve!
118
+ repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
119
+ Chef.install!
120
+ repo_path.join("cookbooks/sample").should exist
121
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
122
+ end
123
+
124
+ end
125
+
126
+ context "when the repo path has a space" do
127
+
128
+ let(:repo_path) { tmp_path.join("repo/with extra spaces/resolve") }
129
+
130
+ before do
131
+ repo_path.rmtree if repo_path.exist?
132
+ repo_path.mkpath
133
+ repo_path.join("cookbooks").mkpath
134
+
135
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
136
+ #!/usr/bin/env ruby
137
+ cookbook "sample", :site => #{api_url.inspect}
138
+ CHEFFILE
139
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
140
+ Chef.stub!(:project_path) { repo_path }
141
+ end
142
+
143
+ after do
144
+ repo_path.rmtree
145
+ end
146
+
147
+ it "should resolve" do
148
+ expect { Chef.resolve! }.to_not raise_error
149
+ end
150
+
151
+ end
152
+
153
+ end
154
+ end
155
+ end
156
+ end
File without changes
@@ -0,0 +1,54 @@
1
+ require 'librarian'
2
+ require 'librarian/mock'
3
+
4
+ module Librarian
5
+ describe Lockfile do
6
+
7
+ before do
8
+ Mock.registry :clear => true do
9
+ source 'source-1' do
10
+ spec 'alpha', '1.1'
11
+ end
12
+ end
13
+ end
14
+
15
+ let(:spec) do
16
+ Mock.dsl do
17
+ src 'source-1'
18
+ dep 'alpha', '1.1'
19
+ end
20
+ end
21
+
22
+ let(:resolver) { Mock.resolver }
23
+ let(:resolution) { resolver.resolve(spec) }
24
+
25
+ context "sanity" do
26
+ context "the resolution" do
27
+ subject { resolution }
28
+
29
+ it { should be_correct }
30
+ end
31
+ end
32
+
33
+ describe "#save" do
34
+ let(:lockfile) { Mock.ephemeral_lockfile }
35
+ let(:lockfile_text) { lockfile.save(resolution) }
36
+
37
+ context "just saving" do
38
+ it "should return the lockfile text" do
39
+ lockfile_text.should_not be_nil
40
+ end
41
+ end
42
+
43
+ context "bouncing" do
44
+ let(:bounced_resolution) { lockfile.load(lockfile_text) }
45
+ let(:bounced_lockfile_text) { lockfile.save(bounced_resolution) }
46
+
47
+ it "should return the same lockfile text after bouncing as before bouncing" do
48
+ bounced_lockfile_text.should == lockfile_text
49
+ end
50
+ end
51
+ end
52
+
53
+ end
54
+ end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-05 00:00:00.000000000Z
12
+ date: 2011-10-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &34375080 !ruby/object:Gem::Requirement
16
+ requirement: &25393320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *34375080
24
+ version_requirements: *25393320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &34374660 !ruby/object:Gem::Requirement
27
+ requirement: &25392900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *34374660
35
+ version_requirements: *25392900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &34374240 !ruby/object:Gem::Requirement
38
+ requirement: &25392480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *34374240
46
+ version_requirements: *25392480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &34373820 !ruby/object:Gem::Requirement
49
+ requirement: &25392060 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *34373820
57
+ version_requirements: *25392060
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &34373400 !ruby/object:Gem::Requirement
60
+ requirement: &25391640 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *34373400
68
+ version_requirements: *25391640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: chef
71
- requirement: &34372900 !ruby/object:Gem::Requirement
71
+ requirement: &25391140 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0.10'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *34372900
79
+ version_requirements: *25391140
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: highline
82
- requirement: &34372480 !ruby/object:Gem::Requirement
82
+ requirement: &25390720 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *34372480
90
+ version_requirements: *25390720
91
91
  description: Librarian
92
92
  email:
93
93
  - y_feldblum@yahoo.com
@@ -159,13 +159,12 @@ files:
159
159
  - lib/librarian/ui.rb
160
160
  - lib/librarian/version.rb
161
161
  - librarian.gemspec
162
- - spec/chef/git_source_spec.rb
163
- - spec/chef/site_source_spec.rb
164
- - spec/dsl_spec.rb
165
- - spec/lockfile_spec.rb
166
- - spec/meta/requires_spec.rb
167
- - spec/resolver_spec.rb
168
- - spec/spec_change_set_spec.rb
162
+ - spec/functional/chef/source/git_spec.rb
163
+ - spec/functional/chef/source/site_spec.rb
164
+ - spec/unit/dsl_spec.rb
165
+ - spec/unit/lockfile_spec.rb
166
+ - spec/unit/resolver_spec.rb
167
+ - spec/unit/spec_change_set_spec.rb
169
168
  homepage: ''
170
169
  licenses: []
171
170
  post_install_message:
@@ -1,120 +0,0 @@
1
- require 'webmock'
2
-
3
- require 'librarian'
4
- require 'librarian/helpers'
5
- require 'librarian/chef'
6
-
7
- module Librarian
8
- module Chef
9
- module Source
10
- describe Site do
11
-
12
- include WebMock::API
13
-
14
- project_path = Pathname.new(__FILE__).expand_path
15
- project_path = project_path.dirname until project_path.join("Rakefile").exist?
16
- tmp_path = project_path.join("tmp/spec/chef/site-source")
17
- sample_path = tmp_path.join('sample')
18
- sample_metadata = Helpers.strip_heredoc(<<-METADATA)
19
- version '0.6.5'
20
- METADATA
21
-
22
- api_url = "http://site.cookbooks.com"
23
-
24
- sample_index_data = {
25
- "name" => "sample",
26
- "versions" => [
27
- "#{api_url}/cookbooks/sample/versions/0_6_5"
28
- ]
29
- }
30
- sample_0_6_5_data = {
31
- "version" => "0.6.5",
32
- "file" => "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz"
33
- }
34
-
35
- before :all do
36
- sample_path.rmtree if sample_path.exist?
37
- sample_path.mkpath
38
- sample_path.join('metadata.rb').open('wb') { |f| f.write(sample_metadata) }
39
- Dir.chdir(sample_path.dirname) do
40
- system "tar --create --gzip --file sample.tar.gz #{sample_path.basename}"
41
- end
42
- end
43
-
44
- before do
45
- stub_request(:get, "#{api_url}/cookbooks/sample").
46
- to_return(:body => JSON.dump(sample_index_data))
47
-
48
- stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5").
49
- to_return(:body => JSON.dump(sample_0_6_5_data))
50
-
51
- stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz").
52
- to_return(:body => sample_path.dirname.join("sample.tar.gz").read)
53
- end
54
-
55
- after do
56
- WebMock.reset!
57
- end
58
-
59
- context "a single dependency with a site source" do
60
-
61
- it "should resolve" do
62
- repo_path = tmp_path.join('repo/resolve')
63
- repo_path.rmtree if repo_path.exist?
64
- repo_path.mkpath
65
- repo_path.join('cookbooks').mkpath
66
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
67
- #!/usr/bin/env ruby
68
- cookbook "sample", :site => "#{api_url}"
69
- CHEFFILE
70
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
71
- Chef.stub!(:project_path) { repo_path }
72
-
73
- Chef.resolve!
74
- repo_path.join('Cheffile.lock').should be_exist
75
- repo_path.join('cookbooks/sample').should_not be_exist
76
- end
77
-
78
- it "should install" do
79
- repo_path = tmp_path.join('repo/install')
80
- repo_path.rmtree if repo_path.exist?
81
- repo_path.mkpath
82
- repo_path.join('cookbooks').mkpath
83
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
84
- #!/usr/bin/env ruby
85
- cookbook "sample", :site => "#{api_url}"
86
- CHEFFILE
87
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
88
- Chef.stub!(:project_path) { repo_path }
89
-
90
- Chef.install!
91
- repo_path.join('Cheffile.lock').should be_exist
92
- repo_path.join('cookbooks/sample').should be_exist
93
- repo_path.join('cookbooks/sample/metadata.rb').should be_exist
94
- end
95
-
96
- it "should resolve and separately install" do
97
- repo_path = tmp_path.join('repo/resolve-install')
98
- repo_path.rmtree if repo_path.exist?
99
- repo_path.mkpath
100
- repo_path.join('cookbooks').mkpath
101
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
102
- #!/usr/bin/env ruby
103
- cookbook "sample", :site => "#{api_url}"
104
- CHEFFILE
105
- repo_path.join('Cheffile').open('wb') { |f| f.write(cheffile) }
106
- Chef.stub!(:project_path) { repo_path }
107
-
108
- Chef.resolve!
109
- repo_path.join('tmp').rmtree if repo_path.join('tmp').exist?
110
- Chef.install!
111
- repo_path.join('cookbooks/sample').should be_exist
112
- repo_path.join('cookbooks/sample/metadata.rb').should be_exist
113
- end
114
-
115
- end
116
-
117
- end
118
- end
119
- end
120
- end
@@ -1,44 +0,0 @@
1
- require 'librarian'
2
- require 'librarian/mock'
3
-
4
- module Librarian
5
- describe Lockfile do
6
-
7
- it "should save" do
8
- Mock.registry :clear => true do
9
- source 'source-1' do
10
- spec 'alpha', '1.1'
11
- end
12
- end
13
- spec = Mock.dsl do
14
- src 'source-1'
15
- dep 'alpha', '1.1'
16
- end
17
- resolution = Mock.resolver.resolve(spec)
18
- resolution.should be_correct
19
- lockfile = Mock.ephemeral_lockfile
20
- lockfile_text = lockfile.save(resolution)
21
- lockfile_text.should_not be_nil
22
- end
23
-
24
- it "should bounce" do
25
- Mock.registry :clear => true do
26
- source 'source-1' do
27
- spec 'alpha', '1.1'
28
- end
29
- end
30
- spec = Mock.dsl do
31
- src 'source-1'
32
- dep 'alpha', '1.1'
33
- end
34
- resolution = Mock.resolver.resolve(spec)
35
- resolution.should be_correct
36
- lockfile = Mock.ephemeral_lockfile
37
- lockfile_text = lockfile.save(resolution)
38
- bounced_resolution = lockfile.load(lockfile_text)
39
- bounced_lockfile_text = lockfile.save(bounced_resolution)
40
- bounced_lockfile_text.should == lockfile_text
41
- end
42
-
43
- end
44
- end
@@ -1,27 +0,0 @@
1
- require 'pathname'
2
- require 'open3'
3
-
4
- describe 'Meta' do
5
- describe 'Requires', :slow => true do
6
-
7
- root_path = Pathname.new('../../..').expand_path(__FILE__)
8
-
9
- Pathname.glob(root_path.join('lib/**/*.rb')).sort.each do |path|
10
-
11
- it "require '#{path.relative_path_from(root_path.join('lib'))}'" do
12
- script = <<-SCRIPT
13
- lib = File.expand_path(%{lib}, %{#{root_path}})
14
- $:.unshift(lib) unless $:.include?(lib)
15
- require %{#{path}}
16
- SCRIPT
17
- cmd = <<-CMD
18
- ruby -e '#{script}'
19
- CMD
20
- err = Open3.popen3(cmd) { |i, o, e, t| e.read }
21
- raise Exception, err if err != ''
22
- end
23
-
24
- end
25
-
26
- end
27
- end