File tree Expand file tree Collapse file tree 3 files changed +13
-28
lines changed Expand file tree Collapse file tree 3 files changed +13
-28
lines changed Original file line number Diff line number Diff line change @@ -41,23 +41,12 @@ module Shards
41
41
end
42
42
end
43
43
44
- def specs (versions )
45
- specs = {} of String => Spec
46
-
47
- versions.each do |version |
48
- refs = git_refs(version)
49
- yaml = capture(" git show #{ refs } :#{ SPEC_FILENAME } " )
50
- specs[version] = Spec .from_yaml(yaml).tap { |spec | spec.resolver = self }
51
- rescue Error
52
- end
53
-
54
- specs
44
+ def spec (version = nil )
45
+ Spec .from_yaml(read_spec(version)).tap { |spec | spec.resolver = self }
55
46
end
56
47
57
- def spec ?(version)
58
- refs = git_refs(version)
59
- yaml = capture(" git show #{ refs } :#{ SPEC_FILENAME } " )
60
- Spec .from_yaml(yaml)
48
+ private def spec? (version )
49
+ spec(version)
61
50
rescue Error
62
51
end
63
52
Original file line number Diff line number Diff line change @@ -20,13 +20,10 @@ module Shards
20
20
@dependency .path
21
21
end
22
22
23
- def spec ?(version)
24
- spec_path = File .join(local_path, SPEC_FILENAME )
25
-
26
- if File .exists?(spec_path)
27
- Spec .from_yaml(File .read(spec_path))
28
- # TODO: fail if the spec isn't the expected version!
29
- end
23
+ def spec (version = nil )
24
+ spec = Spec .from_yaml(read_spec(version))
25
+ spec.resolver = self
26
+ spec
30
27
end
31
28
32
29
def installed_spec
Original file line number Diff line number Diff line change @@ -11,13 +11,12 @@ module Shards
11
11
def initialize (@dependency )
12
12
end
13
13
14
- def spec (version = nil )
15
- Spec .from_yaml(read_spec(version)).tap { |spec | spec.resolver = self }
16
- end
17
-
18
14
def specs (versions )
19
15
specs = {} of String => Spec
20
- versions.each { |version | specs[version] = spec(version) }
16
+ versions.each do |version |
17
+ specs[version] = spec(version)
18
+ rescue Error
19
+ end
21
20
specs
22
21
end
23
22
@@ -35,7 +34,7 @@ module Shards
35
34
end
36
35
37
36
abstract def read_spec (version = nil )
38
- abstract def spec ? (version)
37
+ abstract def spec (version )
39
38
abstract def available_versions
40
39
abstract def install (version = nil )
41
40
abstract def installed_commit_hash
You can’t perform that action at this time.
0 commit comments