Class: Gizzard::InjectCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gizzard/commands.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #buffer, #command_options, #global_options, #job_injector, #manager

Instance Method Summary collapse

Methods inherited from Command

classify, #confirm!, #get_base_name, #help!, #initialize, make_job_injector, make_manager, #output, #require_tables, #require_template_options, run

Constructor Details

This class inherits a constructor from Gizzard::Command

Instance Method Details

#runObject



719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/gizzard/commands.rb', line 719

def run
  count     = 0
  page_size = 20
  priority, *jobs = @argv
  help!("Requires priority") unless priority and jobs.size > 0

  jobs.each_slice(page_size) do |js|
    job_injector.inject_jobs(js.map {|j| Job.new(priority.to_i, j) })

    count += 1
    # FIXME add -q --quiet option
    STDERR.print "."
    STDERR.print "#{count * page_size}" if count % 10 == 0
    STDERR.flush
  end
  STDERR.print "\n"
end