jekyll-indico 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d9222f10d181e9fc090dede1530321b6d25cf1f25c847ed701b0b27d0dc09aef
4
+ data.tar.gz: 7ef2fef6b5dfdab7f5e54afda3471180f262e0fda96f86e65cb477ce95bc3875
5
+ SHA512:
6
+ metadata.gz: b8cd5282b1d97250f191825b79d74a9a1e10457dbaa7a959cca6526e3232fc8fa2f209b3c453ef05499232f202be4dc7259066991383a99cf25776f79d78b86f
7
+ data.tar.gz: e99096baf780ed5ebafd2d63b262bcb526f1caf0b075c0eecc1a8353233c836b361fea73140f93535be7b7757977e84648ef030a5551f6aafd9d5d1553183ee3
@@ -0,0 +1,22 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches: [ $default-branch ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.4
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,65 @@
1
+
2
+ # Created by https://www.toptal.com/developers/gitignore/api/ruby
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=ruby
4
+
5
+ ### Ruby ###
6
+ *.gem
7
+ *.rbc
8
+ /.config
9
+ /coverage/
10
+ /InstalledFiles
11
+ /pkg/
12
+ /spec/reports/
13
+ /spec/examples.txt
14
+ /test/tmp/
15
+ /test/version_tmp/
16
+ /tmp/
17
+
18
+ # Used by dotenv library to load environment variables.
19
+ # .env
20
+
21
+ # Ignore Byebug command history file.
22
+ .byebug_history
23
+
24
+ ## Specific to RubyMotion:
25
+ .dat*
26
+ .repl_history
27
+ build/
28
+ *.bridgesupport
29
+ build-iPhoneOS/
30
+ build-iPhoneSimulator/
31
+
32
+ ## Specific to RubyMotion (use of CocoaPods):
33
+ #
34
+ # We recommend against adding the Pods directory to your .gitignore. However
35
+ # you should judge for yourself, the pros and cons are mentioned at:
36
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
37
+ # vendor/Pods/
38
+
39
+ ## Documentation cache and generated files:
40
+ /.yardoc/
41
+ /_yardoc/
42
+ /doc/
43
+ /rdoc/
44
+
45
+ ## Environment normalization:
46
+ /.bundle/
47
+ /vendor/bundle
48
+ /lib/bundler/man/
49
+
50
+ # for a library or gem, you might want to ignore these files since the code is
51
+ # intended to run in multiple environments; otherwise, check them in:
52
+ # Gemfile.lock
53
+ # .ruby-version
54
+ # .ruby-gemset
55
+
56
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
57
+ .rvmrc
58
+
59
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
60
+ # .rubocop-https?--*
61
+
62
+ # End of https://www.toptal.com/developers/gitignore/api/ruby
63
+ #
64
+ /_data
65
+ /.rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ Metrics/MethodLength:
2
+ Max: 25
3
+ Metrics/AbcSize:
4
+ Max: 55
5
+ Style/NumericLiterals:
6
+ Enabled: false
7
+ Naming/FileName:
8
+ Enabled: false
9
+ AllCops:
10
+ NewCops: enable
11
+ TargetRubyVersion: 2.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Version 0.1.0
2
+
3
+ First version to be published, pulled from the IRIS-HEP website.
4
+
5
+ Extra features added during the transition include:
6
+ * Config settings for IDs and data path.
7
+ * `jekyll-indico-cache` script has customizable `--config` location.
8
+ * Some basic unit testing
9
+ * Better separation into files
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at henryschreineriii@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,117 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-indico (0.1.0)
5
+ jekyll (>= 3.8, < 5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.2)
13
+ colorator (1.1.0)
14
+ concurrent-ruby (1.1.8)
15
+ diff-lcs (1.4.4)
16
+ em-websocket (0.5.2)
17
+ eventmachine (>= 0.12.9)
18
+ http_parser.rb (~> 0.6.0)
19
+ eventmachine (1.2.7)
20
+ ffi (1.14.2)
21
+ forwardable-extended (2.6.0)
22
+ http_parser.rb (0.6.0)
23
+ i18n (1.8.8)
24
+ concurrent-ruby (~> 1.0)
25
+ jekyll (4.2.0)
26
+ addressable (~> 2.4)
27
+ colorator (~> 1.0)
28
+ em-websocket (~> 0.5)
29
+ i18n (~> 1.0)
30
+ jekyll-sass-converter (~> 2.0)
31
+ jekyll-watch (~> 2.0)
32
+ kramdown (~> 2.3)
33
+ kramdown-parser-gfm (~> 1.0)
34
+ liquid (~> 4.0)
35
+ mercenary (~> 0.4.0)
36
+ pathutil (~> 0.9)
37
+ rouge (~> 3.0)
38
+ safe_yaml (~> 1.0)
39
+ terminal-table (~> 2.0)
40
+ jekyll-sass-converter (2.1.0)
41
+ sassc (> 2.0.1, < 3.0)
42
+ jekyll-watch (2.2.1)
43
+ listen (~> 3.0)
44
+ kramdown (2.3.0)
45
+ rexml
46
+ kramdown-parser-gfm (1.1.0)
47
+ kramdown (~> 2.0)
48
+ liquid (4.0.3)
49
+ listen (3.4.1)
50
+ rb-fsevent (~> 0.10, >= 0.10.3)
51
+ rb-inotify (~> 0.9, >= 0.9.10)
52
+ mercenary (0.4.0)
53
+ parallel (1.20.1)
54
+ parser (3.0.0.0)
55
+ ast (~> 2.4.1)
56
+ pathutil (0.16.2)
57
+ forwardable-extended (~> 2.6)
58
+ public_suffix (4.0.6)
59
+ rainbow (3.0.0)
60
+ rake (13.0.3)
61
+ rb-fsevent (0.10.4)
62
+ rb-inotify (0.10.1)
63
+ ffi (~> 1.0)
64
+ regexp_parser (2.0.3)
65
+ rexml (3.2.4)
66
+ rouge (3.26.0)
67
+ rspec (3.10.0)
68
+ rspec-core (~> 3.10.0)
69
+ rspec-expectations (~> 3.10.0)
70
+ rspec-mocks (~> 3.10.0)
71
+ rspec-core (3.10.1)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-expectations (3.10.1)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.10.0)
76
+ rspec-mocks (3.10.2)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.10.0)
79
+ rspec-support (3.10.2)
80
+ rubocop (1.9.1)
81
+ parallel (~> 1.10)
82
+ parser (>= 3.0.0.0)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.8, < 3.0)
85
+ rexml
86
+ rubocop-ast (>= 1.2.0, < 2.0)
87
+ ruby-progressbar (~> 1.7)
88
+ unicode-display_width (>= 1.4.0, < 3.0)
89
+ rubocop-ast (1.4.1)
90
+ parser (>= 2.7.1.5)
91
+ rubocop-rake (0.5.1)
92
+ rubocop
93
+ rubocop-rspec (2.2.0)
94
+ rubocop (~> 1.0)
95
+ rubocop-ast (>= 1.1.0)
96
+ ruby-progressbar (1.11.0)
97
+ safe_yaml (1.0.5)
98
+ sassc (2.4.0)
99
+ ffi (~> 1.9)
100
+ terminal-table (2.0.0)
101
+ unicode-display_width (~> 1.1, >= 1.1.1)
102
+ unicode-display_width (1.7.0)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ bundler (~> 1.17)
109
+ jekyll-indico!
110
+ rake (~> 13.0)
111
+ rspec (~> 3.0)
112
+ rubocop (~> 1.9)
113
+ rubocop-rake (~> 0.5)
114
+ rubocop-rspec (~> 2.2)
115
+
116
+ BUNDLED WITH
117
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Henry Schreiner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ This is a tool for importing meeting information from Indico.
2
+
3
+ #### Setup: config
4
+
5
+ Your `_config.yaml` file should contain the categories you want to download:
6
+
7
+ ```yaml
8
+ indico:
9
+ data: indico # Optional, folder name in _data to use
10
+ ids:
11
+ topical: 10570
12
+ blueprint: 11329
13
+ ```
14
+
15
+
16
+ This plugin will automatically sign your requests if your environment contains
17
+ `INDICO_API` and `INDICO_SECRET_KEY`.
18
+
19
+ #### Usage: installing
20
+
21
+
22
+ You should add this gem to your Gemfile:
23
+
24
+ ```ruby
25
+ group :jekyll_plugins do
26
+ gem "jekyll-indico"
27
+ end
28
+ ```
29
+
30
+ Jekyll will use any plugin listed in this Gemfile group.
31
+
32
+ #### Usage: caching
33
+
34
+ If you want to cache for local website development, you can run:
35
+
36
+ ```bash
37
+ bundle exec jekyll-indico-cache --config _config.yaml
38
+ ```
39
+
40
+ <!-- Feature not added yet
41
+ Or, if you use rake, you can add the provided task:
42
+
43
+ ```ruby
44
+ require 'jekyll-indico/rake_task'
45
+
46
+ JekyllIndico::RakeTask.new(:cache)
47
+ ```
48
+
49
+ Now the "cache" task will cache your Indico reads.
50
+ -->
51
+
52
+ #### Setting up for development:
53
+
54
+
55
+ ```bash
56
+ # Install a local bundle
57
+ bundle install --path vendor/bundle
58
+
59
+ # Test style and unit tests
60
+ bundle exec rake
61
+ ```
62
+
63
+ To release, make sure the version is new then:
64
+
65
+ ```bash
66
+ bundle exec rake publish
67
+ ```
68
+
69
+ This tags, pushes the tag, and publishes.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ RuboCop::RakeTask.new(:rubocop)
10
+
11
+ task default: %i[rubocop spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'jekyll/indico'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+ require 'yaml'
6
+ require 'optparse'
7
+
8
+ require 'jekyll-indico/cache'
9
+
10
+ options = { config: '_config.yml' }
11
+
12
+ OptionParser.new do |opts|
13
+ opts.on('-c', '--config=FILE', 'Read a config file') do |c|
14
+ options[:config] = c
15
+ end
16
+ end.parse!
17
+
18
+ puts "Reading #{options[:config]}"
19
+
20
+ config = YAML.safe_load(File.read(options[:config]))
21
+ meeting_ids = JekyllIndico::Meetings.meeting_ids(config)
22
+ data_path = config.dig('indico', 'data') || 'indico'
23
+
24
+ JekyllIndico.cache(meeting_ids, data_path) do |name, number|
25
+ puts "Accessing #{number} for #{name}"
26
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'jekyll-indico/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'jekyll-indico'
9
+ spec.version = JekyllIndico::VERSION
10
+ spec.authors = ['Henry Schreiner']
11
+ spec.email = ['henryschreineriii@gmail.com']
12
+
13
+ spec.summary = 'Read and/or cache indico meeting lists for Jekyll'
14
+ spec.homepage = 'https://rubygems.org/gems/jekyll-indico'
15
+ spec.license = 'MIT'
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/iris-hep/jekyll-indico'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/iris-hep/jekyll-indico/blob/main/CHANGELOG.md'
21
+ else
22
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
23
+ 'public gem pushes.'
24
+ end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.required_ruby_version = '>= 2.4.0'
36
+
37
+ spec.add_dependency 'jekyll', '>= 3.8', '< 5.0'
38
+
39
+ spec.add_development_dependency 'bundler', '~> 1.17'
40
+ spec.add_development_dependency 'rake', '~> 13.0'
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'
44
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
45
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll-indico/generator'
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+ require 'yaml'
5
+
6
+ require 'jekyll-indico/core'
7
+
8
+ # The main module for this package.
9
+ module JekyllIndico
10
+ # This will cache the hash of meeting IDs given into the data_path in _data
11
+ # in the current directory.
12
+ def self.cache(meeting_ids, data_path)
13
+ meeting_ids.each do |name, number|
14
+ yield name, number
15
+ indico_dir = Pathname.new('_data') / data_path
16
+ folder = indico_dir / name.to_s
17
+ indico_dir.mkdir unless indico_dir.directory?
18
+ folder.mkdir unless folder.directory?
19
+
20
+ iris_meeting = JekyllIndico::Meetings.new number
21
+ iris_meeting.to_files(folder) { |key| puts "Making #{folder / key}.yml\n" }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'json'
6
+ require 'yaml'
7
+ require 'date'
8
+ require 'time'
9
+ require 'openssl'
10
+
11
+ module JekyllIndico
12
+ # Look for topical meetings
13
+ class Meetings
14
+ attr_accessor :dict
15
+
16
+ # ID for IRIS-HEP: 10570
17
+ def initialize(indico_id, **kargs)
18
+ @dict = {}
19
+
20
+ download_and_iterate(indico_id, **kargs) do |i|
21
+ # Trim paragraph tags
22
+ d = i['description']
23
+ d = d[3..-1] if d.start_with? '<p>'
24
+ d = d[0..-5] if d.end_with? '</p>'
25
+
26
+ start_date = Date.parse i['startDate']['date']
27
+ fname = start_date.strftime('%Y%m%d').to_s
28
+
29
+ youtube = ''
30
+ urllist = URI.extract(d)
31
+ urllist.each do |url|
32
+ youtube = url if url.include?('youtube') || url.include?('youtu.be')
33
+ end
34
+
35
+ @dict[fname] = {
36
+ 'name' => i['title'],
37
+ 'startdate' => start_date,
38
+ 'meetingurl' => i['url'],
39
+ 'location' => i['location'],
40
+ 'youtube' => youtube,
41
+ 'description' => d
42
+ }
43
+ end
44
+ end
45
+
46
+ # Write out files (Folder given, by key name)
47
+ def to_files(folder)
48
+ @dict.each do |key, dict|
49
+ yield key if block_given?
50
+ file.write(folder / "#{key}.yml", dict.to_yaml)
51
+ end
52
+ end
53
+
54
+ # Get meeting ids from a config
55
+ def self.meeting_ids(config = {})
56
+ config.dig('indico', 'ids')
57
+ end
58
+
59
+ private
60
+
61
+ # Run a block over each item in the downloaded results
62
+ def download_and_iterate(indico_id, **kargs, &block)
63
+ url = build_url(indico_id, **kargs)
64
+ uri = URI.parse(url)
65
+ response = Net::HTTP.get_response(uri)
66
+
67
+ string = response.body
68
+ parsed = JSON.parse(string) # returns a hash
69
+
70
+ parsed['results'].each(&block)
71
+ end
72
+
73
+ # Put together a dict and an indico ID
74
+ def join_url(indico_id, options)
75
+ apicall = options.sort.to_h.map { |k, v| "#{k}=#{v}" }.join('&')
76
+ "/export/categ/#{indico_id}.json?#{apicall}"
77
+ end
78
+
79
+ # Automatically signs request if environment has INDICO_API/SECRET_KEY
80
+ def build_url(indico_id, **kargs)
81
+ kargs[:pretty] = 'no'
82
+
83
+ if ENV['INDICO_API_KEY']
84
+ kargs[:ak] = ENV['INDICO_API_KEY']
85
+ if ENV['INDICO_SECRET_KEY']
86
+ kargs[:timestamp] = Time.new.to_i.to_s
87
+ requeststr = join_url(indico_id, kargs)
88
+ kargs[:signature] = OpenSSL::HMAC.hexdigest('SHA1', ENV['INDICO_SECRET_KEY'], requeststr)
89
+ end
90
+ end
91
+
92
+ "https://indico.cern.ch#{join_url(indico_id, kargs)}"
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ require 'jekyll'
6
+
7
+ require 'jekyll-indico/core'
8
+
9
+ module JekyllIndico
10
+ # This is a Jekyll Generator
11
+ class GetIndico < Jekyll::Generator
12
+ # Main entry point for Jekyll
13
+ def generate(site)
14
+ @site = site
15
+
16
+ meeting_ids = Meetings.meeting_ids(@site.config)
17
+ meeting_ids.each do |name, number|
18
+ collect_meeting name.to_s, number
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def collect_meeting(name, number)
25
+ data_path = @site.config.dig('indico', 'data') || 'indico'
26
+ @site.data[data_path] = {} unless @site.data.key? data_path
27
+
28
+ # Do nothing if already downloaded
29
+ return if @site.data[data_path].key? name
30
+
31
+ puts "Accessing Indico meeting API for #{name}:#{number} " \
32
+ '- run `bundle exec rake cache` to cache'
33
+ iris_meeting = Meetings.new(number)
34
+ @site.data[data_path][name] = iris_meeting.dict
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllIndico
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-indico
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Henry Schreiner
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.8'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.8'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.17'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.17'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '13.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.9'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.9'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop-rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.5'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.5'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop-rspec
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.2'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '2.2'
117
+ description:
118
+ email:
119
+ - henryschreineriii@gmail.com
120
+ executables:
121
+ - jekyll-indico-cache
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - ".github/workflows/ci.yml"
126
+ - ".gitignore"
127
+ - ".rspec"
128
+ - ".rubocop.yml"
129
+ - CHANGELOG.md
130
+ - CODE_OF_CONDUCT.md
131
+ - Gemfile
132
+ - Gemfile.lock
133
+ - LICENSE.txt
134
+ - README.md
135
+ - Rakefile
136
+ - bin/console
137
+ - bin/setup
138
+ - exe/jekyll-indico-cache
139
+ - jekyll-indico.gemspec
140
+ - lib/jekyll-indico.rb
141
+ - lib/jekyll-indico/cache.rb
142
+ - lib/jekyll-indico/core.rb
143
+ - lib/jekyll-indico/generator.rb
144
+ - lib/jekyll-indico/version.rb
145
+ homepage: https://rubygems.org/gems/jekyll-indico
146
+ licenses:
147
+ - MIT
148
+ metadata:
149
+ homepage_uri: https://rubygems.org/gems/jekyll-indico
150
+ source_code_uri: https://github.com/iris-hep/jekyll-indico
151
+ changelog_uri: https://github.com/iris-hep/jekyll-indico/blob/main/CHANGELOG.md
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 2.4.0
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubygems_version: 3.0.3
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: Read and/or cache indico meeting lists for Jekyll
171
+ test_files: []