gemverse 0.1.0 → 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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/Rakefile +1 -1
  4. data/lib/gemverse/timeline.rb +100 -17
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e6c2a3321aeeb1ae6783bed78fbfc251668f715d1871cd47a49693eab989057
4
- data.tar.gz: 5a5d671a07889133eefa3c7b86b343eb1b38eaa39677d0b46bc36e180b9b0c96
3
+ metadata.gz: fc5e183ec26ff8c35abfc0b6ed6e5bc9601dd8da9ae34fb9d7d12707145481a2
4
+ data.tar.gz: 56f2a4bb1b6ed29296fde5660cc7848babbd01b629794b00449769af27556180
5
5
  SHA512:
6
- metadata.gz: 4aaf56133d88528f9bed3c7c71a1b8bff3fd527227980f5e5f86e0be8cb766f705f393899542daaf72dbc487d72ddbae646f98e5bbc3e337e42540de09d9b3a1
7
- data.tar.gz: 262cbc3bb0793bbe6efdaed209db0abe8db15d21d413de1bc2af368eac71b9dcbb113e20920457dc1babb3784fb776ca8c1a5f05f2bf7c68beb99a6d8e6c3cdc
6
+ metadata.gz: 40617aa75c1023d6a0ea8ac96985e2181115c24dd7ebed6d78b8d73cb9629c67f1f0f1a35682d9f17afec77efc9ff1205d92e2d70ab2bf672fe70c62d0d0a9aa
7
+ data.tar.gz: 75b0cd17afeeca3b83a5fc398c4896a644d07d033f01c128d117aa5ef539a50621197b047549ba7bc2356ecf44f4d3b3712718bcdee3f6adffdd09847de91e2d
data/README.md CHANGED
@@ -115,12 +115,21 @@ timeline.save( "./collections/cocos/README.md" )
115
115
  That's it.
116
116
 
117
117
 
118
+
118
119
  See
119
120
  [Thomas Leitner's Timeline](https://github.com/rubycocos/gems/tree/master/profiles/gettalong),
120
121
  [Jan Lelis's Timeline](https://github.com/rubycocos/gems/tree/master/profiles/janlelis),
121
122
  [Ruby Code Commons (COCOS) Timeline](https://github.com/rubycocos/gems/tree/master/collections/cocos), and some more
122
123
  for some real-world timeline samples.
123
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
+
124
133
 
125
134
 
126
135
  ## License
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  Hoe.spec 'gemverse' do
11
11
 
12
- self.version = '0.1.0' # note: for now add version inline
12
+ self.version = '0.1.1' # note: for now add version inline
13
13
 
14
14
  self.summary = "gemverse gem - gem universe incl. rubygems API V1 wrapper lite; gem version cache, gem timeline reports, 'n' more"
15
15
  self.description = summary
@@ -13,40 +13,68 @@ class Timeline
13
13
  end
14
14
 
15
15
 
16
- def save( path )
17
- buf = build
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 build
23
- ## step 1 - build document model - versions by year & week
24
- ## and split into new & update
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 = date.year.to_s
31
- week = date.strftime('%V') ## note: return zero-padded string e.g. 01, 02, etc.
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 = model[ year ] ||= {}
34
- by_week = by_year[ week ] ||= { 'new' => [],
35
- 'updated' => [] }
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
- by_week[ 'new' ] << rec
35
+ by_month[ 'new' ] << rec
39
36
  else
40
- by_week[ 'updated' ] << rec
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 << "# Timeline \n\n"
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 build
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.1.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-20 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos