Sha256: bc781ecf1e212684e5c1cf0815fafdb140f1863048e896cf2a1298abe4b519b1

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pathname'
require 'yaml'
require 'optparse'

require 'jekyll-indico/cache'

options = { config: '_config.yml' }

OptionParser.new do |opts|
  opts.on('-c', '--config=FILE', 'Read a config file') do |c|
    options[:config] = c
  end
end.parse!

puts "Reading #{options[:config]}"

config = YAML.safe_load(File.read(options[:config]))
meeting_ids = config.dig('indico', 'ids')
base_url = config.dig('indico', 'url')
data_path = config.dig('indico', 'data') || 'indico'

raise MissingURL, 'indico: url: MISSING from your config!' unless base_url
raise MissingIDs, 'indico: ids: MISSING from your config!' unless meeting_ids
raise MissingIDs, 'indico: ids: must be a hash!' unless meeting_ids.is_a?(Hash)

JekyllIndico.cache(base_url, meeting_ids, data_path) do |name, number|
  puts "Accessing #{number} for #{name}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-indico-0.6.2 exe/jekyll-indico-cache
jekyll-indico-0.6.1 exe/jekyll-indico-cache