jekyll-indico 0.2.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +8 -6
- data/.pre-commit-config.yaml +18 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +40 -43
- data/README.md +16 -7
- data/jekyll-indico.gemspec +1 -1
- data/lib/jekyll-indico/core.rb +15 -26
- data/lib/jekyll-indico/generator.rb +14 -4
- data/lib/jekyll-indico/version.rb +1 -1
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0dcfd6b6c484e7b1733fa6ac09b3b1835c64127f
|
4
|
+
data.tar.gz: 71a26d70ac96e8a8c0b1d6110af6c9b24373680d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22be7365dca3c8491af78d56164cc4b5eeffa4e969d2436792cd30ae3b2a2b79ed474198d00b9636b9fa2b9fa9bbf37b3e989b96b5026dc11faaeed010508b89
|
7
|
+
data.tar.gz: eaa61758e36bf45ffd78ed807bd1acdd4e1d678a41d4c88765f057bf622391ec7bc4b90e41f5c2c72fc97637cba2581749304b59da78c76f6840b4715d0d80ea
|
data/.github/workflows/ci.yml
CHANGED
@@ -13,11 +13,13 @@ jobs:
|
|
13
13
|
|
14
14
|
steps:
|
15
15
|
- uses: actions/checkout@v2
|
16
|
-
|
17
|
-
|
16
|
+
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
18
|
with:
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
bundler-cache: true
|
20
|
+
|
21
|
+
- name: Style checking
|
22
|
+
run: bundle exec rake rubocop
|
23
|
+
|
22
24
|
- name: Run tests
|
23
|
-
run: bundle exec rake
|
25
|
+
run: bundle exec rake spec
|
@@ -0,0 +1,18 @@
|
|
1
|
+
repos:
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3
|
+
rev: v4.1.0
|
4
|
+
hooks:
|
5
|
+
- id: check-added-large-files
|
6
|
+
- id: mixed-line-ending
|
7
|
+
- id: trailing-whitespace
|
8
|
+
- id: check-merge-conflict
|
9
|
+
- id: check-case-conflict
|
10
|
+
- id: check-symlinks
|
11
|
+
- id: check-yaml
|
12
|
+
|
13
|
+
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
14
|
+
rev: v1.1.11
|
15
|
+
hooks:
|
16
|
+
- id: remove-crlf
|
17
|
+
- id: forbid-tabs
|
18
|
+
exclude_types: [svg]
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.10
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# Version 0.4.1
|
2
|
+
|
3
|
+
Fix a few issues in Jekyll generator.
|
4
|
+
|
5
|
+
# Version 0.4.0
|
6
|
+
|
7
|
+
Support `INDICO_TOKEN`, replaces the [deprecated indico URL
|
8
|
+
authentication](https://docs.getindico.io/en/stable/http-api/access/). Also
|
9
|
+
support `indico.timeout` setting in config.
|
10
|
+
|
11
|
+
# Version 0.3.0
|
12
|
+
|
13
|
+
Support setting or avoiding the cache command message.
|
14
|
+
|
15
|
+
# Version 0.2.1
|
16
|
+
|
17
|
+
Fix manual caching.
|
18
|
+
|
1
19
|
# Version 0.2.0
|
2
20
|
|
3
21
|
Support for base URLs. The `indico: url:` parameter is *required*.
|
data/Gemfile.lock
CHANGED
@@ -1,83 +1,79 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-indico (0.
|
4
|
+
jekyll-indico (0.4.1)
|
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.
|
20
|
+
ffi (1.15.5)
|
21
21
|
forwardable-extended (2.6.0)
|
22
|
-
http_parser.rb (0.
|
23
|
-
i18n (
|
22
|
+
http_parser.rb (0.8.0)
|
23
|
+
i18n (0.9.5)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
jekyll (
|
25
|
+
jekyll (3.9.1)
|
26
26
|
addressable (~> 2.4)
|
27
27
|
colorator (~> 1.0)
|
28
28
|
em-websocket (~> 0.5)
|
29
|
-
i18n (~>
|
30
|
-
jekyll-sass-converter (~>
|
29
|
+
i18n (~> 0.7)
|
30
|
+
jekyll-sass-converter (~> 1.0)
|
31
31
|
jekyll-watch (~> 2.0)
|
32
|
-
kramdown (
|
33
|
-
kramdown-parser-gfm (~> 1.0)
|
32
|
+
kramdown (>= 1.17, < 3)
|
34
33
|
liquid (~> 4.0)
|
35
|
-
mercenary (~> 0.
|
34
|
+
mercenary (~> 0.3.3)
|
36
35
|
pathutil (~> 0.9)
|
37
|
-
rouge (
|
36
|
+
rouge (>= 1.7, < 4)
|
38
37
|
safe_yaml (~> 1.0)
|
39
|
-
|
40
|
-
|
41
|
-
sassc (> 2.0.1, < 3.0)
|
38
|
+
jekyll-sass-converter (1.5.2)
|
39
|
+
sass (~> 3.4)
|
42
40
|
jekyll-watch (2.2.1)
|
43
41
|
listen (~> 3.0)
|
44
|
-
kramdown (2.3.
|
42
|
+
kramdown (2.3.1)
|
45
43
|
rexml
|
46
|
-
kramdown-parser-gfm (1.1.0)
|
47
|
-
kramdown (~> 2.0)
|
48
44
|
liquid (4.0.3)
|
49
|
-
listen (3.
|
45
|
+
listen (3.7.1)
|
50
46
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
51
47
|
rb-inotify (~> 0.9, >= 0.9.10)
|
52
|
-
mercenary (0.
|
48
|
+
mercenary (0.3.6)
|
53
49
|
parallel (1.20.1)
|
54
|
-
parser (3.
|
50
|
+
parser (3.1.0.0)
|
55
51
|
ast (~> 2.4.1)
|
56
52
|
pathutil (0.16.2)
|
57
53
|
forwardable-extended (~> 2.6)
|
58
54
|
public_suffix (4.0.6)
|
59
|
-
rainbow (3.
|
60
|
-
rake (13.0.
|
61
|
-
rb-fsevent (0.
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rake (13.0.6)
|
57
|
+
rb-fsevent (0.11.0)
|
62
58
|
rb-inotify (0.10.1)
|
63
59
|
ffi (~> 1.0)
|
64
|
-
regexp_parser (2.0
|
65
|
-
rexml (3.2.
|
66
|
-
rouge (3.
|
60
|
+
regexp_parser (2.2.0)
|
61
|
+
rexml (3.2.5)
|
62
|
+
rouge (3.27.0)
|
67
63
|
rspec (3.10.0)
|
68
64
|
rspec-core (~> 3.10.0)
|
69
65
|
rspec-expectations (~> 3.10.0)
|
70
66
|
rspec-mocks (~> 3.10.0)
|
71
|
-
rspec-core (3.10.
|
67
|
+
rspec-core (3.10.2)
|
72
68
|
rspec-support (~> 3.10.0)
|
73
|
-
rspec-expectations (3.10.
|
69
|
+
rspec-expectations (3.10.2)
|
74
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
71
|
rspec-support (~> 3.10.0)
|
76
|
-
rspec-mocks (3.10.
|
72
|
+
rspec-mocks (3.10.3)
|
77
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
74
|
rspec-support (~> 3.10.0)
|
79
|
-
rspec-support (3.10.
|
80
|
-
rubocop (1.
|
75
|
+
rspec-support (3.10.3)
|
76
|
+
rubocop (1.12.1)
|
81
77
|
parallel (~> 1.10)
|
82
78
|
parser (>= 3.0.0.0)
|
83
79
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -95,17 +91,18 @@ GEM
|
|
95
91
|
rubocop-ast (>= 1.1.0)
|
96
92
|
ruby-progressbar (1.11.0)
|
97
93
|
safe_yaml (1.0.5)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
94
|
+
sass (3.7.4)
|
95
|
+
sass-listen (~> 4.0.0)
|
96
|
+
sass-listen (4.0.0)
|
97
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
98
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
99
|
+
unicode-display_width (2.1.0)
|
103
100
|
|
104
101
|
PLATFORMS
|
105
102
|
ruby
|
106
103
|
|
107
104
|
DEPENDENCIES
|
108
|
-
bundler (~>
|
105
|
+
bundler (~> 2.0)
|
109
106
|
jekyll-indico!
|
110
107
|
rake (~> 13.0)
|
111
108
|
rspec (~> 3.0)
|
@@ -114,4 +111,4 @@ DEPENDENCIES
|
|
114
111
|
rubocop-rspec (~> 2.2)
|
115
112
|
|
116
113
|
BUNDLED WITH
|
117
|
-
|
114
|
+
2.2.8
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Jekyll-Indico
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/jekyll-indico.svg)](https://badge.fury.io/rb/jekyll-indico)
|
4
|
-
![CI](https://github.com/iris-hep/jekyll-indico/workflows/CI/badge.svg)
|
4
|
+
[![CI](https://github.com/iris-hep/jekyll-indico/workflows/CI/badge.svg)](https://github.com/iris-hep/jekyll-indico/actions?query=workflow%3ACI)
|
5
5
|
|
6
6
|
This is a tool for importing meeting information from Indico.
|
7
7
|
|
@@ -13,14 +13,16 @@ Your `_config.yaml` file should contain the categories you want to download:
|
|
13
13
|
indico:
|
14
14
|
url: https://indico.cern.ch # Indico instance to use (REQUIRED)
|
15
15
|
data: indico # Optional, folder name in _data to use
|
16
|
+
cache-command: bundle exec rake cache # Optional, user msg if you support it
|
16
17
|
ids:
|
17
18
|
topical: 10570
|
18
19
|
blueprint: 11329
|
19
20
|
```
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
`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`.
|
24
26
|
|
25
27
|
#### Usage: installing
|
26
28
|
|
@@ -69,16 +71,23 @@ number on Indico).
|
|
69
71
|
|
70
72
|
```bash
|
71
73
|
# Install a local bundle
|
72
|
-
bundle
|
74
|
+
bundle config set --local path 'vendor/bundle'
|
73
75
|
|
74
76
|
# Test style and unit tests
|
75
77
|
bundle exec rake
|
76
78
|
```
|
77
79
|
|
78
|
-
|
80
|
+
If you need to automatically correct unit paths:
|
81
|
+
|
82
|
+
```bash
|
83
|
+
bundle exec rake rubocop:auto_correct
|
84
|
+
```
|
85
|
+
|
86
|
+
To release, make sure the version in `lib/jekyll-indico/version.rb` is new and
|
87
|
+
you have updated your lock file with `bundle install` then:
|
79
88
|
|
80
89
|
```bash
|
81
|
-
bundle exec rake
|
90
|
+
bundle exec rake release
|
82
91
|
```
|
83
92
|
|
84
93
|
This tags, pushes the tag, and publishes.
|
data/jekyll-indico.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
spec.add_dependency 'jekyll', '>= 3.8', '< 5.0'
|
38
38
|
|
39
|
-
spec.add_development_dependency 'bundler', '~>
|
39
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
40
40
|
spec.add_development_dependency 'rake', '~> 13.0'
|
41
41
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
42
|
spec.add_development_dependency 'rubocop', '~> 1.9'
|
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
|
@@ -53,30 +56,22 @@ module JekyllIndico
|
|
53
56
|
def to_files(folder)
|
54
57
|
@dict.each do |key, dict|
|
55
58
|
yield key if block_given?
|
56
|
-
|
59
|
+
File.write(folder / "#{key}.yml", dict.to_yaml)
|
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,14 +6,23 @@ 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
|
12
14
|
# Main entry point for Jekyll
|
13
15
|
def generate(site)
|
14
16
|
@site = site
|
17
|
+
@cache_msg = @site.config.dig('indico', 'cache-command')
|
18
|
+
|
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)
|
15
25
|
|
16
|
-
meeting_ids = Meetings.meeting_ids(@site.config)
|
17
26
|
meeting_ids.each do |name, number|
|
18
27
|
collect_meeting(name.to_s, number)
|
19
28
|
end
|
@@ -22,7 +31,8 @@ module JekyllIndico
|
|
22
31
|
private
|
23
32
|
|
24
33
|
def collect_meeting(name, number)
|
25
|
-
base_url =
|
34
|
+
base_url = @site.config.dig('indico', 'url')
|
35
|
+
raise MissingURL, 'indico: url: MISSING from your config!' unless base_url
|
26
36
|
|
27
37
|
data_path = @site.config.dig('indico', 'data') || 'indico'
|
28
38
|
@site.data[data_path] = {} unless @site.data.key? data_path
|
@@ -30,8 +40,8 @@ module JekyllIndico
|
|
30
40
|
# Do nothing if already downloaded
|
31
41
|
return if @site.data[data_path].key? name
|
32
42
|
|
33
|
-
|
34
|
-
|
43
|
+
msg = @cache_msg ? " - run `#{@cache_msg}` to cache" : ''
|
44
|
+
puts "Accessing Indico meeting API for #{name}:#{number}#{msg}"
|
35
45
|
iris_meeting = Meetings.new(base_url, number)
|
36
46
|
@site.data[data_path][name] = iris_meeting.dict
|
37
47
|
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.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Schreiner
|
8
|
-
autorequire:
|
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
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '2.0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '2.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '2.2'
|
117
|
-
description:
|
117
|
+
description:
|
118
118
|
email:
|
119
119
|
- henryschreineriii@gmail.com
|
120
120
|
executables:
|
@@ -124,8 +124,10 @@ extra_rdoc_files: []
|
|
124
124
|
files:
|
125
125
|
- ".github/workflows/ci.yml"
|
126
126
|
- ".gitignore"
|
127
|
+
- ".pre-commit-config.yaml"
|
127
128
|
- ".rspec"
|
128
129
|
- ".rubocop.yml"
|
130
|
+
- ".ruby-version"
|
129
131
|
- CHANGELOG.md
|
130
132
|
- CODE_OF_CONDUCT.md
|
131
133
|
- Gemfile
|
@@ -149,7 +151,7 @@ metadata:
|
|
149
151
|
homepage_uri: https://rubygems.org/gems/jekyll-indico
|
150
152
|
source_code_uri: https://github.com/iris-hep/jekyll-indico
|
151
153
|
changelog_uri: https://github.com/iris-hep/jekyll-indico/blob/main/CHANGELOG.md
|
152
|
-
post_install_message:
|
154
|
+
post_install_message:
|
153
155
|
rdoc_options: []
|
154
156
|
require_paths:
|
155
157
|
- lib
|
@@ -164,8 +166,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
166
|
- !ruby/object:Gem::Version
|
165
167
|
version: '0'
|
166
168
|
requirements: []
|
167
|
-
|
168
|
-
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 2.6.14.4
|
171
|
+
signing_key:
|
169
172
|
specification_version: 4
|
170
173
|
summary: Read and/or cache indico meeting lists for Jekyll
|
171
174
|
test_files: []
|