librarian 0.1.1 → 0.1.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/CHANGELOG.md +15 -0
  4. data/Gemfile +2 -0
  5. data/VERSION +1 -0
  6. data/lib/librarian/algorithms.rb +133 -0
  7. data/lib/librarian/cli/manifest_presenter.rb +1 -5
  8. data/lib/librarian/dependency.rb +7 -1
  9. data/lib/librarian/environment.rb +20 -2
  10. data/lib/librarian/environment/runtime_cache.rb +101 -0
  11. data/lib/librarian/manifest.rb +7 -1
  12. data/lib/librarian/manifest_set.rb +11 -12
  13. data/lib/librarian/posix.rb +14 -5
  14. data/lib/librarian/resolver.rb +22 -9
  15. data/lib/librarian/resolver/implementation.rb +64 -49
  16. data/lib/librarian/source/git.rb +47 -11
  17. data/lib/librarian/source/git/repository.rb +33 -3
  18. data/lib/librarian/version.rb +1 -1
  19. data/librarian.gemspec +8 -6
  20. data/spec/functional/cli_spec.rb +1 -1
  21. data/spec/functional/posix_spec.rb +6 -8
  22. data/spec/functional/source/git/repository_spec.rb +55 -27
  23. data/spec/functional/source/git_spec.rb +152 -8
  24. data/spec/support/project_path_macro.rb +14 -0
  25. data/spec/unit/action/base_spec.rb +1 -1
  26. data/spec/unit/action/clean_spec.rb +6 -6
  27. data/spec/unit/action/install_spec.rb +5 -5
  28. data/spec/unit/algorithms_spec.rb +131 -0
  29. data/spec/unit/config/database_spec.rb +38 -38
  30. data/spec/unit/dependency/requirement_spec.rb +12 -0
  31. data/spec/unit/dsl_spec.rb +49 -49
  32. data/spec/unit/environment/runtime_cache_spec.rb +73 -0
  33. data/spec/unit/environment_spec.rb +28 -28
  34. data/spec/unit/lockfile/parser_spec.rb +18 -18
  35. data/spec/unit/lockfile_spec.rb +3 -3
  36. data/spec/unit/manifest/version_spec.rb +11 -0
  37. data/spec/unit/manifest_set_spec.rb +20 -20
  38. data/spec/unit/mock/environment_spec.rb +4 -4
  39. data/spec/unit/resolver_spec.rb +61 -20
  40. data/spec/unit/spec_change_set_spec.rb +19 -19
  41. metadata +19 -5
@@ -6,19 +6,19 @@ module Librarian::Mock
6
6
  let(:env) { described_class.new }
7
7
 
8
8
  describe "#version" do
9
- specify { env.version.should be == Librarian::VERSION }
9
+ specify { expect(env.version).to eq Librarian::VERSION }
10
10
  end
11
11
 
12
12
  describe "#adapter_module" do
13
- specify { env.adapter_module.should be Librarian::Mock }
13
+ specify { expect(env.adapter_module).to eq Librarian::Mock }
14
14
  end
15
15
 
16
16
  describe "#adapter_name" do
17
- specify { env.adapter_name.should be == "mock" }
17
+ specify { expect(env.adapter_name).to eq "mock" }
18
18
  end
19
19
 
20
20
  describe "#adapter_version" do
21
- specify { env.adapter_version.should be == Librarian::Mock::VERSION }
21
+ specify { expect(env.adapter_version).to eq Librarian::Mock::VERSION }
22
22
  end
23
23
 
24
24
  end
@@ -33,7 +33,7 @@ module Librarian
33
33
 
34
34
  let(:resolution) { resolver.resolve(spec) }
35
35
 
36
- specify { resolution.should be_correct }
36
+ specify { expect(resolution).to be_correct }
37
37
 
38
38
  end
39
39
 
@@ -63,7 +63,7 @@ module Librarian
63
63
 
64
64
  let(:resolution) { resolver.resolve(spec) }
65
65
 
66
- specify { resolution.should be_correct }
66
+ specify { expect(resolution).to be_correct }
67
67
 
68
68
  end
69
69
 
@@ -94,16 +94,16 @@ module Librarian
94
94
  end
95
95
 
96
96
  it "should have the expected number of sources" do
97
- spec.should have(2).sources
97
+ expect(spec).to have(2).sources
98
98
  end
99
99
 
100
100
  let(:resolution) { resolver.resolve(spec) }
101
101
 
102
- specify { resolution.should be_correct }
102
+ specify { expect(resolution).to be_correct }
103
103
 
104
104
  it "should have the manifest from the final source with a matching manifest" do
105
105
  manifest = resolution.manifests.find{|m| m.name == "butter"}
106
- manifest.source.name.should == "source-2"
106
+ expect(manifest.source.name).to eq "source-2"
107
107
  end
108
108
 
109
109
  end
@@ -129,7 +129,7 @@ module Librarian
129
129
 
130
130
  let(:resolution) { resolver.resolve(spec) }
131
131
 
132
- specify { resolution.should be_nil }
132
+ specify { expect(resolution).to be_nil }
133
133
 
134
134
  end
135
135
 
@@ -157,7 +157,48 @@ module Librarian
157
157
 
158
158
  let(:resolution) { resolver.resolve(spec) }
159
159
 
160
- specify { resolution.should be_nil }
160
+ specify { expect(resolution).to be_nil }
161
+
162
+ end
163
+
164
+ context "a specfile with cyclic constraints" do
165
+
166
+ before do
167
+ env.registry :clear => true do
168
+ source 'source-1' do
169
+ spec 'butter', '1.0' do
170
+ dependency 'jam', '2.0'
171
+ end
172
+ spec 'jam', '2.0' do
173
+ dependency 'butter', '1.0'
174
+ end
175
+ end
176
+ end
177
+ end
178
+
179
+ let(:spec) do
180
+ env.dsl do
181
+ src 'source-1'
182
+ dep 'butter'
183
+ end
184
+ end
185
+
186
+ let(:resolution) { resolver.resolve(spec) }
187
+
188
+ context "when cyclic resolutions are forbidden" do
189
+ let(:resolver) { env.resolver(:cyclic => false) }
190
+
191
+ specify { expect(resolution).to be_nil }
192
+ end
193
+
194
+ context "when cyclic resolutions are permitted" do
195
+ let(:resolver) { env.resolver(:cyclic => true) }
196
+
197
+ it "should have all the manifests" do
198
+ manifest_names = resolution.manifests.map(&:name).sort
199
+ expect(manifest_names).to be == %w[butter jam]
200
+ end
201
+ end
161
202
 
162
203
  end
163
204
 
@@ -179,10 +220,10 @@ module Librarian
179
220
  dep 'jam'
180
221
  end
181
222
  first_resolution = resolver.resolve(first_spec)
182
- first_resolution.should be_correct
223
+ expect(first_resolution).to be_correct
183
224
  first_manifests = first_resolution.manifests
184
225
  first_manifests_index = Hash[first_manifests.map{|m| [m.name, m]}]
185
- first_manifests_index['butter'].version.to_s.should == '1.1'
226
+ expect(first_manifests_index['butter'].version.to_s).to eq '1.1'
186
227
 
187
228
  second_spec = env.dsl do
188
229
  src 'source-1'
@@ -191,10 +232,10 @@ module Librarian
191
232
  end
192
233
  locked_manifests = ManifestSet.deep_strip(first_manifests, ['butter'])
193
234
  second_resolution =resolver.resolve(second_spec, locked_manifests)
194
- second_resolution.should be_correct
235
+ expect(second_resolution).to be_correct
195
236
  second_manifests = second_resolution.manifests
196
237
  second_manifests_index = Hash[second_manifests.map{|m| [m.name, m]}]
197
- second_manifests_index['butter'].version.to_s.should == '1.0'
238
+ expect(second_manifests_index['butter'].version.to_s).to eq '1.0'
198
239
  end
199
240
 
200
241
  end
@@ -215,22 +256,22 @@ module Librarian
215
256
  dep 'butter'
216
257
  end
217
258
  lock = resolver.resolve(spec)
218
- lock.should be_correct
259
+ expect(lock).to be_correct
219
260
 
220
261
  spec = env.dsl do
221
262
  src 'source-1'
222
263
  dep 'butter', :src => 'source-2'
223
264
  end
224
265
  changes = SpecChangeSet.new(env, spec, lock)
225
- changes.should_not be_same
266
+ expect(changes).to_not be_same
226
267
  manifests = ManifestSet.new(changes.analyze).to_hash
227
- manifests.should_not have_key('butter')
268
+ expect(manifests).to_not have_key('butter')
228
269
  lock = resolver.resolve(spec, changes.analyze)
229
- lock.should be_correct
230
- lock.manifests.map{|m| m.name}.should include('butter')
270
+ expect(lock).to be_correct
271
+ expect(lock.manifests.map{|m| m.name}).to include('butter')
231
272
  manifest = lock.manifests.find{|m| m.name == 'butter'}
232
- manifest.should_not be_nil
233
- manifest.source.name.should == 'source-2'
273
+ expect(manifest).to_not be_nil
274
+ expect(manifest.source.name).to eq 'source-2'
234
275
  end
235
276
 
236
277
  end
@@ -247,9 +288,9 @@ module Librarian
247
288
  it "loads the specfile with the __FILE__" do
248
289
  write! specfile_path, "src __FILE__"
249
290
  spec = env.dsl(specfile_path)
250
- spec.sources.should have(1).item
291
+ expect(spec.sources).to have(1).item
251
292
  source = spec.sources.first
252
- source.name.should == specfile_path.to_s
293
+ expect(source.name).to eq specfile_path.to_s
253
294
  end
254
295
 
255
296
  end
@@ -23,18 +23,18 @@ module Librarian
23
23
  dep 'jam'
24
24
  end
25
25
  lock = resolver.resolve(spec)
26
- lock.should be_correct
26
+ expect(lock).to be_correct
27
27
 
28
28
  spec = env.dsl do
29
29
  src 'source-1'
30
30
  dep 'jam'
31
31
  end
32
32
  changes = described_class.new(env, spec, lock)
33
- changes.should_not be_same
33
+ expect(changes).to_not be_same
34
34
 
35
35
  manifests = ManifestSet.new(changes.analyze).to_hash
36
- manifests.should have_key('jam')
37
- manifests.should_not have_key('butter')
36
+ expect(manifests).to have_key('jam')
37
+ expect(manifests).to_not have_key('butter')
38
38
  end
39
39
 
40
40
  end
@@ -53,7 +53,7 @@ module Librarian
53
53
  dep 'jam'
54
54
  end
55
55
  lock = resolver.resolve(spec)
56
- lock.should be_correct
56
+ expect(lock).to be_correct
57
57
 
58
58
  spec = env.dsl do
59
59
  src 'source-1'
@@ -61,10 +61,10 @@ module Librarian
61
61
  dep 'jam'
62
62
  end
63
63
  changes = described_class.new(env, spec, lock)
64
- changes.should_not be_same
64
+ expect(changes).to_not be_same
65
65
  manifests = ManifestSet.new(changes.analyze).to_hash
66
- manifests.should have_key('jam')
67
- manifests.should_not have_key('butter')
66
+ expect(manifests).to have_key('jam')
67
+ expect(manifests).to_not have_key('butter')
68
68
  end
69
69
 
70
70
  end
@@ -87,7 +87,7 @@ module Librarian
87
87
  dep 'jam', '= 1.1'
88
88
  end
89
89
  lock = resolver.resolve(spec)
90
- lock.should be_correct
90
+ expect(lock).to be_correct
91
91
 
92
92
  spec = env.dsl do
93
93
  src 'source-1'
@@ -95,10 +95,10 @@ module Librarian
95
95
  dep 'jam', '>= 1.0'
96
96
  end
97
97
  changes = described_class.new(env, spec, lock)
98
- changes.should_not be_same
98
+ expect(changes).to_not be_same
99
99
  manifests = ManifestSet.new(changes.analyze).to_hash
100
- manifests.should have_key('butter')
101
- manifests.should have_key('jam')
100
+ expect(manifests).to have_key('butter')
101
+ expect(manifests).to have_key('jam')
102
102
  end
103
103
 
104
104
  end
@@ -119,7 +119,7 @@ module Librarian
119
119
  dep 'jam', '= 1.0'
120
120
  end
121
121
  lock = resolver.resolve(spec)
122
- lock.should be_correct
122
+ expect(lock).to be_correct
123
123
 
124
124
  spec = env.dsl do
125
125
  src 'source-1'
@@ -127,10 +127,10 @@ module Librarian
127
127
  dep 'jam', '>= 1.1'
128
128
  end
129
129
  changes = described_class.new(env, spec, lock)
130
- changes.should_not be_same
130
+ expect(changes).to_not be_same
131
131
  manifests = ManifestSet.new(changes.analyze).to_hash
132
- manifests.should have_key('butter')
133
- manifests.should_not have_key('jam')
132
+ expect(manifests).to have_key('butter')
133
+ expect(manifests).to_not have_key('jam')
134
134
  end
135
135
 
136
136
  end
@@ -152,16 +152,16 @@ module Librarian
152
152
  dep 'butter'
153
153
  end
154
154
  lock = resolver.resolve(spec)
155
- lock.should be_correct
155
+ expect(lock).to be_correct
156
156
 
157
157
  spec = env.dsl do
158
158
  src 'source-1'
159
159
  dep 'butter', :src => 'source-2'
160
160
  end
161
161
  changes = described_class.new(env, spec, lock)
162
- changes.should_not be_same
162
+ expect(changes).to_not be_same
163
163
  manifests = ManifestSet.new(changes.analyze).to_hash
164
- manifests.should_not have_key('butter')
164
+ expect(manifests).to_not have_key('butter')
165
165
  end
166
166
  end
167
167
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Feldblum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-17 00:00:00.000000000 Z
11
+ date: 2014-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -109,6 +109,7 @@ files:
109
109
  - LICENSE.txt
110
110
  - README.md
111
111
  - Rakefile
112
+ - VERSION
112
113
  - lib/librarian.rb
113
114
  - lib/librarian/action.rb
114
115
  - lib/librarian/action/base.rb
@@ -118,6 +119,7 @@ files:
118
119
  - lib/librarian/action/persist_resolution_mixin.rb
119
120
  - lib/librarian/action/resolve.rb
120
121
  - lib/librarian/action/update.rb
122
+ - lib/librarian/algorithms.rb
121
123
  - lib/librarian/cli.rb
122
124
  - lib/librarian/cli/manifest_presenter.rb
123
125
  - lib/librarian/config.rb
@@ -130,6 +132,7 @@ files:
130
132
  - lib/librarian/dsl/receiver.rb
131
133
  - lib/librarian/dsl/target.rb
132
134
  - lib/librarian/environment.rb
135
+ - lib/librarian/environment/runtime_cache.rb
133
136
  - lib/librarian/error.rb
134
137
  - lib/librarian/helpers.rb
135
138
  - lib/librarian/linter/source_linter.rb
@@ -172,17 +175,22 @@ files:
172
175
  - spec/functional/source/git_spec.rb
173
176
  - spec/support/fakefs.rb
174
177
  - spec/support/method_patch_macro.rb
178
+ - spec/support/project_path_macro.rb
175
179
  - spec/support/with_env_macro.rb
176
180
  - spec/unit/action/base_spec.rb
177
181
  - spec/unit/action/clean_spec.rb
178
182
  - spec/unit/action/ensure_spec.rb
179
183
  - spec/unit/action/install_spec.rb
184
+ - spec/unit/algorithms_spec.rb
180
185
  - spec/unit/config/database_spec.rb
186
+ - spec/unit/dependency/requirement_spec.rb
181
187
  - spec/unit/dependency_spec.rb
182
188
  - spec/unit/dsl_spec.rb
189
+ - spec/unit/environment/runtime_cache_spec.rb
183
190
  - spec/unit/environment_spec.rb
184
191
  - spec/unit/lockfile/parser_spec.rb
185
192
  - spec/unit/lockfile_spec.rb
193
+ - spec/unit/manifest/version_spec.rb
186
194
  - spec/unit/manifest_set_spec.rb
187
195
  - spec/unit/manifest_spec.rb
188
196
  - spec/unit/mock/environment_spec.rb
@@ -190,8 +198,9 @@ files:
190
198
  - spec/unit/resolver_spec.rb
191
199
  - spec/unit/source/git_spec.rb
192
200
  - spec/unit/spec_change_set_spec.rb
193
- homepage: ''
194
- licenses: []
201
+ homepage: https://github.com/applicationsonline/librarian
202
+ licenses:
203
+ - MIT
195
204
  metadata: {}
196
205
  post_install_message:
197
206
  rdoc_options: []
@@ -209,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
218
  version: '0'
210
219
  requirements: []
211
220
  rubyforge_project:
212
- rubygems_version: 2.0.3
221
+ rubygems_version: 2.1.3
213
222
  signing_key:
214
223
  specification_version: 4
215
224
  summary: A Framework for Bundlers.
@@ -220,17 +229,22 @@ test_files:
220
229
  - spec/functional/source/git_spec.rb
221
230
  - spec/support/fakefs.rb
222
231
  - spec/support/method_patch_macro.rb
232
+ - spec/support/project_path_macro.rb
223
233
  - spec/support/with_env_macro.rb
224
234
  - spec/unit/action/base_spec.rb
225
235
  - spec/unit/action/clean_spec.rb
226
236
  - spec/unit/action/ensure_spec.rb
227
237
  - spec/unit/action/install_spec.rb
238
+ - spec/unit/algorithms_spec.rb
228
239
  - spec/unit/config/database_spec.rb
240
+ - spec/unit/dependency/requirement_spec.rb
229
241
  - spec/unit/dependency_spec.rb
230
242
  - spec/unit/dsl_spec.rb
243
+ - spec/unit/environment/runtime_cache_spec.rb
231
244
  - spec/unit/environment_spec.rb
232
245
  - spec/unit/lockfile/parser_spec.rb
233
246
  - spec/unit/lockfile_spec.rb
247
+ - spec/unit/manifest/version_spec.rb
234
248
  - spec/unit/manifest_set_spec.rb
235
249
  - spec/unit/manifest_spec.rb
236
250
  - spec/unit/mock/environment_spec.rb