whatthegem 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/whatthegem/changes/releases_parser.rb +2 -1
- data/lib/whatthegem/gem/rubygems.rb +5 -1
- data/lib/whatthegem/i.rb +1 -1
- data/lib/whatthegem/info.rb +13 -4
- data/lib/whatthegem/stats/definitions.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e42042e156dc134be8400ca0a1cd3473b4129125618bce15f4b83be628ae8d4b
|
4
|
+
data.tar.gz: 39a4c8d52e4d340b2f76fa54714b764585b8ea487a27972d35878bdfb79b956e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b66a20180176b7b227c91f58133e966caab4dc2fe274849b2a29a5cd2c79a755560b5196dc706f7385ab39ea55269d9875bae7695342f615ccd6467ace0286a0
|
7
|
+
data.tar.gz: 3cc55b4c3a85502f9774fe0acd92a18922ee652c7099adff8c89f3e067161fbc8cff9ea8a6646041cacf93b4d9293b3c23be58d906c21a25f30a7c7e1f486c19
|
@@ -14,7 +14,8 @@ module WhatTheGem
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def versions
|
17
|
-
releases.map { |
|
17
|
+
releases.map { |rel|
|
18
|
+
tag_name, name, body = rel.fetch_values(:tag_name, :name, :body)
|
18
19
|
Version.new(
|
19
20
|
number: tag_name[VERSION_LINE_REGEXP, :version],
|
20
21
|
header: name.then.reject(&:empty?).first || tag_name,
|
@@ -15,6 +15,10 @@ module WhatTheGem
|
|
15
15
|
req(:versions)
|
16
16
|
end
|
17
17
|
|
18
|
+
memoize def stable_versions
|
19
|
+
req(:versions).reject { |v| v[:prerelease] }
|
20
|
+
end
|
21
|
+
|
18
22
|
memoize def reverse_dependencies
|
19
23
|
req(:reverse_dependencies)
|
20
24
|
end
|
@@ -26,4 +30,4 @@ module WhatTheGem
|
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
29
|
-
end
|
33
|
+
end
|
data/lib/whatthegem/i.rb
CHANGED
data/lib/whatthegem/info.rb
CHANGED
@@ -8,6 +8,9 @@ module WhatTheGem
|
|
8
8
|
|
9
9
|
TEMPLATE = Template.parse(<<~INFO)
|
10
10
|
Latest version: {{info.version}} ({{age}})
|
11
|
+
{% if prerelease %}
|
12
|
+
Prerelease: {{prerelease.number}} ({{prerelease.age}})
|
13
|
+
{% endif %}
|
11
14
|
Installed versions: {% if specs %}{{ specs | map:"version" | join: ", "}}{% else %}—{% endif %}
|
12
15
|
{% if current %}
|
13
16
|
Most recent installed at: {{current.dir}}
|
@@ -26,6 +29,7 @@ module WhatTheGem
|
|
26
29
|
{
|
27
30
|
info: gem.rubygems.info,
|
28
31
|
age: age,
|
32
|
+
prerelease: prerelease,
|
29
33
|
specs: specs,
|
30
34
|
current: specs.last,
|
31
35
|
bundled: gem.bundled.to_h,
|
@@ -36,9 +40,14 @@ module WhatTheGem
|
|
36
40
|
private
|
37
41
|
|
38
42
|
def age
|
39
|
-
gem.rubygems.
|
40
|
-
|
41
|
-
|
43
|
+
version = gem.rubygems.stable_versions.first or return
|
44
|
+
version.dig(:created_at).then(&Time.method(:parse)).then(&I.method(:ago_text))
|
45
|
+
end
|
46
|
+
|
47
|
+
def prerelease
|
48
|
+
gem.rubygems.versions.first
|
49
|
+
&.then { |ver| ver if ver[:prerelease] }
|
50
|
+
&.then { |ver| ver.merge(age: I.ago_text(Time.parse(ver[:created_at]))) }
|
42
51
|
end
|
43
52
|
|
44
53
|
def specs
|
@@ -55,4 +64,4 @@ module WhatTheGem
|
|
55
64
|
Command.registry.values.-([self.class]).map(&:meta).map(&:to_h)
|
56
65
|
end
|
57
66
|
end
|
58
|
-
end
|
67
|
+
end
|
@@ -20,7 +20,7 @@ module WhatTheGem
|
|
20
20
|
|
21
21
|
metric 'Downloads', :rubygems, :info, :downloads, thresholds: [5_000, 10_000]
|
22
22
|
metric 'Latest version',
|
23
|
-
:rubygems, :
|
23
|
+
:rubygems, :stable_versions, 0, :created_at,
|
24
24
|
thresholds: [T.now.-(1, :year), T.now.-(2, :months)],
|
25
25
|
&Time.method(:parse)
|
26
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatthegem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|