Module: OCRunner::CLI
- Extended by:
- Console
- Defined in:
- lib/ocrunner/cli.rb
Instance Attribute Summary
Attributes included from Console
Class Method Summary collapse
Methods included from Console
blue, clean_path, colorize, execute, green, growl, indent, out, present, red
Class Method Details
.run ⇒ Object
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ocrunner/cli.rb', line 11 def self.run Kernel.trap('INT') { puts; exit } opts = Trollop:: do version_number = File.read(File.join(File.dirname(__FILE__), '../../VERSION')).strip version "#{version_number} (c) 2010 Jim Benton github.com/jim/ocrunner" " ocrunner is a small ruby wrapper for running automated XCode builds.\n\n Usage:\n ocrunner [options]\n where [options] are:\n EOS\n opt :sdk, \"SDK to build against\", :default => 'iphonesimulator3.1.3'\n opt :target, 'Target to build', :default => 'Test'\n opt :config, \"Configuration to use\", :default => 'Debug'\n opt :parallel, \"Use multiple processors to build multiple targets (parallelizeTargets)\", :type => :boolean, :default => true\n opt :auto, \"Watch filesystem for changes and run tests when they occur\", :type => :boolean, :default => false\n opt :growl, \"Report results using Growl\", :type => :boolean, :default => false\n opt :debug_command, \"Print xcodebuild command and exit\", :type => :boolean, :default => false\n opt :verbose, \"Display all xcodebuild output after summary\", :type => :boolean, :default => false\n opt :loud_compilation, \"Always show verbose output when a compilation or linking error occurs\", :type => :boolean, :default => true\n opt :oclog_help, \"Print OCLog code example and exit\", :type => :boolean, :default => false\n end\n \n if opts[:oclog_help]\n present do\n puts indent blue \"Add this to a header or prefix file in your Xcode project:\"\n puts indent '#define OCLog(format, ...) NSLog([NSString stringWithFormat: @\"%s:%d:%s:\\033[35m%@\\033[0m\", __PRETTY_FUNCTION__, __LINE__, __FILE__, format], ## __VA_ARGS__)'\n puts indent '#define OCOLog(object) OCLog(@\"%@\", object)'\n end\n exit\n end\n \n execute = Proc.new{ OCRunner::TestRunner.new(opts) }\n\n Kernel.trap('QUIT') { opts[:verbose] = !opts[:verbose]; execute.call}\n\n execute.call\n \n if opts[:auto]\n FSSM.monitor(Dir.pwd, %w{**/*.m **/*.h **/*.pch}) do\n create { |base, relative| execute.call }\n update { |base, relative| execute.call }\n delete { |base, relative| execute.call }\n end\n end\n \nend\n" |