jekyll-everypolitician 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 9387daa16bfcd547db3dcf3c7b7927d72af361ac
4
- data.tar.gz: 7530ef6cd4232c9ed4f07bc723d6ccd142e67938
3
+ metadata.gz: 72ae121d8a732ae6e1eca70c23838772ef97df42
4
+ data.tar.gz: 45356441a9064e6166f9e67ae48e78124535dafc
5
5
  SHA512:
6
- metadata.gz: de2310fa3695a3ab4b8a89e9a95018914cab6315d6b0ff06246fea9300196a5225a4a7e202a2b85c0f2a75ff82ae80373050af98ee5fce00560b0a948e0d99bf
7
- data.tar.gz: 6bfd4923784f3ea99103a0213cd6bcb819ebc890231d1367607d44af761c7ad7a63ca2dbb4f64ec1dd19ce5a6609273809fe52361b975398924b105108456fee
6
+ metadata.gz: cd30320c8b95c7423ae6cd01a3010cd4b8aa94a778256a3587168179a3308e7ba94814e8a8b5d376212d3e1915aa930272a7e7c38830cbd917bc24912b28c47f
7
+ data.tar.gz: 0df4c37bb21ce8b8b97a68230af4502e1c3e66e3dba4419d3f0f8503e5d27a1d6e53ddfbf761272e56c1a57430493a6b1007bb4c61b2faa7fd3d0e26760bbc68
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.4.0] - 2015-12-03
6
+
7
+ ### Changed
8
+
9
+ - `Jekyll::Everypolitician::Generator` is now `:high` priority. This means it will get run before plugins that don't declare a priority. This should make it easier to make other plugins that depend on the data that `jekyll-everypolitician` adds to the `site` object.
10
+
5
11
  ## [0.3.0] - 2015-12-02
6
12
 
7
13
  ### Changed
@@ -26,3 +32,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
26
32
 
27
33
  [0.2.0]: https://github.com/everypolitician/jekyll-everypolitician/compare/v0.1.0...v0.2.0
28
34
  [0.3.0]: https://github.com/everypolitician/jekyll-everypolitician/compare/v0.2.0...v0.3.0
35
+ [0.4.0]: https://github.com/everypolitician/jekyll-everypolitician/compare/v0.3.0...v0.4.0
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'minitest'
27
27
  spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'simplecov'
28
29
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Everypolitician
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -14,6 +14,8 @@ module Jekyll
14
14
  'persons' => 'people'
15
15
  }
16
16
 
17
+ priority :high
18
+
17
19
  def generate(site)
18
20
  return unless site.config.key?('everypolitician')
19
21
  sources = site.config['everypolitician']['sources']
@@ -50,12 +52,20 @@ module Jekyll
50
52
  site.collections[collection_name] = collection
51
53
  end
52
54
 
55
+ membership_mapping = [
56
+ { key: 'person', kind: 'persons', id: 'person_id' },
57
+ { key: 'area', kind: 'areas', id: 'area_id' },
58
+ { key: 'legislative_period', kind: 'events', id: 'legislative_period_id' },
59
+ { key: 'organization', kind: 'organizations', id: 'organization_id' },
60
+ { key: 'party', kind: 'organizations', id: 'on_behalf_of_id' }
61
+ ]
53
62
  memberships.each do |membership|
54
- membership['person'] = site.collections[collection_name_for('persons', prefix)].docs.find { |p| p.data['id'] == membership['person_id'] }
55
- membership['area'] = site.collections[collection_name_for('areas', prefix)].docs.find { |a| a.data['id'] == membership['area_id'] }
56
- membership['legislative_period'] = site.collections[collection_name_for('events', prefix)].docs.find { |e| e.data['id'] == membership['legislative_period_id'] }
57
- membership['organization'] = site.collections[collection_name_for('organizations', prefix)].docs.find { |o| o.data['id'] == membership['organization_id'] }
58
- membership['party'] = site.collections[collection_name_for('organizations', prefix)].docs.find { |o| o.data['id'] == membership['on_behalf_of_id'] }
63
+ membership_mapping.each do |mapping|
64
+ collection = site.collections[collection_name_for(mapping[:kind], prefix)]
65
+ membership[mapping[:key]] = collection.docs.find do |doc|
66
+ doc.data['id'] == membership[mapping[:id]]
67
+ end
68
+ end
59
69
  end
60
70
  end
61
71
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-everypolitician
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description:
98
112
  email:
99
113
  - chrismytton@gmail.com