Module: Bard::CLI::Hurt

Defined in:
lib/bard/cli/hurt.rb

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bard/cli/hurt.rb', line 2

def self.included mod
  mod.class_eval do

    desc "hurt <command>", "reruns a command until it fails"
    def hurt *args
      (1..).each do |count|
        puts "Running attempt #{count}"
        system *args
        unless $?.success?
          puts "Ran #{count-1} times before failing"
          break
        end
      end
    end

  end
end