jekyll-hoffnung3000 0.1.0 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b994f55f448312b63280ea612335841ab2732a3537299a650510a9be69f6108
4
- data.tar.gz: 2b78a80f993a31d5458bd50d48062312e699a30b8b47b46ad0edf5982fdfb025
3
+ metadata.gz: 00e7eadc818df655c7634aa6ed5dc6b1491467de2cfd9626271213082f193576
4
+ data.tar.gz: 29cf7e569205c9e40446231a5dbe272abac23435edc27b229830fc8c74181a68
5
5
  SHA512:
6
- metadata.gz: f9c053b146cac2b57d7ad83f19bea38a5184a2c5fecfec8d1de843ec8cddc7f5a3608e2d80ad6ba098ebec49362ef973a93c4317c5b040121d9d8197597f708a
7
- data.tar.gz: 402efaba4321f03594ea354301548eb4584a43a63b58e9337b29f5a987781df8d066f1dc0bb86947b48f36e4df57cc37f11f48254ac0f94741d2fd2444e33003
6
+ metadata.gz: e7132df52287cf63e18e7b0cec3aa4bb95f22766d9f912d356861d49427ad7230724be4e17f7216e8a1bc206f593fe432111a052c83fb4d1082fdce446f81353
7
+ data.tar.gz: 44be2954850feb86cbeda2e35fa5623d935aaa7e3d5f1bd813ded795952a734545ed2ec358c962dc4cc783599e59084042f7c31c9ebb0344b9db010499b39181
data/Gemfile CHANGED
@@ -4,7 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in jekyll-hoffnung3000.gemspec
6
6
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rubocop", "~> 1.7"
data/Gemfile.lock CHANGED
@@ -1,9 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-hoffnung3000 (0.1.0)
4
+ jekyll-hoffnung3000 (0.1.5)
5
5
  http (~> 4.4.1)
6
+ jekyll (~> 4.2)
6
7
  json (~> 2.5.1)
8
+ rake (~> 13.0)
9
+ rubocop (~> 1.7)
7
10
  ruby-jq (~> 0.2.1)
8
11
 
9
12
  GEM
@@ -12,12 +15,19 @@ GEM
12
15
  addressable (2.7.0)
13
16
  public_suffix (>= 2.0.2, < 5.0)
14
17
  ast (2.4.2)
18
+ colorator (1.1.0)
19
+ concurrent-ruby (1.1.9)
15
20
  domain_name (0.5.20190701)
16
21
  unf (>= 0.0.5, < 1.0.0)
22
+ em-websocket (0.5.2)
23
+ eventmachine (>= 0.12.9)
24
+ http_parser.rb (~> 0.6.0)
25
+ eventmachine (1.2.7)
17
26
  ffi (1.15.1)
18
27
  ffi-compiler (1.0.1)
19
28
  ffi (>= 1.0.0)
20
29
  rake
30
+ forwardable-extended (2.6.0)
21
31
  http (4.4.1)
22
32
  addressable (~> 2.3)
23
33
  http-cookie (~> 1.0)
@@ -28,17 +38,54 @@ GEM
28
38
  http-form_data (2.3.0)
29
39
  http-parser (1.2.3)
30
40
  ffi-compiler (>= 1.0, < 2.0)
41
+ http_parser.rb (0.6.0)
42
+ i18n (1.8.10)
43
+ concurrent-ruby (~> 1.0)
44
+ jekyll (4.2.0)
45
+ addressable (~> 2.4)
46
+ colorator (~> 1.0)
47
+ em-websocket (~> 0.5)
48
+ i18n (~> 1.0)
49
+ jekyll-sass-converter (~> 2.0)
50
+ jekyll-watch (~> 2.0)
51
+ kramdown (~> 2.3)
52
+ kramdown-parser-gfm (~> 1.0)
53
+ liquid (~> 4.0)
54
+ mercenary (~> 0.4.0)
55
+ pathutil (~> 0.9)
56
+ rouge (~> 3.0)
57
+ safe_yaml (~> 1.0)
58
+ terminal-table (~> 2.0)
59
+ jekyll-sass-converter (2.1.0)
60
+ sassc (> 2.0.1, < 3.0)
61
+ jekyll-watch (2.2.1)
62
+ listen (~> 3.0)
31
63
  json (2.5.1)
64
+ kramdown (2.3.1)
65
+ rexml
66
+ kramdown-parser-gfm (1.1.0)
67
+ kramdown (~> 2.0)
68
+ liquid (4.0.3)
69
+ listen (3.5.1)
70
+ rb-fsevent (~> 0.10, >= 0.10.3)
71
+ rb-inotify (~> 0.9, >= 0.9.10)
72
+ mercenary (0.4.0)
32
73
  mini_portile2 (2.6.1)
33
74
  multi_json (1.15.0)
34
75
  parallel (1.20.1)
35
76
  parser (3.0.1.1)
36
77
  ast (~> 2.4.1)
78
+ pathutil (0.16.2)
79
+ forwardable-extended (~> 2.6)
37
80
  public_suffix (4.0.6)
38
81
  rainbow (3.0.0)
39
82
  rake (13.0.3)
83
+ rb-fsevent (0.11.0)
84
+ rb-inotify (0.10.1)
85
+ ffi (~> 1.0)
40
86
  regexp_parser (2.1.1)
41
87
  rexml (3.2.5)
88
+ rouge (3.26.0)
42
89
  rubocop (1.16.1)
43
90
  parallel (~> 1.10)
44
91
  parser (>= 3.0.0.0)
@@ -54,18 +101,21 @@ GEM
54
101
  mini_portile2 (>= 2.2.0)
55
102
  multi_json
56
103
  ruby-progressbar (1.11.0)
104
+ safe_yaml (1.0.5)
105
+ sassc (2.4.0)
106
+ ffi (~> 1.9)
107
+ terminal-table (2.0.0)
108
+ unicode-display_width (~> 1.1, >= 1.1.1)
57
109
  unf (0.1.4)
58
110
  unf_ext
59
111
  unf_ext (0.0.7.7)
60
- unicode-display_width (2.0.0)
112
+ unicode-display_width (1.7.0)
61
113
 
62
114
  PLATFORMS
63
115
  x86_64-linux
64
116
 
65
117
  DEPENDENCIES
66
118
  jekyll-hoffnung3000!
67
- rake (~> 13.0)
68
- rubocop (~> 1.7)
69
119
 
70
120
  BUNDLED WITH
71
121
  2.2.19
data/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Jekyll::Hoffnung3000
2
2
 
3
3
  A Jekyll plugin for archiving HOFFNUNG3000 festivals.
4
+
5
+ ## Prerequisites
6
+
7
+ This gem uses `ruby-jq` gem to bind to [jq](http://stedolan.github.io/jq/) which requires the Oniguruma library to provide regex support.
8
+
9
+ If any system dependencies are missing please see the [jq FAQ](https://github.com/stedolan/jq/wiki/FAQ#installation) for help.
4
10
  ## Installation
5
11
 
6
12
  Add this line to your application's Gemfile:
7
13
 
8
14
  ```ruby
9
- gem 'jekyll-hoffnung3000'
15
+ group :jekyll_plugins do
16
+ gem 'jekyll-hoffnung3000', '0.1.0'
17
+ end
10
18
  ```
11
19
 
12
20
  And then execute:
@@ -21,14 +29,68 @@ Or install it yourself as:
21
29
 
22
30
  Add these lines to your _config.yml replacing the url with the address of your running HOFFNUNG3000 instance.
23
31
 
24
- ```
32
+ ```ruby
25
33
  hoffnung3000:
26
- url: https://your-hoffnung3000-instance.org
34
+ url: "https://your-hoffnung3000-instance.org"
27
35
  ```
28
36
 
29
37
  With this config set you can use the command line to fetch event data which will be written to `_data/events.json`.
30
38
 
31
- `bundle exec jekyll hoffnung3000 events`
39
+ ```sh
40
+ $ bundle exec jekyll hoffnung3000 events
41
+ ```
42
+
43
+ Events are formatted in the following way as array of JSON objects:
44
+
45
+ ```json
46
+ [
47
+ {
48
+ "title": "Anti-Capitalist Knitting",
49
+ "description": "Anti-Capitalist Knitting is an experimental knitting workshop with an emphasis on sustainability, focusing on exploring materials and using simple techniques to create artwork........",
50
+ "date": "2020-06-06",
51
+ "time": {
52
+ "from": "2020-06-06T10:00:00.000Z",
53
+ "to": "2020-06-06T12:00:00.000Z"
54
+ },
55
+ "organiser": {
56
+ "name": "Name of Organiser",
57
+ },
58
+ "place": {
59
+ "id": 1,
60
+ "name": "museum of neoliberalism [online location]",
61
+ "description": "A small, free museum about how an obscure and extreme ideological cult of the 1970s rose to power and now shapes our lives in dramatic and often terrible ways......",
62
+ "area": "London"
63
+ },
64
+ "imageUrl": "https://image-url/medium.jpg",
65
+ "tags": [
66
+ "Workshop",
67
+ "Art",
68
+ "Anticapitalism",
69
+ "Mental-health",
70
+ "Gender",
71
+ "Feminism"
72
+ ],
73
+ "websiteUrl": "https://event-website.org"
74
+ }
75
+ ]
76
+ ```
77
+
78
+ Places are formatted in the following way as array of JSON objects:
79
+
80
+ ```json
81
+ [
82
+ {
83
+ "id": 1,
84
+ "title": "Place name",
85
+ "description": "Description of this place",
86
+ "street": "1 Street",
87
+ "cityCode": "XXX123",
88
+ "city": "City",
89
+ "country": "Country",
90
+ "imageUrl": "https://image-url/medium.jpg"
91
+ }
92
+ ]
93
+ ```
32
94
 
33
95
  ## Development
34
96
 
data/Rakefile CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rubocop/rake_task"
5
+ require "rake/testtask"
5
6
 
6
7
  RuboCop::RakeTask.new
7
8
 
9
+ Rake::TestTask.new do |t|
10
+ t.libs << "hoffnung3000"
11
+ end
12
+ desc "Run HOFFNUNG3000 tests"
13
+
8
14
  task default: :rubocop
Binary file
@@ -9,9 +9,9 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["git@contact.samandreae.com"]
10
10
 
11
11
  spec.summary = "HOFFNUNG3000 archival tool"
12
- spec.homepage = "https://hoffnung3000.de"
12
+ spec.homepage = "https://github.com/sandreae/jekyll-hoffnung3000"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.4.0"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
 
@@ -27,8 +27,11 @@ Gem::Specification.new do |spec|
27
27
  # Uncomment to register a new dependency of your gem
28
28
  # spec.add_dependency "example-gem", "~> 1.0"
29
29
  spec.add_dependency "http", "~> 4.4.1"
30
- spec.add_dependency "ruby-jq", "~> 0.2.1"
30
+ spec.add_dependency "jekyll", "~> 4.2"
31
31
  spec.add_dependency "json", "~> 2.5.1"
32
+ spec.add_dependency "rake", "~> 13.0"
33
+ spec.add_dependency "rubocop", "~> 1.7"
34
+ spec.add_dependency "ruby-jq", "~> 0.2.1"
32
35
 
33
36
  # For more information and examples about making a new gem, checkout our
34
37
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,48 +1,6 @@
1
- require "http"
2
- require "jq"
3
- require "json"
1
+ # frozen_string_literal: true
4
2
 
5
- FORMAT_STRING =
6
- ".data[] |
7
- {
8
- title: .title,
9
- description: .description,
10
- date: .date, time:
11
- {
12
- from: .slots[0].from,
13
- to: .slots[-1].to
14
- },
15
- organiser:
16
- {
17
- name: .animal.userName,
18
- about: .organiser_biog
19
- },
20
- venue:
21
- {
22
- id: null,
23
- name: .place.title,
24
- description: .place.description,
25
- area: .place.city
26
- },
27
- imageUrl:.images[0].mediumImageUrl,
28
- tags:.tags,
29
- websiteUrl: .websiteUrl
30
- }
31
- ".freeze
32
-
33
- def write_data(data, file_name)
34
- Dir.mkdir("_data") unless Dir.exist?("_data")
35
- File.write(format("_data/%s.json", file_name), JSON.generate(data))
36
- end
37
-
38
- def check_config(config)
39
- raise "HOFFNUNG3000 Error: Jekyl _config.yml file must contain a hoffnung3000 block" unless config["hoffnung3000"]
40
- unless config["hoffnung3000"]["url"]
41
- raise "HOFFNUNG3000 Error: Jekyl _config.yml file must contain a hoffnung3000 > url value"
42
- end
43
-
44
- config
45
- end
3
+ require_relative "../hoffnung3000/main"
46
4
 
47
5
  module Jekyll
48
6
  module Commands
@@ -56,10 +14,19 @@ module Jekyll
56
14
  c.command(:events) do |f|
57
15
  f.description "Fetch all events and write to _data folder as events.json."
58
16
  f.action do |_args, _options|
59
- config = check_config(Jekyll.configuration({}))
60
- response = HTTP.get(format("%s/api/events", config["hoffnung3000"]["url"]))
61
- jq = JQ(response.body, parse_json: true)
62
- write_data(jq.search(FORMAT_STRING), "events")
17
+ get_hoffnung(Jekyll.configuration({}), "events")
18
+ end
19
+ end
20
+ c.command(:places) do |f|
21
+ f.description "Fetch all places and write to _data folder as places.json."
22
+ f.action do |_args, _options|
23
+ get_hoffnung(Jekyll.configuration({}), "places")
24
+ end
25
+ end
26
+ c.command(:places) do |f|
27
+ f.description "Fetch festival meta data and write to _data folder as meta.json."
28
+ f.action do |_args, _options|
29
+ get_hoffnung(Jekyll.configuration({}), "meta")
63
30
  end
64
31
  end
65
32
  end
@@ -9,4 +9,4 @@ module Jekyll
9
9
  end
10
10
  end
11
11
 
12
- require "jekyll/commands/hoffnung3000.rb"
12
+ require "jekyll/commands/hoffnung3000"
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "http"
4
+ require "jq"
5
+ require "json"
6
+
7
+ RESULT_LIMIT = 200
8
+
9
+ FORMAT_STRING_EVENTS =
10
+ ".data[] |
11
+ {
12
+ title: .title,
13
+ description: .description,
14
+ date: .slots[0].from | split(\"T\")[0],
15
+ time:
16
+ {
17
+ from: .slots[0].from,
18
+ to: .slots[-1].to
19
+ },
20
+ organiser:
21
+ {
22
+ name: .animal.userName,
23
+ },
24
+ place:
25
+ {
26
+ id: .place.id,
27
+ name: .place.title,
28
+ description: .place.description,
29
+ area: .place.city
30
+ },
31
+ imageUrl:.images[0].mediumImageUrl,
32
+ tags:.tags,
33
+ websiteUrl: .websiteUrl
34
+ }
35
+ "
36
+
37
+ FORMAT_STRING_PLACES =
38
+ ".data[] |
39
+ {
40
+ id: .id,
41
+ title: .title,
42
+ description: .description,
43
+ street: .street,
44
+ cityCode: .cityCode,
45
+ city: .city,
46
+ country: .country,
47
+ imageUrl:.images[0].mediumImageUrl
48
+ }
49
+ "
50
+
51
+ FORMAT_STRING_META =
52
+ ".config |
53
+ {
54
+ title: .title,
55
+ description: .description,
56
+ }
57
+ "
58
+
59
+ SEARCH_STRINGS = {
60
+ "events" => FORMAT_STRING_EVENTS,
61
+ "places" => FORMAT_STRING_PLACES,
62
+ "meta" => FORMAT_STRING_META
63
+ }.freeze
64
+
65
+ def format_data(data, key)
66
+ jq = JQ(data, parse_json: true)
67
+ jq.search(SEARCH_STRINGS[key])
68
+ end
69
+
70
+ def write_data(data, file_name)
71
+ Dir.mkdir("_data") unless Dir.exist?("_data")
72
+ File.write(format("_data/%s.json", file_name), JSON.generate(data))
73
+ end
74
+
75
+ def check_config(config)
76
+ raise "HOFFNUNG3000 Error: Jekyl _config.yml file must contain a hoffnung3000 block" unless config["hoffnung3000"]
77
+ unless config["hoffnung3000"]["url"]
78
+ raise "HOFFNUNG3000 Error: Jekyl _config.yml file must contain a hoffnung3000 > url value"
79
+ end
80
+
81
+ config
82
+ end
83
+
84
+ def url(config)
85
+ check_config(config)["hoffnung3000"]["url"]
86
+ end
87
+
88
+ def fetch_data(url, key)
89
+ HTTP.get(format("%<url>s/api/%<key>s", { url: url, key: key }), { params: { limit: RESULT_LIMIT } }).body
90
+ end
91
+
92
+ def get_hoffnung(config, key)
93
+ url = url(config)
94
+ data = fetch_data(url, key)
95
+ formatted_data = format_data(data, key)
96
+ write_data(formatted_data, key)
97
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Hoffnung3000
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-hoffnung3000
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sandreae
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-10 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.4.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: ruby-jq
28
+ name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.1
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.1
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,48 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.5.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.7'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ruby-jq
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.1
55
97
  description:
56
98
  email:
57
99
  - git@contact.samandreae.com
@@ -69,15 +111,17 @@ files:
69
111
  - Rakefile
70
112
  - bin/console
71
113
  - bin/setup
114
+ - jekyll-hoffnung3000-0.1.4.gem
72
115
  - jekyll-hoffnung3000.gemspec
73
116
  - lib/jekyll/commands/hoffnung3000.rb
74
117
  - lib/jekyll/hoffnung3000.rb
118
+ - lib/jekyll/hoffnung3000/main.rb
75
119
  - lib/jekyll/hoffnung3000/version.rb
76
- homepage: https://hoffnung3000.de
120
+ homepage: https://github.com/sandreae/jekyll-hoffnung3000
77
121
  licenses:
78
122
  - MIT
79
123
  metadata:
80
- homepage_uri: https://hoffnung3000.de
124
+ homepage_uri: https://github.com/sandreae/jekyll-hoffnung3000
81
125
  post_install_message:
82
126
  rdoc_options: []
83
127
  require_paths:
@@ -86,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
130
  requirements:
87
131
  - - ">="
88
132
  - !ruby/object:Gem::Version
89
- version: 2.4.0
133
+ version: 2.7.0
90
134
  required_rubygems_version: !ruby/object:Gem::Requirement
91
135
  requirements:
92
136
  - - ">="