jekyll-theme-open-project-helpers 1.1.20 → 1.1.21

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: 19fd17a16044f7c76f4363d852d261dcb32018c3e9a50b3ea2b924b874591ba8
4
- data.tar.gz: 4873c2311bbf783bc306d6b8d2fa8ba7f4468a40eeb8fb984180965e72b00562
3
+ metadata.gz: 90b1f3aa02d83e9f800cedd56b72f61fe734764b6474ee4e635b14ebc7faaaa9
4
+ data.tar.gz: 82615472bac6bf0c80fdcf0f28aa915a7505c438acfbb30519f5b86cb959f80c
5
5
  SHA512:
6
- metadata.gz: 3e94caf79ccd3e32da7d5b7e0d554ef379367b92972c2bb600a00704d8957db1249a500b19cf3ddb46c3c82c17fabb1698e2e1d84fc136d296829c988494d27b
7
- data.tar.gz: 86103974786974d9f3cc9af1222cbd199b85c402dbf5d90ef26d15401279aa77a32e4217f6027185fcf86ad482f0b3fd7019b75eef362fe34260aafe244c6466
6
+ metadata.gz: 51f7d2b350597ad6879479eae51beb007bdd5792bf578931930a03f70baa768cc69ddc6cf3590fbacd9e8e742846a073236b63b9974fdc10c3819c13b560c26a
7
+ data.tar.gz: 410dee0831e16d0b1b98bf5c780a46092a41d29b1f3808ba6be55a7aa5fb976ed38b6f917af035b04c96a8c1a5bd8d8e1014dd69f5e8a8df8332f758fcbeeb19
@@ -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.20'
5
+ s.version = '1.1.21'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -43,36 +43,39 @@ module Jekyll
43
43
  safe true
44
44
 
45
45
  def generate(site)
46
- if site.config['is_hub']
47
- INDEXES.each do |index_name, params|
48
- items = get_all_items(site, 'projects', params[:item_test])
49
-
50
- # Creates a data structure like { tag1: [item1, item2], tag2: [item2, item3] }
51
- tags = {}
52
- items.each do |item|
53
- item.data['tags'].each do |tag|
54
- unless tags.key? tag
55
- tags[tag] = []
56
- end
57
- tags[tag].push(item)
46
+ INDEXES.each do |index_name, params|
47
+ if site.config['is_hub']
48
+ collection_name = 'projects'
49
+ else
50
+ collection_name = index_name
51
+ end
52
+
53
+ items = get_all_items(site, collection_name, params[:item_test])
54
+
55
+ # Creates a data structure like { tag1: [item1, item2], tag2: [item2, item3] }
56
+ tags = {}
57
+ items.each do |item|
58
+ item.data['tags'].each do |tag|
59
+ unless tags.key? tag
60
+ tags[tag] = []
58
61
  end
62
+ tags[tag].push(item)
59
63
  end
64
+ end
60
65
 
61
- # Creates a filtered index page for each tag
62
- tags.each do |tag, tagged_items|
63
- site.pages << FilteredIndexPage.new(
64
- site,
65
- site.source,
66
+ # Creates a filtered index page for each tag
67
+ tags.each do |tag, tagged_items|
68
+ site.pages << FilteredIndexPage.new(
69
+ site,
70
+ site.source,
66
71
 
67
- # The filtered page will be nested under /<index page>/<tag>.html
68
- File.join(index_name, tag),
72
+ # The filtered page will be nested under /<index page>/<tag>.html
73
+ File.join(index_name, tag),
69
74
 
70
- tag,
71
- tagged_items,
72
- index_name)
73
- end
75
+ tag,
76
+ tagged_items,
77
+ index_name)
74
78
  end
75
-
76
79
  end
77
80
  end
78
81
  end
@@ -128,8 +131,12 @@ def get_all_items(site, collection_name, filter_func)
128
131
  filter_func.call(item)
129
132
  }
130
133
 
134
+ default_time = Time.new(1989, 12, 31, 0, 0, 0, "+00:00")
135
+
131
136
  items.sort! { |i1, i2|
132
- (i2.data['last_update'] <=> i1.data['last_update']) || 0
137
+ val1 = i1.data.fetch('last_update', default_time) || default_time
138
+ val2 = i2.data.fetch('last_update', default_time) || default_time
139
+ (val2 <=> val1) || 0
133
140
  }
134
141
 
135
142
  if site.config['is_hub']
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.20
4
+ version: 1.1.21
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-30 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll