compact_index 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/compact_index.rb +2 -11
- data/lib/compact_index/version.rb +1 -1
- data/lib/compact_index/versions_file.rb +28 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64d44d1fea23ce0a76b7845acc0014b8ca8aec7
|
4
|
+
data.tar.gz: 51b9ae7960a546363e9d78327467f7a8b482ab68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aee9ae1d0b33076d8e6109cef53eee7c2e4e805007114f446b50736c9cfd4f3877fd2dbd27dcb1096294b771a90386ea2a6d20a3a39f35a18d0d267d2cd01ae
|
7
|
+
data.tar.gz: 434971c492a216938303c67a16cdb399a49aed8232065c6f93640830bf2e86e842debca4a3dffc51cf4f5431fb9b5ace7104c49db004ca67d0bff597e5ccf4c9
|
data/CHANGELOG.md
CHANGED
data/lib/compact_index.rb
CHANGED
@@ -12,16 +12,7 @@ module CompactIndex
|
|
12
12
|
|
13
13
|
def self.info(params)
|
14
14
|
output = "---\n"
|
15
|
-
|
16
|
-
if a[:created_at] and b[:created_at]
|
17
|
-
a[:created_at] <=> b[:created_at]
|
18
|
-
elsif a[:created_at]
|
19
|
-
-1
|
20
|
-
else
|
21
|
-
1
|
22
|
-
end
|
23
|
-
end
|
24
|
-
sorted.each do |version|
|
15
|
+
params.each do |version|
|
25
16
|
output << version_line(version) << "\n"
|
26
17
|
end
|
27
18
|
output
|
@@ -30,7 +21,7 @@ module CompactIndex
|
|
30
21
|
private
|
31
22
|
def self.version_line(version)
|
32
23
|
if version[:dependencies]
|
33
|
-
version[:dependencies]
|
24
|
+
version[:dependencies]
|
34
25
|
deps = version[:dependencies].map do |d|
|
35
26
|
[
|
36
27
|
d[:gem],
|
@@ -48,50 +48,46 @@ class CompactIndex::VersionsFile
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def parse_gems_for_create(gems)
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
# Join all versions for each gem in one hash
|
52
|
+
gems_hash = {}
|
53
|
+
gems.each do |entry|
|
54
|
+
gems_hash[entry[:name]] ||= []
|
55
|
+
gems_hash[entry[:name]] += entry[:versions]
|
54
56
|
end
|
55
|
-
fixed_format_gems.sort! { |a,b| a[:name] <=> b[:name] }
|
56
|
-
gem_lines(fixed_format_gems)
|
57
|
-
end
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
# Transform hash in a list of line informations to be printed
|
59
|
+
gems = gems_hash.map do |gem, versions|
|
60
|
+
{ name: gem, versions: versions, checksum: versions.first[:checksum] }
|
61
|
+
end
|
62
|
+
|
63
|
+
# Sort gems by name and versions by number
|
64
|
+
gems.sort! { |a,b| a[:name] <=> b[:name] }
|
65
|
+
gems.each do |entry|
|
66
|
+
entry[:versions].sort_by! { |v| Gem::Version.create(v[:number]) }
|
67
|
+
end
|
68
|
+
|
69
|
+
gem_lines(gems)
|
62
70
|
end
|
63
71
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
by_created_at[v[:created_at]][name] << [v[:number], v[:platform]]
|
72
|
-
checksums[v[:created_at]] ||= {}
|
73
|
-
checksums[v[:created_at]] = v[:checksum]
|
74
|
-
end
|
72
|
+
def parse_gems(gems)
|
73
|
+
gem_lines = gems.map do |entry|
|
74
|
+
{
|
75
|
+
name: entry[:name],
|
76
|
+
versions: entry[:versions],
|
77
|
+
checksum: entry[:versions].first[:checksum]
|
78
|
+
}
|
75
79
|
end
|
76
|
-
|
77
|
-
gems.map do |name, versions|
|
78
|
-
{ name: name, versions: versions, checksum: checksums[created_at] }
|
79
|
-
end
|
80
|
-
end.flatten
|
80
|
+
gem_lines(gem_lines)
|
81
81
|
end
|
82
82
|
|
83
83
|
def gem_lines(gems)
|
84
84
|
gems.reduce("") do |concat, entry|
|
85
|
-
versions =
|
86
|
-
versions.map
|
87
|
-
concat << "#{entry[:name]} #{
|
85
|
+
versions = entry[:versions]
|
86
|
+
number_and_plat = versions.map { |version| number_and_platform(version[:number], version[:platform]) }
|
87
|
+
concat << "#{entry[:name]} #{number_and_plat.join(',')} #{entry[:checksum]}\n"
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
def sort_versions(versions)
|
92
|
-
versions.sort_by { |v| Gem::Version.create(v.first) }
|
93
|
-
end
|
94
|
-
|
95
91
|
def number_and_platform(number, platform)
|
96
92
|
if platform.nil? || platform == 'ruby'
|
97
93
|
number
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compact_index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fotanus@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|