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).



567
568
569
# File 'lib/buildr/core/compile.rb', line 567

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.



578
579
580
581
# File 'lib/buildr/core/compile.rb', line 578

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'


90
91
92
# File 'lib/buildr/core/environment.rb', line 90

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.



671
672
673
674
675
676
677
678
679
680
681
682
683
# File 'lib/buildr/core/test.rb', line 671

def test
  case value = ENV['TEST'] || ENV['test']
  when /^(no|off|false|skip)$/i
    false
  when /^all$/i
    :all
  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


694
695
696
697
# File 'lib/buildr/core/test.rb', line 694

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