jekyll-indico 0.4.0 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42dd6e02ca0145cbd0ab2678b896340909141d15
4
- data.tar.gz: 91e3c5ae03e1508c8fb515281ca2ade408c1d453
3
+ metadata.gz: 5c14daf72a602a2600ce825c5298012ab6be48c8
4
+ data.tar.gz: dd1509e11a7b0f2a969a6d2ed442e5103daecc60
5
5
  SHA512:
6
- metadata.gz: 63de08c462ef249ee2e0502aefd8c8104861b3c14f209df3df876875b61f8d6f5632a3ea8c1ae7cb21433c00b2f337cca7bf30163aca07ae5503d3d5ef8c8527
7
- data.tar.gz: c3cec693a86e94decf78b38af462ef7632ba567242171297feeba47af30f49d640f9c75da3d082ce575f045d2a979eeec680db49932c37afafe6dee845a5cb9b
6
+ metadata.gz: bc20db3a1b0ab7b9d4e200bd0be98873a7ba21fdf576277d6960d7567dbce04bd1bd706864cbbe20fd80f374785035c2a010cc9420b16b1b13501a7fbee78a52
7
+ data.tar.gz: e6d791bfb92c05281dcbf9ec2d3ab56cc05692b5a4980f6f724e02bc9f646a23bc697bca963fdefc5ddb62085b7208dbd3d7015a5742cca42d109ce71003f67c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # Version 0.4.4
2
+
3
+ Fix timeout being incorrectly called.
4
+
5
+ # Version 0.4.3
6
+
7
+ Fix warning message for classic tokens. Add time prinout to help judge need for
8
+ timeout setting.
9
+
10
+ # Version 0.4.2
11
+
12
+ Remove broken support for classic tokens. Modern `INDICO_TOKEN` required.
13
+
14
+ # Version 0.4.1
15
+
16
+ Fix a few issues in Jekyll generator.
17
+
1
18
  # Version 0.4.0
2
19
 
3
20
  Support `INDICO_TOKEN`, replaces the [deprecated indico URL
data/Gemfile.lock CHANGED
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-indico (0.4.0)
4
+ jekyll-indico (0.4.4)
5
5
  jekyll (>= 3.8, < 5.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.7.0)
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.8)
15
- diff-lcs (1.4.4)
16
- em-websocket (0.5.2)
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.6.0)
18
+ http_parser.rb (~> 0)
19
19
  eventmachine (1.2.7)
20
- ffi (1.15.0)
20
+ ffi (1.15.5)
21
21
  forwardable-extended (2.6.0)
22
- http_parser.rb (0.6.0)
22
+ http_parser.rb (0.8.0)
23
23
  i18n (0.9.5)
24
24
  concurrent-ruby (~> 1.0)
25
- jekyll (3.9.0)
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.4.1)
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.0.0.0)
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.0.0)
56
- rake (13.0.3)
57
- rb-fsevent (0.10.4)
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.3)
61
- rexml (3.2.4)
62
- rouge (3.26.0)
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.1)
67
+ rspec-core (3.10.2)
68
68
  rspec-support (~> 3.10.0)
69
- rspec-expectations (3.10.1)
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.2)
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.2)
76
- rubocop (1.9.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.0.0)
99
+ unicode-display_width (2.1.0)
100
100
 
101
101
  PLATFORMS
102
102
  ruby
data/README.md CHANGED
@@ -20,9 +20,9 @@ indico:
20
20
  ```
21
21
 
22
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`.
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.
26
26
 
27
27
  #### Usage: installing
28
28
 
@@ -63,13 +63,18 @@ module JekyllIndico
63
63
  private
64
64
 
65
65
  # Run a block over each item in the downloaded results
66
- def download_and_iterate(base_url, indico_id, **kargs, &block)
66
+ def download_and_iterate(base_url, indico_id, timeout: nil, **params, &block)
67
+ params[:pretty] = 'no'
67
68
  uri = URI.join(base_url, "/export/categ/#{indico_id}.json")
68
- params = build_params(**kargs)
69
69
  uri.query = URI.encode_www_form(params)
70
70
 
71
71
  req = Net::HTTP::Get.new(uri)
72
- req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}" if ENV['INDICO_TOKEN']
72
+ req.read_timeout = timeout if timeout
73
+ if ENV['INDICO_TOKEN']
74
+ req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}"
75
+ elsif ENV['INDICO_SECRET_KEY'] || ENV['INDICO_API_KEY']
76
+ raise Error, 'Use INDICO_TOKEN with a new-style token'
77
+ end
73
78
 
74
79
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
75
80
 
@@ -78,21 +83,5 @@ module JekyllIndico
78
83
 
79
84
  parsed['results'].each(&block)
80
85
  end
81
-
82
- # Automatically signs request if environment has INDICO_API/SECRET_KEY
83
- def build_params(**kargs)
84
- kargs[:pretty] = 'no'
85
-
86
- if ENV['INDICO_API_KEY'] && !ENV['INDICO_TOKEN']
87
- kargs[:ak] = ENV['INDICO_API_KEY']
88
- if ENV['INDICO_SECRET_KEY']
89
- kargs[:timestamp] = Time.new.to_i.to_s
90
- requeststr = join_url(indico_id, kargs)
91
- kargs[:signature] = OpenSSL::HMAC.hexdigest('SHA1', ENV['INDICO_SECRET_KEY'], requeststr)
92
- end
93
- end
94
-
95
- kargs
96
- end
97
86
  end
98
87
  end
@@ -1,13 +1,13 @@
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'
6
8
 
7
9
  require 'jekyll-indico/core'
8
10
 
9
- require 'net/http'
10
-
11
11
  module JekyllIndico
12
12
  # This is a Jekyll Generator
13
13
  class GetIndico < Jekyll::Generator
@@ -16,12 +16,9 @@ module JekyllIndico
16
16
  @site = site
17
17
  @cache_msg = @site.config.dig('indico', 'cache-command')
18
18
 
19
- timeout = @site.config.dig('indico', 'timeout')
20
- Net::HTTP.read_timeout = timeout if timeout
21
-
22
19
  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)
20
+ raise MissingIDs, 'indico: ids: MISSING from your config!' unless meeting_ids
21
+ raise MissingIDs, 'indico: ids: must be a hash!' unless meeting_ids.is_a?(Hash)
25
22
 
26
23
  meeting_ids.each do |name, number|
27
24
  collect_meeting(name.to_s, number)
@@ -32,18 +29,23 @@ module JekyllIndico
32
29
 
33
30
  def collect_meeting(name, number)
34
31
  base_url = @site.config.dig('indico', 'url')
35
- raise MissingURL('indico: url: MISSING from your config!') unless url
32
+ raise MissingURL, 'indico: url: MISSING from your config!' unless base_url
36
33
 
37
34
  data_path = @site.config.dig('indico', 'data') || 'indico'
38
35
  @site.data[data_path] = {} unless @site.data.key? data_path
39
36
 
37
+ timeout = @site.config.dig('indico', 'timeout')
38
+
40
39
  # Do nothing if already downloaded
41
40
  return if @site.data[data_path].key? name
42
41
 
43
42
  msg = @cache_msg ? " - run `#{@cache_msg}` to cache" : ''
44
- puts "Accessing Indico meeting API for #{name}:#{number}#{msg}"
45
- iris_meeting = Meetings.new(base_url, number)
46
- @site.data[data_path][name] = iris_meeting.dict
43
+ print "Accessing Indico meeting API for #{name}:#{number}#{msg}"
44
+ time = Benchmark.realtime do
45
+ iris_meeting = Meetings.new(base_url, number, timeout: timeout)
46
+ @site.data[data_path][name] = iris_meeting.dict
47
+ end
48
+ puts ", took #{time.round(1)} s"
47
49
  end
48
50
  end
49
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllIndico
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.4'
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.0
4
+ version: 0.4.4
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-01 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll