librarian 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/librarian/action/update.rb +3 -3
- data/lib/librarian/resolver.rb +25 -6
- data/lib/librarian/resolver/implementation.rb +12 -7
- data/lib/librarian/version.rb +1 -1
- metadata +20 -20
data/CHANGELOG.md
CHANGED
@@ -13,10 +13,10 @@ module Librarian
|
|
13
13
|
raise Error, "Lockfile missing!"
|
14
14
|
end
|
15
15
|
previous_resolution = lockfile.load(lockfile_path.read)
|
16
|
-
partial_manifests = ManifestSet.deep_strip(previous_resolution.manifests, dependency_names)
|
17
16
|
spec = specfile.read(previous_resolution.sources)
|
18
|
-
|
19
|
-
|
17
|
+
changes = spec_change_set(spec, previous_resolution)
|
18
|
+
manifests = changes.same? ? previous_resolution.manifests : changes.analyze
|
19
|
+
partial_manifests = ManifestSet.deep_strip(manifests, dependency_names)
|
20
20
|
unpinnable_sources = previous_resolution.sources - partial_manifests.map(&:source)
|
21
21
|
unpinnable_sources.each(&:unpin!)
|
22
22
|
resolution = resolver.resolve(spec, partial_manifests)
|
data/lib/librarian/resolver.rb
CHANGED
@@ -17,22 +17,41 @@ module Librarian
|
|
17
17
|
implementation = Implementation.new(self, spec)
|
18
18
|
partial_manifests_index = Hash[partial_manifests.map{|m| [m.name, m]}]
|
19
19
|
manifests = implementation.resolve(spec.dependencies, partial_manifests_index)
|
20
|
-
enforce_consistency!(manifests) if manifests
|
20
|
+
enforce_consistency!(spec.dependencies, manifests) if manifests
|
21
21
|
manifests = sort(manifests) if manifests
|
22
22
|
Resolution.new(spec.dependencies, manifests)
|
23
23
|
end
|
24
24
|
|
25
|
-
def enforce_consistency!(manifests)
|
26
|
-
return if
|
25
|
+
def enforce_consistency!(dependencies, manifests)
|
26
|
+
return if dependencies.all?{|d|
|
27
|
+
m = manifests[d.name]
|
28
|
+
m && d.satisfied_by?(m)
|
29
|
+
} && ManifestSet.new(manifests).consistent?
|
27
30
|
|
28
31
|
debug { "Resolver Malfunctioned!" }
|
32
|
+
errors = []
|
33
|
+
dependencies.sort_by(&:name).each do |d|
|
34
|
+
m = manifests[d.name]
|
35
|
+
if !m
|
36
|
+
errors << ["Depends on #{d}", "Missing!"]
|
37
|
+
elsif !d.satisfied_by?(m)
|
38
|
+
errors << ["Depends on #{d}", "Found: #{m}"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
unless errors.empty?
|
42
|
+
errors.each do |a, b|
|
43
|
+
debug { " #{a}" }
|
44
|
+
debug { " #{b}" }
|
45
|
+
end
|
46
|
+
end
|
29
47
|
manifests.values.sort_by(&:name).each do |manifest|
|
30
48
|
errors = []
|
31
49
|
manifest.dependencies.sort_by(&:name).each do |d|
|
32
|
-
|
50
|
+
m = manifests[d.name]
|
51
|
+
if !m
|
33
52
|
errors << ["Depends on: #{d}", "Missing!"]
|
34
|
-
elsif !
|
35
|
-
errors << ["Depends on: #{d}", "Found: #{
|
53
|
+
elsif !d.satisfied_by?(m)
|
54
|
+
errors << ["Depends on: #{d}", "Found: #{m}"]
|
36
55
|
end
|
37
56
|
end
|
38
57
|
unless errors.empty?
|
@@ -18,10 +18,20 @@ module Librarian
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def resolve(dependencies, manifests = {})
|
21
|
-
|
21
|
+
dependencies += manifests.values.flat_map { |m|
|
22
|
+
m.dependencies.map { |d| sourced_dependency_for(d) }
|
23
|
+
}
|
24
|
+
resolution = recursive_resolve([], manifests, dependencies)
|
22
25
|
resolution ? resolution[1] : nil
|
23
26
|
end
|
24
27
|
|
28
|
+
def sourced_dependency_for(dependency)
|
29
|
+
return dependency if dependency.source
|
30
|
+
|
31
|
+
s = dependency_source_map[dependency.name] || source
|
32
|
+
Dependency.new(dependency.name, dependency.requirement, s)
|
33
|
+
end
|
34
|
+
|
25
35
|
def recursive_resolve(dependencies, manifests, queue)
|
26
36
|
if dependencies.empty?
|
27
37
|
queue.each do |dependency|
|
@@ -58,12 +68,7 @@ module Librarian
|
|
58
68
|
scope do
|
59
69
|
if related_dependencies.all?{|d| d.satisfied_by?(manifest)}
|
60
70
|
m = manifests.merge(dependency.name => manifest)
|
61
|
-
a = manifest.dependencies.map { |d|
|
62
|
-
d.source ? d :
|
63
|
-
!dependency_source_map.key?(d.name) ?
|
64
|
-
Dependency.new(d.name, d.requirement, source) :
|
65
|
-
Dependency.new(d.name, d.requirement, dependency_source_map[d.name])
|
66
|
-
}
|
71
|
+
a = manifest.dependencies.map { |d| sourced_dependency_for(d) }
|
67
72
|
a.each do |d|
|
68
73
|
debug { "Scheduling #{d}" }
|
69
74
|
end
|
data/lib/librarian/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.18
|
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: 2012-04-
|
12
|
+
date: 2012-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &7834440 !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: *
|
24
|
+
version_requirements: *7834440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &7834020 !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: *
|
35
|
+
version_requirements: *7834020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &7833580 !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: *
|
46
|
+
version_requirements: *7833580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &7833160 !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: *
|
57
|
+
version_requirements: *7833160
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: aruba
|
60
|
-
requirement: &
|
60
|
+
requirement: &7832740 !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: *
|
68
|
+
version_requirements: *7832740
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
|
-
requirement: &
|
71
|
+
requirement: &7832280 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *7832280
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: chef
|
82
|
-
requirement: &
|
82
|
+
requirement: &7831760 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0.10'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *7831760
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: highline
|
93
|
-
requirement: &
|
93
|
+
requirement: &7864260 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *7864260
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: archive-tar-minitar
|
104
|
-
requirement: &
|
104
|
+
requirement: &7863700 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 0.5.2
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *7863700
|
113
113
|
description: Librarian
|
114
114
|
email:
|
115
115
|
- y_feldblum@yahoo.com
|