Class: Gizzard::BaseTransformCommand

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



815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
# File 'lib/gizzard/commands.rb', line 815

def run
  scheduler_options = command_options.scheduler_options || {}
  be_quiet          = global_options.force && command_options.quiet

  scheduler_options[:quiet] = be_quiet

  transformations = get_transformations
  transformations.reject! {|t,trees| t.noop? or trees.empty? }

  if transformations.empty?
    puts "Nothing to do!"
    exit
  end

  base_name = get_base_name(transformations)

  unless be_quiet
    transformations.each do |transformation, trees|
      puts transformation.inspect
      puts "Applied to #{trees.length} shards"
      #trees.keys.sort.each {|f| puts "  #{f.inspect}" }
    end
    puts ""
  end

  confirm!

  Gizzard.schedule! manager,
                    base_name,
                    transformations,
                    scheduler_options
end