jekyll-indico 0.3.0 → 0.4.0
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 +4 -4
- data/.github/workflows/ci.yml +6 -1
- data/.pre-commit-config.yaml +2 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +12 -5
- data/lib/jekyll-indico/core.rb +14 -25
- data/lib/jekyll-indico/generator.rb +11 -2
- data/lib/jekyll-indico/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42dd6e02ca0145cbd0ab2678b896340909141d15
|
4
|
+
data.tar.gz: 91e3c5ae03e1508c8fb515281ca2ade408c1d453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63de08c462ef249ee2e0502aefd8c8104861b3c14f209df3df876875b61f8d6f5632a3ea8c1ae7cb21433c00b2f337cca7bf30163aca07ae5503d3d5ef8c8527
|
7
|
+
data.tar.gz: c3cec693a86e94decf78b38af462ef7632ba567242171297feeba47af30f49d640f9c75da3d082ce575f045d2a979eeec680db49932c37afafe6dee845a5cb9b
|
data/.github/workflows/ci.yml
CHANGED
@@ -13,8 +13,13 @@ jobs:
|
|
13
13
|
|
14
14
|
steps:
|
15
15
|
- uses: actions/checkout@v2
|
16
|
+
|
16
17
|
- uses: ruby/setup-ruby@v1
|
17
18
|
with:
|
18
19
|
bundler-cache: true
|
20
|
+
|
21
|
+
- name: Style checking
|
22
|
+
run: bundle exec rake rubocop
|
23
|
+
|
19
24
|
- name: Run tests
|
20
|
-
run: bundle exec rake
|
25
|
+
run: bundle exec rake spec
|
data/.pre-commit-config.yaml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
repos:
|
2
2
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3
|
-
rev:
|
3
|
+
rev: v4.1.0
|
4
4
|
hooks:
|
5
5
|
- id: check-added-large-files
|
6
6
|
- id: mixed-line-ending
|
@@ -11,7 +11,7 @@ repos:
|
|
11
11
|
- id: check-yaml
|
12
12
|
|
13
13
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
14
|
-
rev: v1.1.
|
14
|
+
rev: v1.1.11
|
15
15
|
hooks:
|
16
16
|
- id: remove-crlf
|
17
17
|
- id: forbid-tabs
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Version 0.4.0
|
2
|
+
|
3
|
+
Support `INDICO_TOKEN`, replaces the [deprecated indico URL
|
4
|
+
authentication](https://docs.getindico.io/en/stable/http-api/access/). Also
|
5
|
+
support `indico.timeout` setting in config.
|
6
|
+
|
1
7
|
# Version 0.3.0
|
2
8
|
|
3
9
|
Support setting or avoiding the cache command message.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -19,9 +19,10 @@ indico:
|
|
19
19
|
blueprint: 11329
|
20
20
|
```
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
`INDICO_API` and
|
22
|
+
This plugin will automatically use an API token if your environment contains
|
23
|
+
`INDICO_TOKEN`. If you use the deprecated API, this plugin will automatically
|
24
|
+
sign your requests if your environment contains `INDICO_API` and
|
25
|
+
`INDICO_SECRET_KEY`.
|
25
26
|
|
26
27
|
#### Usage: installing
|
27
28
|
|
@@ -70,14 +71,20 @@ number on Indico).
|
|
70
71
|
|
71
72
|
```bash
|
72
73
|
# Install a local bundle
|
73
|
-
bundle
|
74
|
+
bundle config set --local path 'vendor/bundle'
|
74
75
|
|
75
76
|
# Test style and unit tests
|
76
77
|
bundle exec rake
|
77
78
|
```
|
78
79
|
|
80
|
+
If you need to automatically correct unit paths:
|
81
|
+
|
82
|
+
```bash
|
83
|
+
bundle exec rake rubocop:auto_correct
|
84
|
+
```
|
85
|
+
|
79
86
|
To release, make sure the version in `lib/jekyll-indico/version.rb` is new and
|
80
|
-
you have updated your lock file with `bundle
|
87
|
+
you have updated your lock file with `bundle install` then:
|
81
88
|
|
82
89
|
```bash
|
83
90
|
bundle exec rake release
|
data/lib/jekyll-indico/core.rb
CHANGED
@@ -15,6 +15,9 @@ module JekyllIndico
|
|
15
15
|
class MissingURL < Error
|
16
16
|
end
|
17
17
|
|
18
|
+
class MissingIDs < Error
|
19
|
+
end
|
20
|
+
|
18
21
|
# Look for topical meetings
|
19
22
|
class Meetings
|
20
23
|
attr_accessor :dict
|
@@ -57,26 +60,18 @@ module JekyllIndico
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
|
-
# Get meeting ids from a config
|
61
|
-
def self.meeting_ids(config = {})
|
62
|
-
config.dig('indico', 'ids')
|
63
|
-
end
|
64
|
-
|
65
|
-
# Get base URL from a config
|
66
|
-
def self.base_url(config = {})
|
67
|
-
url = config.dig('indico', 'url')
|
68
|
-
raise MissingURL('indico: url: MISSING from your config!') unless url
|
69
|
-
|
70
|
-
url
|
71
|
-
end
|
72
|
-
|
73
63
|
private
|
74
64
|
|
75
65
|
# Run a block over each item in the downloaded results
|
76
66
|
def download_and_iterate(base_url, indico_id, **kargs, &block)
|
77
|
-
|
78
|
-
|
79
|
-
|
67
|
+
uri = URI.join(base_url, "/export/categ/#{indico_id}.json")
|
68
|
+
params = build_params(**kargs)
|
69
|
+
uri.query = URI.encode_www_form(params)
|
70
|
+
|
71
|
+
req = Net::HTTP::Get.new(uri)
|
72
|
+
req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}" if ENV['INDICO_TOKEN']
|
73
|
+
|
74
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
80
75
|
|
81
76
|
string = response.body
|
82
77
|
parsed = JSON.parse(string) # returns a hash
|
@@ -84,17 +79,11 @@ module JekyllIndico
|
|
84
79
|
parsed['results'].each(&block)
|
85
80
|
end
|
86
81
|
|
87
|
-
# Put together a dict and an indico ID
|
88
|
-
def join_url(indico_id, options)
|
89
|
-
apicall = options.sort.to_h.map { |k, v| "#{k}=#{v}" }.join('&')
|
90
|
-
"/export/categ/#{indico_id}.json?#{apicall}"
|
91
|
-
end
|
92
|
-
|
93
82
|
# Automatically signs request if environment has INDICO_API/SECRET_KEY
|
94
|
-
def
|
83
|
+
def build_params(**kargs)
|
95
84
|
kargs[:pretty] = 'no'
|
96
85
|
|
97
|
-
if ENV['INDICO_API_KEY']
|
86
|
+
if ENV['INDICO_API_KEY'] && !ENV['INDICO_TOKEN']
|
98
87
|
kargs[:ak] = ENV['INDICO_API_KEY']
|
99
88
|
if ENV['INDICO_SECRET_KEY']
|
100
89
|
kargs[:timestamp] = Time.new.to_i.to_s
|
@@ -103,7 +92,7 @@ module JekyllIndico
|
|
103
92
|
end
|
104
93
|
end
|
105
94
|
|
106
|
-
|
95
|
+
kargs
|
107
96
|
end
|
108
97
|
end
|
109
98
|
end
|
@@ -6,6 +6,8 @@ require 'jekyll'
|
|
6
6
|
|
7
7
|
require 'jekyll-indico/core'
|
8
8
|
|
9
|
+
require 'net/http'
|
10
|
+
|
9
11
|
module JekyllIndico
|
10
12
|
# This is a Jekyll Generator
|
11
13
|
class GetIndico < Jekyll::Generator
|
@@ -14,7 +16,13 @@ module JekyllIndico
|
|
14
16
|
@site = site
|
15
17
|
@cache_msg = @site.config.dig('indico', 'cache-command')
|
16
18
|
|
17
|
-
|
19
|
+
timeout = @site.config.dig('indico', 'timeout')
|
20
|
+
Net::HTTP.read_timeout = timeout if timeout
|
21
|
+
|
22
|
+
meeting_ids = @site.config.dig('indico', 'ids')
|
23
|
+
raise MissingIDs('indico: ids: MISSING from your config!') unless meeting_ids
|
24
|
+
raise MissingIDs('indico: ids: must be a list!') unless meeting_ids.is_a?(Array)
|
25
|
+
|
18
26
|
meeting_ids.each do |name, number|
|
19
27
|
collect_meeting(name.to_s, number)
|
20
28
|
end
|
@@ -23,7 +31,8 @@ module JekyllIndico
|
|
23
31
|
private
|
24
32
|
|
25
33
|
def collect_meeting(name, number)
|
26
|
-
base_url =
|
34
|
+
base_url = @site.config.dig('indico', 'url')
|
35
|
+
raise MissingURL('indico: url: MISSING from your config!') unless url
|
27
36
|
|
28
37
|
data_path = @site.config.dig('indico', 'data') || 'indico'
|
29
38
|
@site.data[data_path] = {} unless @site.data.key? data_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-indico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Schreiner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|