class Judges::Push
- License
- MIT
Copyright - Copyright © 2024-2025 Yegor Bugayenko
Author -
Yegor Bugayenko (yegor256@gmail.com)
are not supposed to instantiate it yourself.
This class is instantiated by thebin/judge
command line interface. You
Thepush
command.
- Copyright © 2024-2025 Yegor Bugayenko
- MIT
def initialize(loog)
-
loog
(Loog
) -- Logging facility
def initialize(loog) @loog = loog end
def run(opts, args)
-
(RuntimeError)
- If not exactly two arguments provided
Parameters:
-
args
(Array
) -- List of command line arguments -
opts
(Hash
) -- Command line options (start with '--')
def run(opts, args) raise 'Exactly two arguments required' unless args.size == 2 name = args[0] fb = Judges::Impex.new(@loog, args[1]).import baza = BazaRb.new( opts['host'], opts['port'].to_i, opts['token'], ssl: opts['ssl'], timeout: (opts['timeout'] || 30).to_i, loog: @loog, retries: (opts['retries'] || 3).to_i, compress: opts.fetch('zip', true) ) elapsed(@loog, level: Logger::INFO) do baza.lock(name, opts['owner']) begin id = baza.push(name, fb.export, opts['meta'] || []) throw :"👍 Pushed #{fb.size} facts, job ID is #{id}" ensure baza.unlock(name, opts['owner']) end end end