jekyll-theme-open-project-helpers 1.1.18 → 1.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e94e9578079e076159fd2905b0a8b02f3e89540165bb6edc5d0da40a9ca8eab
4
- data.tar.gz: c5cd6a5db1e4b53d72fbcdc274a985d82a8695b37c679579bad0e63c9a913304
3
+ metadata.gz: 4b9aa6d67929c506280237ffe2f2118aa30da9f29aedc28507638b745123ef74
4
+ data.tar.gz: e02c812945c6b9339d3e8eec80c8cc43ae59b16e724d18e58a97dc063098499e
5
5
  SHA512:
6
- metadata.gz: 3f435c3ca9cd63f0fd55aee1c0375d660f5788b7ae8393e1d916a9327e4265f46e47ab9525ab3453b06123ff17ce7847b3b7beeff8f4dbf69898994759cbb1e7
7
- data.tar.gz: 6ba555f2d382ebab91ea65ecc7767b1446158dcfa48cd360627e6ea82d3b72b22ab09a9d1c65d89ed13895ff1f7ed2f01c63126bfc162a400c9a90a038887bc0
6
+ metadata.gz: 54a51c476e2fa31a58b6e8ebcf1f257fb2db6bfd62df2c1dc9ce4d9ba084ea650d01d57e564f22088f34d184513420f5ea096ab9fcfed55398b37c0a9251c6af
7
+ data.tar.gz: 41c04f526c9ca99710305853d4ebcfc0ca63a0f75c4ad02a5907724147c08e7459cffcc3c050f04e784048695c7bf4761fc6979c3331aae715cae938d94af2eb
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-theme-open-project-helpers'
5
- s.version = '1.1.18'
5
+ s.version = '1.1.19'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -45,7 +45,7 @@ module Jekyll
45
45
  def generate(site)
46
46
  if site.config['is_hub']
47
47
  INDEXES.each do |index_name, params|
48
- items = site.collections['projects'].docs.select { |item| params[:item_test].call(item) }
48
+ items = get_all_items(site, 'projects', params[:item_test])
49
49
 
50
50
  # Creates a data structure like { tag1: [item1, item2], tag2: [item2, item3] }
51
51
  tags = {}
@@ -100,19 +100,7 @@ module Jekyll
100
100
  # Filters items from given collection_name through item_test function
101
101
  # and makes items available in templates via e.g. site.all_specs, site.all_software
102
102
 
103
- items = site.collections[collection_name].docs.select { |item| params[:item_test].call(item) }
104
-
105
- if site.config['is_hub']
106
- items.map! do |item|
107
- project_name = item.url.split('/')[2]
108
- project_path = "_projects/#{project_name}/index.md"
109
-
110
- item.data[:project_name] = project_name
111
- item.data[:project_data] = site.collections['projects'].docs.select { |proj| proj.path.end_with? project_path } [0]
112
-
113
- item
114
- end
115
- end
103
+ items = get_all_items(site, collection_name, params[:item_test])
116
104
 
117
105
  site.config["all_#{index_name}"] = items
118
106
  site.config["num_all_#{index_name}"] = items.size
@@ -131,3 +119,32 @@ module Jekyll
131
119
 
132
120
  end
133
121
  end
122
+
123
+
124
+ def get_all_items(site, collection_name, filter_func)
125
+ # Fetches items of specified type, ordered and prepared for usage in index templates
126
+
127
+ items = site.collections[collection_name].docs.select { |item|
128
+ filter_func.call(item)
129
+ }
130
+
131
+ items.sort! { |i1, i2|
132
+ (i2.data['last_update'] <=> i1.data['last_update']) || 0
133
+ }
134
+
135
+ if site.config['is_hub']
136
+ items.map! do |item|
137
+ project_name = item.url.split('/')[2]
138
+ project_path = "_projects/#{project_name}/index.md"
139
+
140
+ item.data[:project_name] = project_name
141
+ item.data[:project_data] = site.collections['projects'].docs.select {
142
+ |proj| proj.path.end_with? project_path
143
+ } [0]
144
+
145
+ item
146
+ end
147
+ end
148
+
149
+ return items
150
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-open-project-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.18
4
+ version: 1.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll