Class: Bozo::BozoConfiguration
- Inherits:
-
Object
- Object
- Bozo::BozoConfiguration
- Includes:
- ClassNameHelpers
- Defined in:
- lib/bozo/bozo_configuration.rb
Overview
Class used for defining the configuration of a build.
Instance Attribute Summary collapse
-
#compilers ⇒ Object
readonly
Returns the configured compilers.
-
#dependency_resolvers ⇒ Object
readonly
Returns the configured dependency resolvers.
-
#hooks ⇒ Object
readonly
Returns the configured hooks.
-
#packagers ⇒ Object
readonly
Returns the configured packagers.
-
#preparers ⇒ Object
readonly
Returns the configured preparers.
-
#publishers ⇒ Object
readonly
Returns the configured publishers.
-
#test_runners ⇒ Object
readonly
Returns the configured test runners.
Instance Method Summary collapse
-
#build_tools ⇒ Object
Returns the all the build tools required by the specified compilers, dependency resolvers, hooks, packagers, publishers and test runners.
-
#build_tools_location(location = nil) ⇒ Object
The location of the base build tools.
-
#compile_with(type, &block) ⇒ Object
Adds an instance of the named compiler to the compiler collection and yields it to the configuration block when one is specified.
-
#initialize ⇒ BozoConfiguration
constructor
Creates a new instance.
-
#load(path) ⇒ Object
Loads the configuration from the specified file.
-
#package_with(type, &block) ⇒ Object
Adds an instance of the named packager to the packager collection and yields it to the configuration block when one is specified.
-
#prepare(type, &block) ⇒ Object
Adds an instance of the named preparer to the preparer collection and yields it to the configuration block when one is specified.
-
#publish_with(type, &block) ⇒ Object
Adds an instance of the named publisher to the publisher collection and yields it to the configuration block when one is specified.
-
#resolve_dependencies_with(type, &block) ⇒ Object
Adds an instance of the named dependency resolver to the dependency resolver collection and yields it to the configuration block when one is specified.
-
#test_with(type, &block) ⇒ Object
Adds an instance of the named test runner to the test runner collection and yields it to the configuration block when one is specified.
-
#version ⇒ Object
The version of the project to build.
-
#with_hook(type, &block) ⇒ Object
(also: #pre_build, #pre_clean, #post_clean, #pre_uninstall, #post_uninstall, #pre_dependencies, #post_dependencies, #pre_prepare, #post_prepare, #pre_compile, #post_compile, #pre_test, #post_test, #pre_package, #post_package, #pre_publish, #post_publish, #post_build)
Adds an instance of the named hook to the hook collection and yields it to the configuration block when one is specified.
Methods included from ClassNameHelpers
Constructor Details
#initialize ⇒ BozoConfiguration
Creates a new instance
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bozo/bozo_configuration.rb', line 9 def initialize @build_tools_location = nil @compilers = [] @dependency_resolvers = [] @hooks = [] @packagers = [] @preparers = [] @publishers = [] @test_runners = [] @version = nil end |
Instance Attribute Details
#compilers ⇒ Object (readonly)
Returns the configured compilers.
94 95 96 |
# File 'lib/bozo/bozo_configuration.rb', line 94 def compilers @compilers end |
#dependency_resolvers ⇒ Object (readonly)
Returns the configured dependency resolvers.
64 65 66 |
# File 'lib/bozo/bozo_configuration.rb', line 64 def dependency_resolvers @dependency_resolvers end |
#hooks ⇒ Object (readonly)
Returns the configured hooks.
150 151 152 |
# File 'lib/bozo/bozo_configuration.rb', line 150 def hooks @hooks end |
#packagers ⇒ Object (readonly)
Returns the configured packagers.
122 123 124 |
# File 'lib/bozo/bozo_configuration.rb', line 122 def packagers @packagers end |
#preparers ⇒ Object (readonly)
Returns the configured preparers.
78 79 80 |
# File 'lib/bozo/bozo_configuration.rb', line 78 def preparers @preparers end |
#publishers ⇒ Object (readonly)
Returns the configured publishers.
136 137 138 |
# File 'lib/bozo/bozo_configuration.rb', line 136 def publishers @publishers end |
#test_runners ⇒ Object (readonly)
Returns the configured test runners.
108 109 110 |
# File 'lib/bozo/bozo_configuration.rb', line 108 def test_runners @test_runners end |
Instance Method Details
#build_tools ⇒ Object
Returns the all the build tools required by the specified compilers, dependency resolvers, hooks, packagers, publishers and test runners.
53 54 55 56 57 58 59 60 61 |
# File 'lib/bozo/bozo_configuration.rb', line 53 def build_tools build_tools = get_build_tools @compilers build_tools |= get_build_tools @dependency_resolvers build_tools |= get_build_tools @hooks build_tools |= get_build_tools @packagers build_tools |= get_build_tools @preparers build_tools |= get_build_tools @publishers build_tools | (get_build_tools @test_runners) end |
#build_tools_location(location = nil) ⇒ Object
The location of the base build tools.
Sets and returns the location if a value is provided, otherwise returns the current value.
It is expected the build tools will be in sub-directory of this location according to the name of the tool and that the runner will be able to copy the contents of the sub-directory to a local directory via the ‘FileUtils.cp_r` method.
46 47 48 49 |
# File 'lib/bozo/bozo_configuration.rb', line 46 def build_tools_location(location = nil) @build_tools_location = location if location @build_tools_location end |
#compile_with(type, &block) ⇒ Object
Adds an instance of the named compiler to the compiler collection and yields it to the configuration block when one is specified.
103 104 105 |
# File 'lib/bozo/bozo_configuration.rb', line 103 def compile_with(type, &block) # :yields: compiler add_instance @compilers, Bozo::Compilers, type, block end |
#load(path) ⇒ Object
Loads the configuration from the specified file.
25 26 27 |
# File 'lib/bozo/bozo_configuration.rb', line 25 def load(path) instance_eval IO.read(path), path end |
#package_with(type, &block) ⇒ Object
Adds an instance of the named packager to the packager collection and yields it to the configuration block when one is specified.
131 132 133 |
# File 'lib/bozo/bozo_configuration.rb', line 131 def package_with(type, &block) # :yields: packager add_instance @packagers, Bozo::Packagers, type, block end |
#prepare(type, &block) ⇒ Object
Adds an instance of the named preparer to the preparer collection and yields it to the configuration block when one is specified.
73 74 75 |
# File 'lib/bozo/bozo_configuration.rb', line 73 def prepare(type, &block) # :yields: preparer add_instance @preparers, Bozo::Preparers, type, block end |
#publish_with(type, &block) ⇒ Object
Adds an instance of the named publisher to the publisher collection and yields it to the configuration block when one is specified.
145 146 147 |
# File 'lib/bozo/bozo_configuration.rb', line 145 def publish_with(type, &block) # :yields: publisher add_instance @publishers, Bozo::Publishers, type, block end |
#resolve_dependencies_with(type, &block) ⇒ Object
Adds an instance of the named dependency resolver to the dependency resolver collection and yields it to the configuration block when one is specified.
89 90 91 |
# File 'lib/bozo/bozo_configuration.rb', line 89 def resolve_dependencies_with(type, &block) # :yields: dependency_resolver add_instance @dependency_resolvers, Bozo::DependencyResolvers, type, block end |
#test_with(type, &block) ⇒ Object
Adds an instance of the named test runner to the test runner collection and yields it to the configuration block when one is specified.
117 118 119 |
# File 'lib/bozo/bozo_configuration.rb', line 117 def test_with(type, &block) # :yields: test_runner add_instance @test_runners, Bozo::TestRunners, type, block end |
#version ⇒ Object
The version of the project to build.
30 31 32 |
# File 'lib/bozo/bozo_configuration.rb', line 30 def version @version ||= Versioning::Version.load_from_file end |
#with_hook(type, &block) ⇒ Object Also known as: pre_build, pre_clean, post_clean, pre_uninstall, post_uninstall, pre_dependencies, post_dependencies, pre_prepare, post_prepare, pre_compile, post_compile, pre_test, post_test, pre_package, post_package, pre_publish, post_publish, post_build
Adds an instance of the named hook to the hook collection and yields it to the configuration block when one is specified.
159 160 161 |
# File 'lib/bozo/bozo_configuration.rb', line 159 def with_hook(type, &block) # :yields: hook add_instance @hooks, Bozo::Hooks, type, block end |