class CalendariumRomanum::CLI

Implementation of the calendariumrom executable. Not loaded by default when you require the gem.

@api private

Public Instance Methods

calendars() click to toggle source
# File lib/calendarium-romanum/cli.rb, line 41
def calendars
  Data.each {|c| puts c.siglum }
end
cmp(a, b) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 61
def cmp(a, b)
  properties = Comparator::DEFAULT_PROPERTIES
  options.each_key do |k|
    if k.start_with? 'no_'
      properties.delete k.sub('no_', '').to_sym
    else
      properties << k.to_sym
    end
  end
  Comparator.new(properties).call(a, b) || exit(1)
end
dump(year) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 91
def dump(year)
  Dumper.new.regression_tests_dump year.to_i
end
errors(*files) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 46
def errors(*files)
  files.each do |path|
    begin
      sanctorale_from_path path
    rescue Errno::ENOENT, InvalidDataError => err
      die! err.message
    end
  end
end
id(file) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 82
def id(file)
  sanctorale_from_path(file).each_day do |_, celebrations|
    celebrations.each do |c|
      puts c.symbol if c.symbol
    end
  end
end
merge(*files) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 75
def merge(*files)
  sanctoralia = files.collect {|path| sanctorale_from_path path }
  merged = SanctoraleFactory.create_layered *sanctoralia
  SanctoraleWriter.new(front_matter: options[:front_matter]).write merged, STDOUT
end
query(date_str = nil) click to toggle source
# File lib/calendarium-romanum/cli.rb, line 34
def query(date_str = nil)
  Querier
    .new(locale: options[:locale], calendar: options[:calendar])
    .call(date_str)
end
version() click to toggle source
# File lib/calendarium-romanum/cli.rb, line 96
def version
  puts 'calendarium-romanum CLI'
  puts "calendarium-romanum: version #{CalendariumRomanum::VERSION}, released #{CalendariumRomanum::RELEASE_DATE}"
end