jekyll-indico 0.3.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +6 -1
- data/.pre-commit-config.yaml +2 -2
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +23 -23
- data/README.md +12 -5
- data/lib/jekyll-indico/core.rb +16 -39
- data/lib/jekyll-indico/generator.rb +17 -5
- 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: 2fd70ce9ff3c9b8e49a90d35d11c785073ddcb46
|
4
|
+
data.tar.gz: 1a45a9c41cb364fe92fc43f198e1be4ef95c9543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1faa993005ede31ba0eead7c4e4801f8d0d96afd6e76b2089e67d03c73713ecf40e458d449771c10afee1d33b3e17ebc62a4bdc772ed1c7ced9eaeeaa6f3f37c
|
7
|
+
data.tar.gz: a9b7199fb3b6695b69e70b12d9c3ad735e7c01030fd95d9ae7b0772c1286aba3caa8804da6530c383de1347c3726938415cb17636941b4db527b68efe8c0f22d
|
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,22 @@
|
|
1
|
+
# Version 0.4.3
|
2
|
+
|
3
|
+
Fix warning message for classic tokens. Add time prinout to help judge need for
|
4
|
+
timeout setting.
|
5
|
+
|
6
|
+
# Version 0.4.2
|
7
|
+
|
8
|
+
Remove broken support for classic tokens. Modern `INDICO_TOKEN` required.
|
9
|
+
|
10
|
+
# Version 0.4.1
|
11
|
+
|
12
|
+
Fix a few issues in Jekyll generator.
|
13
|
+
|
14
|
+
# Version 0.4.0
|
15
|
+
|
16
|
+
Support `INDICO_TOKEN`, replaces the [deprecated indico URL
|
17
|
+
authentication](https://docs.getindico.io/en/stable/http-api/access/). Also
|
18
|
+
support `indico.timeout` setting in config.
|
19
|
+
|
1
20
|
# Version 0.3.0
|
2
21
|
|
3
22
|
Support setting or avoiding the cache command message.
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-indico (0.3
|
4
|
+
jekyll-indico (0.4.3)
|
5
5
|
jekyll (>= 3.8, < 5.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
10
|
+
addressable (2.8.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
ast (2.4.2)
|
13
13
|
colorator (1.1.0)
|
14
|
-
concurrent-ruby (1.1.
|
15
|
-
diff-lcs (1.
|
16
|
-
em-websocket (0.5.
|
14
|
+
concurrent-ruby (1.1.9)
|
15
|
+
diff-lcs (1.5.0)
|
16
|
+
em-websocket (0.5.3)
|
17
17
|
eventmachine (>= 0.12.9)
|
18
|
-
http_parser.rb (~> 0
|
18
|
+
http_parser.rb (~> 0)
|
19
19
|
eventmachine (1.2.7)
|
20
|
-
ffi (1.15.
|
20
|
+
ffi (1.15.5)
|
21
21
|
forwardable-extended (2.6.0)
|
22
|
-
http_parser.rb (0.
|
22
|
+
http_parser.rb (0.8.0)
|
23
23
|
i18n (0.9.5)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
jekyll (3.9.
|
25
|
+
jekyll (3.9.1)
|
26
26
|
addressable (~> 2.4)
|
27
27
|
colorator (~> 1.0)
|
28
28
|
em-websocket (~> 0.5)
|
@@ -42,38 +42,38 @@ GEM
|
|
42
42
|
kramdown (2.3.1)
|
43
43
|
rexml
|
44
44
|
liquid (4.0.3)
|
45
|
-
listen (3.
|
45
|
+
listen (3.7.1)
|
46
46
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
47
47
|
rb-inotify (~> 0.9, >= 0.9.10)
|
48
48
|
mercenary (0.3.6)
|
49
49
|
parallel (1.20.1)
|
50
|
-
parser (3.
|
50
|
+
parser (3.1.0.0)
|
51
51
|
ast (~> 2.4.1)
|
52
52
|
pathutil (0.16.2)
|
53
53
|
forwardable-extended (~> 2.6)
|
54
54
|
public_suffix (4.0.6)
|
55
|
-
rainbow (3.
|
56
|
-
rake (13.0.
|
57
|
-
rb-fsevent (0.
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rake (13.0.6)
|
57
|
+
rb-fsevent (0.11.0)
|
58
58
|
rb-inotify (0.10.1)
|
59
59
|
ffi (~> 1.0)
|
60
|
-
regexp_parser (2.0
|
61
|
-
rexml (3.2.
|
62
|
-
rouge (3.
|
60
|
+
regexp_parser (2.2.0)
|
61
|
+
rexml (3.2.5)
|
62
|
+
rouge (3.27.0)
|
63
63
|
rspec (3.10.0)
|
64
64
|
rspec-core (~> 3.10.0)
|
65
65
|
rspec-expectations (~> 3.10.0)
|
66
66
|
rspec-mocks (~> 3.10.0)
|
67
|
-
rspec-core (3.10.
|
67
|
+
rspec-core (3.10.2)
|
68
68
|
rspec-support (~> 3.10.0)
|
69
|
-
rspec-expectations (3.10.
|
69
|
+
rspec-expectations (3.10.2)
|
70
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
71
|
rspec-support (~> 3.10.0)
|
72
|
-
rspec-mocks (3.10.
|
72
|
+
rspec-mocks (3.10.3)
|
73
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
74
|
rspec-support (~> 3.10.0)
|
75
|
-
rspec-support (3.10.
|
76
|
-
rubocop (1.
|
75
|
+
rspec-support (3.10.3)
|
76
|
+
rubocop (1.12.1)
|
77
77
|
parallel (~> 1.10)
|
78
78
|
parser (>= 3.0.0.0)
|
79
79
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -96,7 +96,7 @@ GEM
|
|
96
96
|
sass-listen (4.0.0)
|
97
97
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
98
98
|
rb-inotify (~> 0.9, >= 0.9.7)
|
99
|
-
unicode-display_width (2.
|
99
|
+
unicode-display_width (2.1.0)
|
100
100
|
|
101
101
|
PLATFORMS
|
102
102
|
ruby
|
data/README.md
CHANGED
@@ -19,9 +19,10 @@ indico:
|
|
19
19
|
blueprint: 11329
|
20
20
|
```
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
`
|
22
|
+
This plugin will automatically use an API token if your environment contains
|
23
|
+
`INDICO_TOKEN`. You should generate this and replace `INDICO_API_KEY` and
|
24
|
+
`INDICO_SECRET_KEY` with it. You'll want the "Classic API" read permissions set
|
25
|
+
on it.
|
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,53 +60,27 @@ 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
|
-
def download_and_iterate(base_url, indico_id, **
|
77
|
-
|
78
|
-
uri = URI.
|
79
|
-
|
66
|
+
def download_and_iterate(base_url, indico_id, **params, &block)
|
67
|
+
params[:pretty] = 'no'
|
68
|
+
uri = URI.join(base_url, "/export/categ/#{indico_id}.json")
|
69
|
+
uri.query = URI.encode_www_form(params)
|
70
|
+
|
71
|
+
req = Net::HTTP::Get.new(uri)
|
72
|
+
if ENV['INDICO_TOKEN']
|
73
|
+
req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}"
|
74
|
+
elsif ENV['INDICO_SECRET_KEY'] || ENV['INDICO_API_KEY']
|
75
|
+
raise Error, 'Use INDICO_TOKEN with a new-style token'
|
76
|
+
end
|
77
|
+
|
78
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
80
79
|
|
81
80
|
string = response.body
|
82
81
|
parsed = JSON.parse(string) # returns a hash
|
83
82
|
|
84
83
|
parsed['results'].each(&block)
|
85
84
|
end
|
86
|
-
|
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
|
-
# Automatically signs request if environment has INDICO_API/SECRET_KEY
|
94
|
-
def build_url(base_url, indico_id, **kargs)
|
95
|
-
kargs[:pretty] = 'no'
|
96
|
-
|
97
|
-
if ENV['INDICO_API_KEY']
|
98
|
-
kargs[:ak] = ENV['INDICO_API_KEY']
|
99
|
-
if ENV['INDICO_SECRET_KEY']
|
100
|
-
kargs[:timestamp] = Time.new.to_i.to_s
|
101
|
-
requeststr = join_url(indico_id, kargs)
|
102
|
-
kargs[:signature] = OpenSSL::HMAC.hexdigest('SHA1', ENV['INDICO_SECRET_KEY'], requeststr)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
"#{base_url}#{join_url(indico_id, kargs)}"
|
107
|
-
end
|
108
85
|
end
|
109
86
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'benchmark'
|
4
|
+
require 'net/http'
|
3
5
|
require 'yaml'
|
4
6
|
|
5
7
|
require 'jekyll'
|
@@ -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 hash!' unless meeting_ids.is_a?(Hash)
|
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 base_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
|
@@ -32,9 +41,12 @@ module JekyllIndico
|
|
32
41
|
return if @site.data[data_path].key? name
|
33
42
|
|
34
43
|
msg = @cache_msg ? " - run `#{@cache_msg}` to cache" : ''
|
35
|
-
|
36
|
-
|
37
|
-
|
44
|
+
print "Accessing Indico meeting API for #{name}:#{number}#{msg}"
|
45
|
+
time = Benchmark.realtime do
|
46
|
+
iris_meeting = Meetings.new(base_url, number)
|
47
|
+
@site.data[data_path][name] = iris_meeting.dict
|
48
|
+
end
|
49
|
+
puts ", took #{time.round(1)} s"
|
38
50
|
end
|
39
51
|
end
|
40
52
|
end
|
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.3
|
4
|
+
version: 0.4.3
|
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
|