bozo 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +443 -426
- data/VERSION +1 -1
- data/bin/bozo +8 -8
- data/lib/bozo.rb +131 -130
- data/lib/bozo/bozo.rb +6 -6
- data/lib/bozo/bozo_configuration.rb +319 -299
- data/lib/bozo/build_dependency_resolver.rb +106 -0
- data/lib/bozo/class_name_helpers.rb +16 -16
- data/lib/bozo/configuration_error.rb +29 -29
- data/lib/bozo/execution_error.rb +35 -35
- data/lib/bozo/executor.rb +263 -288
- data/lib/bozo/logging.rb +40 -40
- data/lib/bozo/runner.rb +63 -63
- data/lib/bozo/versioning/version.rb +96 -96
- data/lib/bozo/versioning/version_bump_error.rb +29 -29
- data/lib/bozo/versioning/version_bumper.rb +36 -36
- data/test/bozo_configuration_version_tests.rb +41 -41
- data/test/test_helper.rb +2 -2
- data/test/version_bumper_tests.rb +61 -61
- data/test/version_tests.rb +25 -25
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/bin/bozo
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.push File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "rainbow"
|
6
|
-
require "bozo"
|
7
|
-
|
8
|
-
# Invoke the command
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.push File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "rainbow"
|
6
|
+
require "bozo"
|
7
|
+
|
8
|
+
# Invoke the command
|
9
9
|
exit GLI.run(ARGV)
|
data/lib/bozo.rb
CHANGED
@@ -1,131 +1,132 @@
|
|
1
|
-
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rainbow'
|
5
|
-
require 'rainbow/ext/string'
|
6
|
-
require 'gli'
|
7
|
-
require 'gli_version'
|
8
|
-
require 'bozo/bozo'
|
9
|
-
require 'bozo/class_name_helpers'
|
10
|
-
require 'bozo/logging'
|
11
|
-
require 'bozo/
|
12
|
-
require 'bozo/
|
13
|
-
require 'bozo/
|
14
|
-
require 'bozo/
|
15
|
-
require 'bozo/
|
16
|
-
require 'bozo/
|
17
|
-
require 'bozo/versioning/
|
18
|
-
require 'bozo/versioning/
|
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
|
-
config.
|
48
|
-
|
49
|
-
|
50
|
-
puts
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
c
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
c.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
c.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
version_bumper
|
117
|
-
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
puts
|
129
|
-
|
130
|
-
|
1
|
+
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rainbow'
|
5
|
+
require 'rainbow/ext/string'
|
6
|
+
require 'gli'
|
7
|
+
require 'gli_version'
|
8
|
+
require 'bozo/bozo'
|
9
|
+
require 'bozo/class_name_helpers'
|
10
|
+
require 'bozo/logging'
|
11
|
+
require 'bozo/build_dependency_resolver'
|
12
|
+
require 'bozo/runner'
|
13
|
+
require 'bozo/executor'
|
14
|
+
require 'bozo/bozo_configuration'
|
15
|
+
require 'bozo/configuration_error'
|
16
|
+
require 'bozo/execution_error'
|
17
|
+
require 'bozo/versioning/version'
|
18
|
+
require 'bozo/versioning/version_bumper'
|
19
|
+
require 'bozo/versioning/version_bump_error'
|
20
|
+
|
21
|
+
include GLI
|
22
|
+
|
23
|
+
# Set the location of the bozo runtime configuration file
|
24
|
+
config_file '.bozorc'
|
25
|
+
|
26
|
+
version Bozo::VERSION
|
27
|
+
|
28
|
+
desc 'Run as a build server, allows more destructive actions'
|
29
|
+
switch 'build-server'
|
30
|
+
|
31
|
+
default_config_file = 'bozorc.rb'
|
32
|
+
|
33
|
+
desc "The build configuration file (defaults to #{default_config_file})"
|
34
|
+
default_value default_config_file
|
35
|
+
arg_name 'path'
|
36
|
+
flag 'config-file'
|
37
|
+
|
38
|
+
default_environment = 'development'
|
39
|
+
|
40
|
+
desc "The build environment (defaults to #{default_environment})"
|
41
|
+
default_value default_environment
|
42
|
+
arg_name 'name'
|
43
|
+
flag :environment
|
44
|
+
|
45
|
+
pre do |global_options, command, options, arguments|
|
46
|
+
# Load the configuration file.
|
47
|
+
config = Bozo::BozoConfiguration.new
|
48
|
+
config.load global_options[:'config-file']
|
49
|
+
|
50
|
+
puts "Building #{config.version} using Bozo #{Bozo::VERSION}"
|
51
|
+
puts ''
|
52
|
+
|
53
|
+
# Initialize the executor.
|
54
|
+
@executor = Bozo::Executor.new config, global_options
|
55
|
+
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
# Helper method for defining a command that invokes a bozo task.
|
60
|
+
#
|
61
|
+
# The first provided name will be passed on to bozo.
|
62
|
+
#
|
63
|
+
# Takes an optional block for defining command-specific flags and switches.
|
64
|
+
#
|
65
|
+
# @param [Symbol] command_names
|
66
|
+
# The names to give the command.
|
67
|
+
def bozo_command(*command_names)
|
68
|
+
command_name = command_names.first
|
69
|
+
command command_names do |c|
|
70
|
+
yield c if block_given?
|
71
|
+
c.action do |global_options, options, arguments|
|
72
|
+
@executor.execute command_name, options, ENV.to_hash
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
desc 'Remove bozo and all its artifacts'
|
78
|
+
bozo_command :uninstall
|
79
|
+
|
80
|
+
desc 'Remove all build artifacts'
|
81
|
+
bozo_command :clean
|
82
|
+
|
83
|
+
desc 'Retrieve all project dependencies'
|
84
|
+
bozo_command :dependencies
|
85
|
+
|
86
|
+
desc 'Prepare the project'
|
87
|
+
bozo_command :prepare
|
88
|
+
|
89
|
+
desc 'Compile the project'
|
90
|
+
bozo_command :compile, :c
|
91
|
+
|
92
|
+
desc 'Run the tests for the project'
|
93
|
+
bozo_command :test, :t
|
94
|
+
|
95
|
+
desc 'Create a package'
|
96
|
+
bozo_command :package, :p do |c|
|
97
|
+
c.desc 'Force a pre-release package to be created'
|
98
|
+
c.switch 'pre-release'
|
99
|
+
end
|
100
|
+
|
101
|
+
desc 'Publish a package'
|
102
|
+
bozo_command :publish do |c|
|
103
|
+
c.desc 'Force a pre-release package to be published'
|
104
|
+
c.switch 'pre-release'
|
105
|
+
end
|
106
|
+
|
107
|
+
desc 'Bump the version number'
|
108
|
+
long_desc <<EOS
|
109
|
+
Specify either 'major', 'minor' or 'patch' as an argument. For example: `bozo bump major`
|
110
|
+
EOS
|
111
|
+
command :bump do |c|
|
112
|
+
c.action do |global_options, options, args|
|
113
|
+
if args.empty?
|
114
|
+
puts "Specify either 'major', 'minor' or 'patch' as an argument"
|
115
|
+
else
|
116
|
+
version_bumper = Bozo::Versioning::VersionBumper.new
|
117
|
+
version_bumper.bump args[0].to_sym
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
on_error do |exception|
|
123
|
+
puts exception.inspect.color(:red).bright
|
124
|
+
|
125
|
+
if exception.kind_of? Bozo::ExecutionError or exception.kind_of? Bozo::ConfigurationError
|
126
|
+
false
|
127
|
+
else
|
128
|
+
puts ''
|
129
|
+
puts exception.backtrace.join("\n").color(:red)
|
130
|
+
true
|
131
|
+
end
|
131
132
|
end
|
data/lib/bozo/bozo.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# The top level module for Bozo's functionality.
|
2
|
-
module Bozo
|
3
|
-
|
4
|
-
# The version of Bozo in use.
|
5
|
-
VERSION = File.read(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../../VERSION')).strip
|
6
|
-
|
1
|
+
# The top level module for Bozo's functionality.
|
2
|
+
module Bozo
|
3
|
+
|
4
|
+
# The version of Bozo in use.
|
5
|
+
VERSION = File.read(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../../VERSION')).strip
|
6
|
+
|
7
7
|
end
|
@@ -1,300 +1,320 @@
|
|
1
|
-
module Bozo
|
2
|
-
|
3
|
-
# Class used for defining the configuration of a build.
|
4
|
-
class BozoConfiguration
|
5
|
-
|
6
|
-
include Bozo::ClassNameHelpers
|
7
|
-
|
8
|
-
# Creates a new instance
|
9
|
-
def initialize
|
10
|
-
@build_tools_location = nil
|
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
|
-
# the
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
|
47
|
-
|
48
|
-
@build_tools_location
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
build_tools
|
56
|
-
build_tools |= get_build_tools @
|
57
|
-
build_tools |= get_build_tools @
|
58
|
-
build_tools |= get_build_tools @
|
59
|
-
build_tools |= get_build_tools @
|
60
|
-
build_tools
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
# @param [
|
116
|
-
#
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
# @param [
|
130
|
-
#
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
# @param [
|
144
|
-
#
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
# @param [
|
158
|
-
#
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
# to the
|
169
|
-
|
170
|
-
|
171
|
-
#
|
172
|
-
#
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
180
|
-
# to the configuration block when one is specified.
|
181
|
-
alias :
|
182
|
-
|
183
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
184
|
-
# to the configuration block when one is specified.
|
185
|
-
alias :
|
186
|
-
|
187
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
188
|
-
# to the configuration block when one is specified.
|
189
|
-
alias :
|
190
|
-
|
191
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
192
|
-
# to the configuration block when one is specified.
|
193
|
-
alias :
|
194
|
-
|
195
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
196
|
-
# to the configuration block when one is specified.
|
197
|
-
alias :
|
198
|
-
|
199
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
200
|
-
# to the configuration block when one is specified.
|
201
|
-
alias :
|
202
|
-
|
203
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
204
|
-
# to the configuration block when one is specified.
|
205
|
-
alias :
|
206
|
-
|
207
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
208
|
-
# to the configuration block when one is specified.
|
209
|
-
alias :
|
210
|
-
|
211
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
212
|
-
# to the configuration block when one is specified.
|
213
|
-
alias :
|
214
|
-
|
215
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
216
|
-
# to the configuration block when one is specified.
|
217
|
-
alias :
|
218
|
-
|
219
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
220
|
-
# to the configuration block when one is specified.
|
221
|
-
alias :
|
222
|
-
|
223
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
224
|
-
# to the configuration block when one is specified.
|
225
|
-
alias :
|
226
|
-
|
227
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
228
|
-
# to the configuration block when one is specified.
|
229
|
-
alias :
|
230
|
-
|
231
|
-
# Adds an instance of the named hook to the hook collection and yields it
|
232
|
-
# to the configuration block when one is specified.
|
233
|
-
alias :
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
#
|
240
|
-
#
|
241
|
-
|
242
|
-
|
243
|
-
#
|
244
|
-
#
|
245
|
-
|
246
|
-
|
247
|
-
#
|
248
|
-
#
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
# @param [
|
262
|
-
#
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
end
|
287
|
-
|
288
|
-
# Module containing all
|
289
|
-
module
|
290
|
-
end
|
291
|
-
|
292
|
-
# Module containing all
|
293
|
-
module
|
294
|
-
end
|
295
|
-
|
296
|
-
# Module containing all
|
297
|
-
module
|
298
|
-
end
|
299
|
-
|
1
|
+
module Bozo
|
2
|
+
|
3
|
+
# Class used for defining the configuration of a build.
|
4
|
+
class BozoConfiguration
|
5
|
+
|
6
|
+
include Bozo::ClassNameHelpers
|
7
|
+
|
8
|
+
# Creates a new instance
|
9
|
+
def initialize
|
10
|
+
@build_tools_location = nil
|
11
|
+
@tools = []
|
12
|
+
@compilers = []
|
13
|
+
@dependency_resolvers = []
|
14
|
+
@hooks = []
|
15
|
+
@packagers = []
|
16
|
+
@preparers = []
|
17
|
+
@publishers = []
|
18
|
+
@test_runners = []
|
19
|
+
@version = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
# Loads the configuration from the specified file.
|
23
|
+
#
|
24
|
+
# @param [String] path
|
25
|
+
# The path to the configuration file.
|
26
|
+
def load(path)
|
27
|
+
instance_eval IO.read(path), path
|
28
|
+
end
|
29
|
+
|
30
|
+
# The version of the project to build.
|
31
|
+
def version
|
32
|
+
@version ||= Versioning::Version.load_from_file
|
33
|
+
end
|
34
|
+
|
35
|
+
# The location of the base build tools.
|
36
|
+
#
|
37
|
+
# Sets and returns the location if a value is provided, otherwise returns
|
38
|
+
# the current value.
|
39
|
+
#
|
40
|
+
# It is expected the build tools will be in sub-directory of this location
|
41
|
+
# according to the name of the tool and that the runner will be able to
|
42
|
+
# copy the contents of the sub-directory to a local directory via the
|
43
|
+
# `FileUtils.cp_r` method.
|
44
|
+
#
|
45
|
+
# @param [String] location
|
46
|
+
# The path to set as the build tools location.
|
47
|
+
def build_tools_location(location = nil)
|
48
|
+
@build_tools_location = location if location
|
49
|
+
@build_tools_location
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns the all the build tools required by the specified compilers,
|
53
|
+
# dependency resolvers, hooks, packagers, publishers and test runners.
|
54
|
+
def build_tools
|
55
|
+
build_tools = get_build_tools @compilers
|
56
|
+
build_tools |= get_build_tools @dependency_resolvers
|
57
|
+
build_tools |= get_build_tools @hooks
|
58
|
+
build_tools |= get_build_tools @packagers
|
59
|
+
build_tools |= get_build_tools @preparers
|
60
|
+
build_tools |= get_build_tools @publishers
|
61
|
+
build_tools | (get_build_tools @test_runners)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns the configured dependency resolvers.
|
65
|
+
attr_reader :dependency_resolvers
|
66
|
+
|
67
|
+
# Adds an instance of the named preparer to the preparer collection and
|
68
|
+
# yields it to the configuration block when one is specified.
|
69
|
+
#
|
70
|
+
# @param [Symbol] type
|
71
|
+
# The name of the preparer.
|
72
|
+
# @param [Proc] block
|
73
|
+
# Optional block to refine the configuration of the preparer.
|
74
|
+
def prepare(type, &block) # :yields: preparer
|
75
|
+
add_instance @preparers, Bozo::Preparers, type, block
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns the configured preparers.
|
79
|
+
attr_reader :preparers
|
80
|
+
|
81
|
+
# Adds an instance of the named dependency resolver to the dependency
|
82
|
+
# resolver collection and yields it to the configuration block when one
|
83
|
+
# is specified.
|
84
|
+
#
|
85
|
+
# @param [Symbol] type
|
86
|
+
# The name of the dependency resolver.
|
87
|
+
# @param [Proc] block
|
88
|
+
# Optional block to refine the configuration of the dependency
|
89
|
+
# resolver.
|
90
|
+
def resolve_dependencies_with(type, &block) # :yields: dependency_resolver
|
91
|
+
add_instance @dependency_resolvers, Bozo::DependencyResolvers, type, block
|
92
|
+
end
|
93
|
+
|
94
|
+
# Returns the required tools
|
95
|
+
attr_reader :tools
|
96
|
+
|
97
|
+
# Adds an instance of the named tool to the tools collection and yields it
|
98
|
+
# to the configuration block when one is specified.
|
99
|
+
#
|
100
|
+
# @param [Symbol] type
|
101
|
+
# The name of the tool.
|
102
|
+
# @param [Proc] block
|
103
|
+
# Optional block to refine the configuration of the tool.
|
104
|
+
def required_tool(type, &block)
|
105
|
+
@tools ||= []
|
106
|
+
add_instance @tools, Bozo::Tools, type, block
|
107
|
+
end
|
108
|
+
|
109
|
+
# Returns the configured compilers.
|
110
|
+
attr_reader :compilers
|
111
|
+
|
112
|
+
# Adds an instance of the named compiler to the compiler collection and
|
113
|
+
# yields it to the configuration block when one is specified.
|
114
|
+
#
|
115
|
+
# @param [Symbol] type
|
116
|
+
# The name of the compiler.
|
117
|
+
# @param [Proc] block
|
118
|
+
# Optional block to refine the configuration of the compiler.
|
119
|
+
def compile_with(type, &block) # :yields: compiler
|
120
|
+
add_instance @compilers, Bozo::Compilers, type, block
|
121
|
+
end
|
122
|
+
|
123
|
+
# Returns the configured test runners.
|
124
|
+
attr_reader :test_runners
|
125
|
+
|
126
|
+
# Adds an instance of the named test runner to the test runner collection
|
127
|
+
# and yields it to the configuration block when one is specified.
|
128
|
+
#
|
129
|
+
# @param [Symbol] type
|
130
|
+
# The name of the test runner.
|
131
|
+
# @param [Proc] block
|
132
|
+
# Optional block to refine the configuration of the test runner.
|
133
|
+
def test_with(type, &block) # :yields: test_runner
|
134
|
+
add_instance @test_runners, Bozo::TestRunners, type, block
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns the configured packagers.
|
138
|
+
attr_reader :packagers
|
139
|
+
|
140
|
+
# Adds an instance of the named packager to the packager collection and
|
141
|
+
# yields it to the configuration block when one is specified.
|
142
|
+
#
|
143
|
+
# @param [Symbol] type
|
144
|
+
# The name of the packager.
|
145
|
+
# @param [Proc] block
|
146
|
+
# Optional block to refine the configuration of the packager.
|
147
|
+
def package_with(type, &block) # :yields: packager
|
148
|
+
add_instance @packagers, Bozo::Packagers, type, block
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the configured publishers.
|
152
|
+
attr_reader :publishers
|
153
|
+
|
154
|
+
# Adds an instance of the named publisher to the publisher collection and
|
155
|
+
# yields it to the configuration block when one is specified.
|
156
|
+
#
|
157
|
+
# @param [Symbol] type
|
158
|
+
# The name of the publisher.
|
159
|
+
# @param [Proc] block
|
160
|
+
# Optional block to refine the configuration of the publisher.
|
161
|
+
def publish_with(type, &block) # :yields: publisher
|
162
|
+
add_instance @publishers, Bozo::Publishers, type, block
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the configured hooks.
|
166
|
+
attr_reader :hooks
|
167
|
+
|
168
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
169
|
+
# to the configuration block when one is specified.
|
170
|
+
#
|
171
|
+
# @param [Symbol] type
|
172
|
+
# The name of the hook.
|
173
|
+
# @param [Proc] block
|
174
|
+
# Optional block to refine the configuration of the hook.
|
175
|
+
def with_hook(type, &block) # :yields: hook
|
176
|
+
add_instance @hooks, Bozo::Hooks, type, block
|
177
|
+
end
|
178
|
+
|
179
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
180
|
+
# to the configuration block when one is specified.
|
181
|
+
alias :pre_build :with_hook
|
182
|
+
|
183
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
184
|
+
# to the configuration block when one is specified.
|
185
|
+
alias :pre_clean :with_hook
|
186
|
+
|
187
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
188
|
+
# to the configuration block when one is specified.
|
189
|
+
alias :post_clean :with_hook
|
190
|
+
|
191
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
192
|
+
# to the configuration block when one is specified.
|
193
|
+
alias :pre_uninstall :with_hook
|
194
|
+
|
195
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
196
|
+
# to the configuration block when one is specified.
|
197
|
+
alias :post_uninstall :with_hook
|
198
|
+
|
199
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
200
|
+
# to the configuration block when one is specified.
|
201
|
+
alias :pre_dependencies :with_hook
|
202
|
+
|
203
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
204
|
+
# to the configuration block when one is specified.
|
205
|
+
alias :post_dependencies :with_hook
|
206
|
+
|
207
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
208
|
+
# to the configuration block when one is specified.
|
209
|
+
alias :pre_prepare :with_hook
|
210
|
+
|
211
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
212
|
+
# to the configuration block when one is specified.
|
213
|
+
alias :post_prepare :with_hook
|
214
|
+
|
215
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
216
|
+
# to the configuration block when one is specified.
|
217
|
+
alias :pre_compile :with_hook
|
218
|
+
|
219
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
220
|
+
# to the configuration block when one is specified.
|
221
|
+
alias :post_compile :with_hook
|
222
|
+
|
223
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
224
|
+
# to the configuration block when one is specified.
|
225
|
+
alias :pre_test :with_hook
|
226
|
+
|
227
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
228
|
+
# to the configuration block when one is specified.
|
229
|
+
alias :post_test :with_hook
|
230
|
+
|
231
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
232
|
+
# to the configuration block when one is specified.
|
233
|
+
alias :pre_package :with_hook
|
234
|
+
|
235
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
236
|
+
# to the configuration block when one is specified.
|
237
|
+
alias :post_package :with_hook
|
238
|
+
|
239
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
240
|
+
# to the configuration block when one is specified.
|
241
|
+
alias :pre_publish :with_hook
|
242
|
+
|
243
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
244
|
+
# to the configuration block when one is specified.
|
245
|
+
alias :post_publish :with_hook
|
246
|
+
|
247
|
+
# Adds an instance of the named hook to the hook collection and yields it
|
248
|
+
# to the configuration block when one is specified.
|
249
|
+
alias :post_build :with_hook
|
250
|
+
|
251
|
+
private
|
252
|
+
|
253
|
+
# Resolves the named class within the given namespace and then created an
|
254
|
+
# instance of the class before adding it to the given collection and
|
255
|
+
# yielding it to the configuration block when one is provided.
|
256
|
+
#
|
257
|
+
# @param [Array] collection
|
258
|
+
# The collection the step executor should be added to once created.
|
259
|
+
# @param [Module] namespace
|
260
|
+
# The module the named step executor should be found in.
|
261
|
+
# @param [Symbol] type
|
262
|
+
# The name of the step executor.
|
263
|
+
# @param [Proc] block
|
264
|
+
# Optional block to refine the configuration of the step executor.
|
265
|
+
def add_instance(collection, namespace, type, block)
|
266
|
+
instance = namespace.const_get(to_class_name(type)).new
|
267
|
+
instance.extend Bozo::Runner
|
268
|
+
collection << instance
|
269
|
+
block.call instance if block
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns the collection of build tools required for the configuration.
|
273
|
+
#
|
274
|
+
# Sourced from the required tools of compilers, dependency resolvers,
|
275
|
+
# hooks, publishers and test runners.
|
276
|
+
#
|
277
|
+
# @param [Array] providers
|
278
|
+
# Collection of providers that can define required tools.
|
279
|
+
def get_build_tools(providers)
|
280
|
+
providers.
|
281
|
+
select{|p| p.respond_to? :required_tools}.
|
282
|
+
map{|p| p.required_tools}.
|
283
|
+
flatten
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
# Module containing all dependency resolvers.
|
289
|
+
module DependencyResolvers
|
290
|
+
end
|
291
|
+
|
292
|
+
# Module containing all compilers.
|
293
|
+
module Compilers
|
294
|
+
end
|
295
|
+
|
296
|
+
# Module containing all test runners.
|
297
|
+
module TestRunners
|
298
|
+
end
|
299
|
+
|
300
|
+
# Module containing all packagers.
|
301
|
+
module Packagers
|
302
|
+
end
|
303
|
+
|
304
|
+
# Module containing all preparers.
|
305
|
+
module Preparers
|
306
|
+
end
|
307
|
+
|
308
|
+
# Module containing all publishers.
|
309
|
+
module Publishers
|
310
|
+
end
|
311
|
+
|
312
|
+
# Module containing all hooks.
|
313
|
+
module Hooks
|
314
|
+
end
|
315
|
+
|
316
|
+
# Module containing all tools.
|
317
|
+
module Tools
|
318
|
+
end
|
319
|
+
|
300
320
|
end
|