jekyll-indico 0.4.5 → 0.6.1

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
- SHA1:
3
- metadata.gz: 91bed0b6b864fa3f7a1b8dee140c9f9eb791823b
4
- data.tar.gz: 6519f4dd2b0681d3961ce636733701342eed4a7d
2
+ SHA256:
3
+ metadata.gz: 772fa536fed11533f53b2d2e643a4ffd3c9443d93bf6a546185aa9c5d70a0f5a
4
+ data.tar.gz: f4558987c3f3d9a2c62c13bec9617088318b63ec3667ab8b3aa24a085a7ca429
5
5
  SHA512:
6
- metadata.gz: 1f5064ba79a8af25de947a654f5718e70b48a19533f05afa1cb6739ffd07a9c6c25d4296def57d50b00a5f34e57467629ad048b5d6ed6858d6fbb8811dca7d79
7
- data.tar.gz: 260ecb6e6b9b1801928d0f6eeb204e71217db6f3e6d5fd77128fe750128b976d5401725556054c939cad347f2aebb7071540b35ac4dd08931584d121f35831c1
6
+ metadata.gz: 3973f9788e6afc35aaf231fec4c3b813d6f37f010e20ade8fa0c739f02b3caa7658ba5bc1bcda2856e5376bbe404c03b9ae1c6695b3978e0ac1950905eefcdf6
7
+ data.tar.gz: '042863f213053df58b317bea185d459493d3a9ae56553cd61ccf8bdcb78b1530af50af4f752df5ff4752f2dc551a3c7a7ad97ced47aecdadf86918a228eb85d3'
@@ -7,15 +7,24 @@ on:
7
7
  branches:
8
8
  - main
9
9
 
10
+ concurrency:
11
+ group: test-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
10
14
  jobs:
11
15
  test:
12
16
  runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ ruby: [2.6, 3.1]
13
21
 
14
22
  steps:
15
- - uses: actions/checkout@v2
23
+ - uses: actions/checkout@v3
16
24
 
17
25
  - uses: ruby/setup-ruby@v1
18
26
  with:
27
+ ruby-version: ${{ matrix.ruby }}
19
28
  bundler-cache: true
20
29
 
21
30
  - name: Style checking
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.1.0
3
+ rev: v4.2.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.11
14
+ rev: v1.1.13
15
15
  hooks:
16
16
  - id: remove-crlf
17
17
  - id: forbid-tabs
data/.rubocop.yml CHANGED
@@ -2,10 +2,12 @@ Metrics/MethodLength:
2
2
  Max: 25
3
3
  Metrics/AbcSize:
4
4
  Max: 55
5
+ Metrics/CyclomaticComplexity:
6
+ Max: 10
5
7
  Style/NumericLiterals:
6
8
  Enabled: false
7
9
  Naming/FileName:
8
10
  Enabled: false
9
11
  AllCops:
10
12
  NewCops: enable
11
- TargetRubyVersion: 2.4
13
+ TargetRubyVersion: 2.6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.10
1
+ 2.6.10
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+
2
+ # Version 0.6
3
+
4
+ Minimum Ruby version is now Ruby 2.6. Optimized `paginate` to reduce the API calls by one.
5
+
6
+ # Version 0.5
7
+
8
+ Added a way to paginate. Use `paginate: N` to iterate over pages of results.
9
+
1
10
  # Version 0.4.5
2
11
 
3
12
  Fix timeout being incorrectly called again.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-indico (0.4.5)
4
+ jekyll-indico (0.6.1)
5
5
  jekyll (>= 3.8, < 5.0)
6
6
 
7
7
  GEM
@@ -11,7 +11,7 @@ GEM
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.9)
14
+ concurrent-ruby (1.1.10)
15
15
  diff-lcs (1.5.0)
16
16
  em-websocket (0.5.3)
17
17
  eventmachine (>= 0.12.9)
@@ -20,95 +20,98 @@ GEM
20
20
  ffi (1.15.5)
21
21
  forwardable-extended (2.6.0)
22
22
  http_parser.rb (0.8.0)
23
- i18n (0.9.5)
23
+ i18n (1.10.0)
24
24
  concurrent-ruby (~> 1.0)
25
- jekyll (3.9.1)
25
+ jekyll (4.2.2)
26
26
  addressable (~> 2.4)
27
27
  colorator (~> 1.0)
28
28
  em-websocket (~> 0.5)
29
- i18n (~> 0.7)
30
- jekyll-sass-converter (~> 1.0)
29
+ i18n (~> 1.0)
30
+ jekyll-sass-converter (~> 2.0)
31
31
  jekyll-watch (~> 2.0)
32
- kramdown (>= 1.17, < 3)
32
+ kramdown (~> 2.3)
33
+ kramdown-parser-gfm (~> 1.0)
33
34
  liquid (~> 4.0)
34
- mercenary (~> 0.3.3)
35
+ mercenary (~> 0.4.0)
35
36
  pathutil (~> 0.9)
36
- rouge (>= 1.7, < 4)
37
+ rouge (~> 3.0)
37
38
  safe_yaml (~> 1.0)
38
- jekyll-sass-converter (1.5.2)
39
- sass (~> 3.4)
39
+ terminal-table (~> 2.0)
40
+ jekyll-sass-converter (2.2.0)
41
+ sassc (> 2.0.1, < 3.0)
40
42
  jekyll-watch (2.2.1)
41
43
  listen (~> 3.0)
42
- kramdown (2.3.1)
44
+ kramdown (2.4.0)
43
45
  rexml
46
+ kramdown-parser-gfm (1.1.0)
47
+ kramdown (~> 2.0)
44
48
  liquid (4.0.3)
45
49
  listen (3.7.1)
46
50
  rb-fsevent (~> 0.10, >= 0.10.3)
47
51
  rb-inotify (~> 0.9, >= 0.9.10)
48
- mercenary (0.3.6)
49
- parallel (1.20.1)
50
- parser (3.1.0.0)
52
+ mercenary (0.4.0)
53
+ parallel (1.22.1)
54
+ parser (3.1.2.0)
51
55
  ast (~> 2.4.1)
52
56
  pathutil (0.16.2)
53
57
  forwardable-extended (~> 2.6)
54
- public_suffix (4.0.6)
58
+ public_suffix (4.0.7)
55
59
  rainbow (3.1.1)
56
60
  rake (13.0.6)
57
- rb-fsevent (0.11.0)
61
+ rb-fsevent (0.11.1)
58
62
  rb-inotify (0.10.1)
59
63
  ffi (~> 1.0)
60
- regexp_parser (2.2.0)
64
+ regexp_parser (2.3.1)
61
65
  rexml (3.2.5)
62
- rouge (3.27.0)
63
- rspec (3.10.0)
64
- rspec-core (~> 3.10.0)
65
- rspec-expectations (~> 3.10.0)
66
- rspec-mocks (~> 3.10.0)
67
- rspec-core (3.10.2)
68
- rspec-support (~> 3.10.0)
69
- rspec-expectations (3.10.2)
66
+ rouge (3.28.0)
67
+ rspec (3.11.0)
68
+ rspec-core (~> 3.11.0)
69
+ rspec-expectations (~> 3.11.0)
70
+ rspec-mocks (~> 3.11.0)
71
+ rspec-core (3.11.0)
72
+ rspec-support (~> 3.11.0)
73
+ rspec-expectations (3.11.0)
70
74
  diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.10.0)
72
- rspec-mocks (3.10.3)
75
+ rspec-support (~> 3.11.0)
76
+ rspec-mocks (3.11.1)
73
77
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.10.0)
75
- rspec-support (3.10.3)
76
- rubocop (1.12.1)
78
+ rspec-support (~> 3.11.0)
79
+ rspec-support (3.11.0)
80
+ rubocop (1.28.2)
77
81
  parallel (~> 1.10)
78
- parser (>= 3.0.0.0)
82
+ parser (>= 3.1.0.0)
79
83
  rainbow (>= 2.2.2, < 4.0)
80
84
  regexp_parser (>= 1.8, < 3.0)
81
85
  rexml
82
- rubocop-ast (>= 1.2.0, < 2.0)
86
+ rubocop-ast (>= 1.17.0, < 2.0)
83
87
  ruby-progressbar (~> 1.7)
84
88
  unicode-display_width (>= 1.4.0, < 3.0)
85
- rubocop-ast (1.4.1)
86
- parser (>= 2.7.1.5)
87
- rubocop-rake (0.5.1)
88
- rubocop
89
- rubocop-rspec (2.2.0)
89
+ rubocop-ast (1.17.0)
90
+ parser (>= 3.1.1.0)
91
+ rubocop-rake (0.6.0)
90
92
  rubocop (~> 1.0)
91
- rubocop-ast (>= 1.1.0)
93
+ rubocop-rspec (2.10.0)
94
+ rubocop (~> 1.19)
92
95
  ruby-progressbar (1.11.0)
93
96
  safe_yaml (1.0.5)
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)
97
+ sassc (2.4.0)
98
+ ffi (~> 1.9)
99
+ terminal-table (2.0.0)
100
+ unicode-display_width (~> 1.1, >= 1.1.1)
101
+ unicode-display_width (1.8.0)
100
102
 
101
103
  PLATFORMS
102
- ruby
104
+ x86_64-darwin-21
105
+ x86_64-linux
103
106
 
104
107
  DEPENDENCIES
105
- bundler (~> 2.0)
108
+ bundler (~> 2.1)
106
109
  jekyll-indico!
107
110
  rake (~> 13.0)
108
111
  rspec (~> 3.0)
109
- rubocop (~> 1.9)
110
- rubocop-rake (~> 0.5)
112
+ rubocop (~> 1.25)
113
+ rubocop-rake (~> 0.6)
111
114
  rubocop-rspec (~> 2.2)
112
115
 
113
116
  BUNDLED WITH
114
- 2.2.8
117
+ 2.3.13
data/README.md CHANGED
@@ -14,6 +14,8 @@ 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
16
  cache-command: bundle exec rake cache # Optional, user msg if you support it
17
+ paginate: 20 # Optional integer number of results per page (auto-iterates over all pages)
18
+ timeout: 120 # Optional timeout in number of seconds (default: 60)
17
19
  ids:
18
20
  topical: 10570
19
21
  blueprint: 11329
@@ -18,10 +18,14 @@ end.parse!
18
18
  puts "Reading #{options[:config]}"
19
19
 
20
20
  config = YAML.safe_load(File.read(options[:config]))
21
- meeting_ids = JekyllIndico::Meetings.meeting_ids(config)
22
- base_url = JekyllIndico::Meetings.base_url(config)
21
+ meeting_ids = config.dig('indico', 'ids')
22
+ base_url = config.dig('indico', 'url')
23
23
  data_path = config.dig('indico', 'data') || 'indico'
24
24
 
25
+ raise MissingURL, 'indico: url: MISSING from your config!' unless base_url
26
+ raise MissingIDs, 'indico: ids: MISSING from your config!' unless meeting_ids
27
+ raise MissingIDs, 'indico: ids: must be a hash!' unless meeting_ids.is_a?(Hash)
28
+
25
29
  JekyllIndico.cache(base_url, meeting_ids, data_path) do |name, number|
26
30
  puts "Accessing #{number} for #{name}"
27
31
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.metadata['changelog_uri'] = 'https://github.com/iris-hep/jekyll-indico/blob/main/CHANGELOG.md'
21
21
  else
22
22
  raise 'RubyGems 2.0 or newer is required to protect against ' \
23
- 'public gem pushes.'
23
+ 'public gem pushes.'
24
24
  end
25
25
 
26
26
  # Specify which files should be added to the gem when it is released.
@@ -32,14 +32,15 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ['lib']
34
34
 
35
- spec.required_ruby_version = '>= 2.4.0'
35
+ spec.required_ruby_version = '>= 2.6.0'
36
36
 
37
37
  spec.add_dependency 'jekyll', '>= 3.8', '< 5.0'
38
38
 
39
- spec.add_development_dependency 'bundler', '~> 2.0'
39
+ spec.add_development_dependency 'bundler', '~> 2.1'
40
40
  spec.add_development_dependency 'rake', '~> 13.0'
41
41
  spec.add_development_dependency 'rspec', '~> 3.0'
42
- spec.add_development_dependency 'rubocop', '~> 1.9'
43
- spec.add_development_dependency 'rubocop-rake', '~> 0.5'
42
+ spec.add_development_dependency 'rubocop', '~> 1.25'
43
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
44
44
  spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
45
+ spec.metadata['rubygems_mfa_required'] = 'true'
45
46
  end
@@ -23,13 +23,13 @@ module JekyllIndico
23
23
  attr_accessor :dict
24
24
 
25
25
  # ID for IRIS-HEP: 10570
26
- def initialize(base_url, indico_id, **kargs)
26
+ def initialize(base_url, indico_id, limit: nil, **kargs)
27
27
  @dict = {}
28
28
 
29
- download_and_iterate(base_url, indico_id, **kargs) do |i|
29
+ download_and_iterate(base_url, indico_id, limit: limit, **kargs) do |i|
30
30
  # Trim paragraph tags
31
31
  d = i['description']
32
- d = d[3..-1] if d.start_with? '<p>'
32
+ d = d[3..] if d.start_with? '<p>'
33
33
  d = d[0..-5] if d.end_with? '</p>'
34
34
 
35
35
  start_date = Date.parse i['startDate']['date']
@@ -62,28 +62,43 @@ module JekyllIndico
62
62
 
63
63
  private
64
64
 
65
- # Run a block over each item in the downloaded results
66
- def download_and_iterate(base_url, indico_id, timeout: nil, **params, &block)
67
- params[:pretty] = 'no'
65
+ def get_parsed_results(base_url, indico_id, timeout: nil, **params)
66
+ opts = { use_ssl: true }
67
+ opts[:read_timeout] = timeout if timeout
68
+
68
69
  uri = URI.join(base_url, "/export/categ/#{indico_id}.json")
69
70
  uri.query = URI.encode_www_form(params)
70
71
 
71
72
  req = Net::HTTP::Get.new(uri)
72
73
  if ENV['INDICO_TOKEN']
73
- req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}"
74
- elsif ENV['INDICO_SECRET_KEY'] || ENV['INDICO_API_KEY']
74
+ req['Authorization'] = "Bearer #{ENV.fetch('INDICO_TOKEN', nil)}"
75
+ elsif ENV.fetch('INDICO_SECRET_KEY', nil) || ENV.fetch('INDICO_API_KEY', nil)
75
76
  raise Error, 'Use INDICO_TOKEN with a new-style token'
76
77
  end
77
78
 
78
- opts = { use_ssl: true }
79
- opts[:read_timeout] = timeout if timeout
80
-
81
79
  response = Net::HTTP.start(uri.hostname, uri.port, **opts) { |http| http.request(req) }
82
80
 
83
- string = response.body
84
- parsed = JSON.parse(string) # returns a hash
81
+ parsed = JSON.parse(response.body)
82
+ parsed['results']
83
+ end
84
+
85
+ # Run a block over each item in the downloaded results
86
+ def download_and_iterate(base_url, indico_id, limit: nil, **params, &block)
87
+ limit = nil if limit.zero?
88
+ params[:limit] = limit if limit
89
+ params[:pretty] = 'no'
85
90
 
86
- parsed['results'].each(&block)
91
+ unless limit
92
+ results = get_parsed_results(base_url, indico_id, **params)
93
+ results.each(&block)
94
+ return
95
+ end
96
+
97
+ 0.step.each do |n|
98
+ results = get_parsed_results(base_url, indico_id, offset: n * limit, **params)
99
+ results.each(&block)
100
+ break if results.length < limit
101
+ end
87
102
  end
88
103
  end
89
104
  end
@@ -35,6 +35,7 @@ module JekyllIndico
35
35
  @site.data[data_path] = {} unless @site.data.key? data_path
36
36
 
37
37
  timeout = @site.config.dig('indico', 'timeout')
38
+ limit = @site.config.dig('indico', 'paginate')
38
39
 
39
40
  # Do nothing if already downloaded
40
41
  return if @site.data[data_path].key? name
@@ -42,7 +43,7 @@ module JekyllIndico
42
43
  msg = @cache_msg ? " - run `#{@cache_msg}` to cache" : ''
43
44
  print "Accessing Indico meeting API for #{name}:#{number}#{msg}"
44
45
  time = Benchmark.realtime do
45
- iris_meeting = Meetings.new(base_url, number, timeout: timeout)
46
+ iris_meeting = Meetings.new(base_url, number, timeout: timeout, limit: limit)
46
47
  @site.data[data_path][name] = iris_meeting.dict
47
48
  end
48
49
  puts ", took #{time.round(1)} s"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllIndico
4
- VERSION = '0.4.5'
4
+ VERSION = '0.6.1'
5
5
  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.5
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Schreiner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-02 00:00:00.000000000 Z
11
+ date: 2022-05-06 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: '2.0'
39
+ version: '2.1'
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: '2.0'
46
+ version: '2.1'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '1.9'
81
+ version: '1.25'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '1.9'
88
+ version: '1.25'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rubocop-rake
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0.5'
95
+ version: '0.6'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0.5'
102
+ version: '0.6'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rubocop-rspec
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -151,6 +151,7 @@ metadata:
151
151
  homepage_uri: https://rubygems.org/gems/jekyll-indico
152
152
  source_code_uri: https://github.com/iris-hep/jekyll-indico
153
153
  changelog_uri: https://github.com/iris-hep/jekyll-indico/blob/main/CHANGELOG.md
154
+ rubygems_mfa_required: 'true'
154
155
  post_install_message:
155
156
  rdoc_options: []
156
157
  require_paths:
@@ -159,15 +160,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
160
  requirements:
160
161
  - - ">="
161
162
  - !ruby/object:Gem::Version
162
- version: 2.4.0
163
+ version: 2.6.0
163
164
  required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
166
  - - ">="
166
167
  - !ruby/object:Gem::Version
167
168
  version: '0'
168
169
  requirements: []
169
- rubyforge_project:
170
- rubygems_version: 2.6.14.4
170
+ rubygems_version: 3.0.3.1
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Read and/or cache indico meeting lists for Jekyll