Class: Buildr::Options

Inherits:
Object show all
Defined in:
lib/buildr/core/environment.rb,
lib/buildr/core/test.rb,
lib/buildr/core/build.rb,
lib/buildr/core/compile.rb

Overview

Collection of options for controlling Buildr.

Defined Under Namespace

Classes: EnvArray, Proxies

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parallelObject

Runs the build in parallel when true (defaults to false). You can force a parallel build by setting this option directly, or by running the parallel task ahead of the build task.

This option only affects recursive tasks. For example:

buildr parallel package

will run all package tasks (from the sub-projects) in parallel, but each sub-project’s package task runs its child tasks (prepare, compile, resources, etc) in sequence.



34
35
36
# File 'lib/buildr/core/build.rb', line 34

def parallel
  @parallel
end

Instance Method Details

#debugObject

Returns the debug option (environment variable DEBUG).



585
586
587
# File 'lib/buildr/core/compile.rb', line 585

def debug
  (ENV['DEBUG'] || ENV['debug']) !~ /(no|off|false)/
end

#debug=(flag) ⇒ Object

Sets the debug option (environment variable DEBUG).

You can turn this option off directly, or by setting the environment variable DEBUG to no. For example:

buildr build DEBUG=no

The release tasks runs a build with DEBUG=no.



596
597
598
599
# File 'lib/buildr/core/compile.rb', line 596

def debug=(flag)
  ENV['debug'] = nil
  ENV['DEBUG'] = flag.to_s
end

#proxyObject

:call-seq:

proxy => options

Returns the proxy options. Currently supported options are:

  • :http – HTTP proxy for use when downloading.

  • :exclude – Do not use proxy for these hosts/domains.

For example:

options.proxy.http = 'http://proxy.acme.com:8080'

You can also set it using the environment variable HTTP_PROXY.

You can exclude individual hosts from being proxied, or entire domains, for example:

options.proxy.exclude = 'optimus'
options.proxy.exclude = ['optimus', 'prime']
options.proxy.exclude << '*.internal'


102
103
104
# File 'lib/buildr/core/environment.rb', line 102

def proxy
  @proxy ||= Proxies.new
end

#testObject

Returns the test option (environment variable TEST). Possible values are:

  • :false – Do not run any tests (also accepts ‘no’ and ‘skip’).

  • :true – Run all tests, stop on failure (default if not set).

  • :all – Run all tests, ignore failures.



728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
# File 'lib/buildr/core/test.rb', line 728

def test
  case value = ENV['TEST'] || ENV['test']
  when /^(no|off|false|skip)$/i
    false
  when /^all$/i
    :all
  when /^only$/i
    :only
  when /^(yes|on|true)$/i, nil
    true
  else
    warn "Expecting the environment variable test to be 'no' or 'all', not sure what to do with #{value}, so I'm just going to run all the tests and stop at failure."
    true
  end
end

#test=(flag) ⇒ Object

Sets the test option (environment variable TEST). Possible values are true, false or :all.

You can also set this from the environment variable, e.g.:

buildr          # With tests
buildr test=no  # Without tests
buildr test=all # Ignore failures
set TEST=no
buildr          # Without tests


753
754
755
756
# File 'lib/buildr/core/test.rb', line 753

def test=(flag)
  ENV['test'] = nil
  ENV['TEST'] = flag.to_s
end