Class: Judges::Push
Overview
The push command.
This class is instantiated by the bin/judge command line interface. You are not supposed to instantiate it yourself.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(loog) ⇒ Push
constructor
A new instance of Push.
- #run(opts, args) ⇒ Object
Constructor Details
#initialize(loog) ⇒ Push
Returns a new instance of Push.
38 39 40 |
# File 'lib/judges/commands/push.rb', line 38 def initialize(loog) @loog = loog end |
Instance Method Details
#run(opts, args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/judges/commands/push.rb', line 42 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 = Judges::Baza.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 ) elapsed(@loog) do baza.lock(name, opts['owner']) id = baza.push(name, fb.export, opts['meta'] || []) baza.unlock(name, opts['owner']) throw :"Pushed #{fb.size} facts, job ID is #{id}" end end |