Sha256: 2a26f427d79252c6ac6062ce61f0fcb502a083aad3a3b8a4cd6b1e4700b8f789

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

require 'trollop'
require 'fssm'

module OCRunner
  module CLI
    def self.run
      
      Kernel.trap('INT') { puts; exit }
      
      opts = Trollop::options do
        version_number = File.read(File.join(File.dirname(__FILE__), '../../VERSION')).strip
        version "#{version_number} (c) 2010 Jim Benton github.com/jim/ocrunner"
        banner <<-EOS
      ocrunner is a small ruby wrapper for running automated XCode builds.

      Usage:
             ocrunner [options]
      where [options] are:
      EOS
        opt :sdk, "SDK to build against", :default => 'iphonesimulator3.1.3'
        opt :target, 'Target to build', :default => 'Test'
        opt :config, "Configuration to use", :default => 'Debug'
        opt :parallel, "Use multiple processors to build multiple targets (parallelizeTargets)", :type => :boolean, :default => true
        opt :auto, "Watch filesystem for changes and run tests when they occur", :type => :boolean, :default => false
        opt :growl, "Report results using Growl", :type => :boolean, :default => false
        opt :debug_command, "Print xcodebuild command and exit", :type => :boolean, :default => false
        opt :verbose, "Display all xcodebuild output after summary", :type => :boolean, :default => false
        opt :loud_compilation, "Always show verbose output when a compilation or linking error occurs", :type => :boolean, :default => true
      end
      
      execute = Proc.new{ OCRunner::TestRunner.new(opts) }
      execute.call
      
      if opts[:auto]
        FSSM.monitor(Dir.pwd, %w{**/*.m **/*.h}) do
          create { |base, relative| execute.call }
          update { |base, relative| execute.call }
          delete { |base, relative| execute.call }
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ocrunner-0.2.5 lib/ocrunner/cli.rb