gemverse 0.0.1 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +26 -10
- data/Rakefile +8 -1
- data/lib/gemverse/timeline.rb +100 -17
- 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: fc5e183ec26ff8c35abfc0b6ed6e5bc9601dd8da9ae34fb9d7d12707145481a2
|
4
|
+
data.tar.gz: 56f2a4bb1b6ed29296fde5660cc7848babbd01b629794b00449769af27556180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40617aa75c1023d6a0ea8ac96985e2181115c24dd7ebed6d78b8d73cb9629c67f1f0f1a35682d9f17afec77efc9ff1205d92e2d70ab2bf672fe70c62d0d0a9aa
|
7
|
+
data.tar.gz: 75b0cd17afeeca3b83a5fc398c4896a644d07d033f01c128d117aa5ef539a50621197b047549ba7bc2356ecf44f4d3b3712718bcdee3f6adffdd09847de91e2d
|
data/README.md
CHANGED
@@ -26,12 +26,16 @@ that returns data(sets) in the JSON format:
|
|
26
26
|
require 'gemverse'
|
27
27
|
|
28
28
|
## get all gems owned by the author with the handle / known as gettalong
|
29
|
+
# same as https://rubygems.org/api/v1/owners/gettalong/gems.json
|
29
30
|
data = Gems::API.gems_by( 'gettalong' )
|
30
|
-
#
|
31
|
+
puts " #{data.size} record(s)"
|
32
|
+
#=> 24 record(s)
|
31
33
|
|
32
34
|
## get all versions of the hexapdf gem
|
35
|
+
# same as https://rubygems.org/api/v1/versions/hexpdf.json"
|
33
36
|
data = Gems::API.versions( 'hexapdf' )
|
34
|
-
#
|
37
|
+
puts " #{data.size} record(s)"
|
38
|
+
#=> 71 record(s)
|
35
39
|
|
36
40
|
#...
|
37
41
|
```
|
@@ -53,9 +57,10 @@ cache = Gems::Cache.new( './cache' )
|
|
53
57
|
|
54
58
|
gems = Gems.find_by( owner: 'gettalong' )
|
55
59
|
puts " #{gems.size} record(s)"
|
60
|
+
#=> 24 record(s)
|
56
61
|
|
57
62
|
## bonus: save gems in a "flat" tabular datafile using the comma-separated values (.csv) format
|
58
|
-
gems.export( './
|
63
|
+
gems.export( './profiles/gettalong/gems.csv' )
|
59
64
|
|
60
65
|
## fetch all gem versions and (auto-save)
|
61
66
|
## in a "flat" tabular datafile (e.g. <gem>/versions.csv)
|
@@ -70,15 +75,17 @@ cache.update_versions( gems: gems )
|
|
70
75
|
``` ruby
|
71
76
|
cache = Gems::Cache.new( './gems' )
|
72
77
|
|
73
|
-
gems = read_csv( './
|
78
|
+
gems = read_csv( './profiles/gettalong/gems.csv' )
|
74
79
|
puts " #{gems.size} record(s)"
|
80
|
+
#=> 24 record(s)
|
75
81
|
|
76
82
|
versions = cache.read_versions( gems: gems )
|
77
83
|
puts " #{versions.size} record(s)"
|
84
|
+
#=> 238 record(s)
|
78
85
|
|
79
86
|
timeline = Gems::Timeline.new( versions,
|
80
87
|
title: "Thomas Leitner's Timeline" )
|
81
|
-
timeline.save( "./
|
88
|
+
timeline.save( "./profiles/gettalong/README.md" )
|
82
89
|
```
|
83
90
|
|
84
91
|
|
@@ -94,7 +101,7 @@ gems.
|
|
94
101
|
``` ruby
|
95
102
|
cache = Gems::Cache.new( './cache' )
|
96
103
|
|
97
|
-
gems = read_csv( './
|
104
|
+
gems = read_csv( './collections/cocos.csv' )
|
98
105
|
puts " #{gems.size} record(s)"
|
99
106
|
|
100
107
|
versions = cache.read_versions( gems: gems )
|
@@ -102,18 +109,27 @@ puts " #{versions.size} record(s)"
|
|
102
109
|
|
103
110
|
timeline = Gems::Timeline.new( versions,
|
104
111
|
title: 'Ruby Code Commons (COCOS) Timeline' )
|
105
|
-
timeline.save( "./
|
112
|
+
timeline.save( "./collections/cocos/README.md" )
|
106
113
|
```
|
107
114
|
|
108
115
|
That's it.
|
109
116
|
|
110
117
|
|
118
|
+
|
111
119
|
See
|
112
|
-
[Thomas Leitner's Timeline](
|
113
|
-
[Jan Lelis's Timeline](
|
114
|
-
[Ruby Code Commons (COCOS) Timeline](
|
120
|
+
[Thomas Leitner's Timeline](https://github.com/rubycocos/gems/tree/master/profiles/gettalong),
|
121
|
+
[Jan Lelis's Timeline](https://github.com/rubycocos/gems/tree/master/profiles/janlelis),
|
122
|
+
[Ruby Code Commons (COCOS) Timeline](https://github.com/rubycocos/gems/tree/master/collections/cocos), and some more
|
115
123
|
for some real-world timeline samples.
|
116
124
|
|
125
|
+
Or the [Gerald Bauer's Gem Timeline (By Week) - 244 Gems, 1652 Updates](https://geraldb.github.io/gems/) page.
|
126
|
+
|
127
|
+
Or the gems leaderboard at the [Vienna.rb / Wien.rb - Ruby Meetup / Stammtisch in Vienna, Austria](https://viennarb.github.io/) page.
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
Yes, you can. [Tell us about your gem timeline / leaderboard sample(s) »](https://github.com/rubycocos/git/issues).
|
132
|
+
|
117
133
|
|
118
134
|
|
119
135
|
## License
|
data/Rakefile
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
require 'hoe'
|
2
2
|
|
3
|
+
###
|
4
|
+
# hack/ quick fix for broken intuit_values - overwrite with dummy
|
5
|
+
class Hoe
|
6
|
+
def intuit_values( input ); end
|
7
|
+
end
|
8
|
+
|
9
|
+
|
3
10
|
Hoe.spec 'gemverse' do
|
4
11
|
|
5
|
-
self.version = '0.
|
12
|
+
self.version = '0.1.1' # note: for now add version inline
|
6
13
|
|
7
14
|
self.summary = "gemverse gem - gem universe incl. rubygems API V1 wrapper lite; gem version cache, gem timeline reports, 'n' more"
|
8
15
|
self.description = summary
|
data/lib/gemverse/timeline.rb
CHANGED
@@ -13,40 +13,68 @@ class Timeline
|
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
-
def save( path )
|
17
|
-
buf =
|
16
|
+
def save( path, title: nil )
|
17
|
+
buf = build_by_month( title: title )
|
18
18
|
write_text( path, buf )
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
model = {}
|
26
|
-
|
27
|
-
@versions.each do |rec|
|
22
|
+
def _gems_by_month
|
23
|
+
model = {}
|
24
|
+
@versions.each do |rec|
|
28
25
|
|
29
26
|
date = Date.strptime( rec['created'], '%Y-%m-%d' )
|
30
|
-
year
|
31
|
-
|
27
|
+
year = date.year.to_s
|
28
|
+
month = date.strftime('%m') ## note: return zero-padded string e.g. 01, 02, etc.
|
32
29
|
|
33
|
-
by_year
|
34
|
-
|
35
|
-
|
30
|
+
by_year = model[ year ] ||= {}
|
31
|
+
by_month = by_year[ month ] ||= { 'new' => [],
|
32
|
+
'updated' => [] }
|
36
33
|
|
37
34
|
if rec['count'].to_i == 1
|
38
|
-
|
35
|
+
by_month[ 'new' ] << rec
|
39
36
|
else
|
40
|
-
|
37
|
+
by_month[ 'updated' ] << rec
|
41
38
|
end
|
42
39
|
end
|
40
|
+
model
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def _gems_by_week
|
45
|
+
model = {}
|
46
|
+
@versions.each do |rec|
|
47
|
+
|
48
|
+
date = Date.strptime( rec['created'], '%Y-%m-%d' )
|
49
|
+
year = date.year.to_s
|
50
|
+
week = date.strftime('%V') ## note: return zero-padded string e.g. 01, 02, etc.
|
51
|
+
|
52
|
+
by_year = model[ year ] ||= {}
|
53
|
+
by_week = by_year[ week ] ||= { 'new' => [],
|
54
|
+
'updated' => [] }
|
55
|
+
|
56
|
+
if rec['count'].to_i == 1
|
57
|
+
by_week[ 'new' ] << rec
|
58
|
+
else
|
59
|
+
by_week[ 'updated' ] << rec
|
60
|
+
end
|
61
|
+
end
|
62
|
+
model
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def build_by_week( title: 'Timeline' )
|
68
|
+
## step 1 - build document model - versions by year & week
|
69
|
+
## and split into new & update
|
70
|
+
model = _gems_by_week
|
43
71
|
|
44
72
|
## pp model
|
45
73
|
|
46
74
|
## step 2 - build document
|
47
75
|
|
48
76
|
buf = String.new
|
49
|
-
buf << "#
|
77
|
+
buf << "# #{title} \n\n"
|
50
78
|
|
51
79
|
## add breadcrumps for years
|
52
80
|
buf << model.keys.map do |year|
|
@@ -85,7 +113,62 @@ class Timeline
|
|
85
113
|
end
|
86
114
|
|
87
115
|
buf
|
88
|
-
end # method
|
116
|
+
end # method build_by_week
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
def build_by_month( title: 'Timeline' )
|
121
|
+
## step 1 - build document model - versions by year & month
|
122
|
+
## and split into new & update
|
123
|
+
model = _gems_by_month
|
124
|
+
|
125
|
+
## pp model
|
126
|
+
|
127
|
+
## step 2 - build document
|
128
|
+
|
129
|
+
buf = String.new
|
130
|
+
buf << "# #{title} \n\n"
|
131
|
+
|
132
|
+
## add breadcrumps for years
|
133
|
+
buf << model.keys.map do |year|
|
134
|
+
"[#{year}](##{year})"
|
135
|
+
end.join( ' · ' )
|
136
|
+
buf << "\n\n"
|
137
|
+
|
138
|
+
## add new gems by year
|
139
|
+
buf << "## New Gems By Year\n\n"
|
140
|
+
|
141
|
+
model.each do |year, by_month|
|
142
|
+
## get totals for year
|
143
|
+
gems_new = by_month.values.reduce( [] ) do |acc,gems|
|
144
|
+
acc + gems['new']
|
145
|
+
end
|
146
|
+
|
147
|
+
buf << "**#{year}** - "
|
148
|
+
|
149
|
+
buf << if gems_new.size > 0
|
150
|
+
_build_gems_new( gems_new )
|
151
|
+
else
|
152
|
+
"Ø \n\n"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
model.each do |year, by_month|
|
158
|
+
buf << "## #{year}\n\n"
|
159
|
+
|
160
|
+
by_month.each do |month, gems|
|
161
|
+
buf << "**Month #{month}**\n\n"
|
162
|
+
|
163
|
+
buf << _build_gems_new( gems['new'] )
|
164
|
+
buf << _build_gems_updated( gems['updated'] )
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
buf
|
169
|
+
end # method build_by_month
|
170
|
+
|
171
|
+
|
89
172
|
|
90
173
|
|
91
174
|
def _build_gem( gem )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocos
|