Class: LogPoop

Inherits:
Object
  • Object
show all
Defined in:
lib/logpoop.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogPoop

Returns a new instance of LogPoop.



45
46
47
48
# File 'lib/logpoop.rb', line 45

def initialize
  options = self.class.parse_options
  Runner::Context.run(options)    
end

Class Method Details



11
12
13
14
15
16
# File 'lib/logpoop.rb', line 11

def self.banner
  <<-STR
Description:
Look busy! Tail some stuff in your open terminals, or even simulate running some tests. 
STR
end

.instanceObject



41
42
43
# File 'lib/logpoop.rb', line 41

def self.instance
  @@instance
end

.parse_optionsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/logpoop.rb', line 18

def self.parse_options
  options = {
    :type => :tail,
    :log_dir => "/var/log"
  }

  o = OptionParser.new do |opt|
    opt.banner = self.banner
    opt.on("-v", "--version", "Show version") do
      puts File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
      exit
    end
    opt.on("-d", "--log_dir DIRECTORY", "Log directory") do |d|
      options[:log_dir] = d
    end
    opt.on("-t", "--type TYPE", "Poop type. Available types:\n\tpoop - take a dump in your terminal\n\ttail - simulate 'tail -f' in all your open terminals\n\ttest - simulate a console test run (needs two terminals open)") do |t|
      options[:type] = t
    end
  end
  o.parse!
  options
end