5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/autotestforphp/cli.rb', line 5
def self.execute(stdout, arguments=['--run'])
arguments = ['--run'] unless arguments.size > 0
OptionParser.new do |opts|
opts.banner = <<-BANNER.gsub(/^ /,'')
Usage: #{File.basename($0)} [options]
Options are:
BANNER
opts.separator("")
opts.on('-i', '--install',
'Install AutotestForPHP') do
Autotestforphp.install
stdout.puts 'Autotest for PHP was installed successfully'
end
opts.on('-r', '--run',
'Run AutotestForPHP (default)') do
config_file = File.expand_path('./autotestforphp/config.autotest')
load config_file if File.exist?(config_file)
unless defined?(FOLDERS_TO_WATCH)
folders = ["./src/**/*", "./test/**/*", "./app/**/*", "./lib/**/*"]
else
folders = FOLDERS_TO_WATCH
end
Autotestforphp.run(folders)
end
opts.on("-h", "--help",
"Show this help message.") { stdout.puts opts; exit }
opts.parse!(arguments)
end
end
|