Sha256: c2dc86ce22db0c5f76cb057984cda7821b860a929aaea6ed352580d0d84fa5b9

Contents?: true

Size: 769 Bytes

Versions: 2

Compression:

Stored size: 769 Bytes

Contents

require_relative 'options'
require_relative 'locator'
require_relative 'sweeper'

module Stowaway
  class Runner
    
    def initialize(argv)
      @options = Options.new(argv)
    end
    
    def run
      locator = Stowaway::Locator.new(@options.file_types)
      files = locator.find_all @options.path

      fs = Stowaway::Sweeper.new files
      respond fs.sweep @options.path
    end
    
    private
    def respond(not_found)
      if not_found.empty?
        print "Zero stowaways found. You run a tight ship.\n\n"
      else
        print "\nYou have #{not_found.length} stowaway(s)\n"
        print "--------------------------\n\n"
        not_found.each_with_index { |f, i| print "#{i+1}: #{f.fullpath}\n" }
        print "\n"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stowaway-0.0.4 lib/stowaway/runner.rb
stowaway-0.0.1 lib/stowaway/runner.rb