bee 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +202 -0
- data/README +28 -4
- data/bin/bee +2 -2
- data/lib/bee.rb +34 -579
- data/lib/bee_console.rb +539 -0
- data/lib/bee_default_context.rb +131 -0
- data/test/{tc_bee_consoleformatter.rb → tc_bee_console_formatter.rb} +3 -3
- data/test/ts_bee.rb +2 -4
- metadata +11 -27
- data/bin/beedoc +0 -6
- data/doc/html/documentation.html +0 -444
- data/doc/html/quickstart.html +0 -108
- data/doc/png/style.png +0 -0
- data/doc/yml/menu.yml +0 -49
- data/doc/yml/releases.yml +0 -42
- data/doc/yml/todo.yml +0 -17
- data/lib/beedoc.rb +0 -464
@@ -0,0 +1,131 @@
|
|
1
|
+
# Copyright 2006 Michel Casabianca <casa@sweetohm.net>
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
# Default bee context. This script is evaluated before getting binding
|
16
|
+
# for context, thus all defined functions are accessible in scripts
|
17
|
+
# that run in targets. Furthermore, last evaluated expression is a
|
18
|
+
# mapping of extension tasks.
|
19
|
+
|
20
|
+
############################ UTILITY FUNCTIONS ############################
|
21
|
+
|
22
|
+
# Convenient method to raise a BuildError.
|
23
|
+
# - message: error message.
|
24
|
+
def error(message)
|
25
|
+
raise BuildError.new(message)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Check a task parameters. Raise a RuntimeError with explanation message if
|
29
|
+
# a mandatory parameter is missing or an unknown parameter was found.
|
30
|
+
# - params: task parameters as a Hash.
|
31
|
+
# - description: parameters description as a Hash associating a parameter
|
32
|
+
# name with symbol :mandatory or :optional.
|
33
|
+
def check_parameters(params, description)
|
34
|
+
error "Parameters must be a Hash" unless params.kind_of?(Hash)
|
35
|
+
for param in description.keys
|
36
|
+
error "Missing mandatory parameter '#{param}'" unless
|
37
|
+
params[param] or description[param] == :optional
|
38
|
+
end
|
39
|
+
for param in params.keys
|
40
|
+
error "Unknown parameter '#{param}'" if not description.key?(param)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Run a shell script and raise an exception if script returned a value
|
45
|
+
# different of 0.
|
46
|
+
# - script: script to run.
|
47
|
+
def sh(script)
|
48
|
+
system(script) or error "Script '#{script}' exited with value '#{$?}'"
|
49
|
+
end
|
50
|
+
|
51
|
+
# Find files that match a given pattern.
|
52
|
+
# - pattern: pattern to select files.
|
53
|
+
# - base: base directory for search.
|
54
|
+
# - dir: tells if we must include directories.
|
55
|
+
# Return: a file list.
|
56
|
+
def find(pattern=//, base='.', dir=true)
|
57
|
+
require 'find'
|
58
|
+
files = []
|
59
|
+
Find.find(base) do |path|
|
60
|
+
if path =~ pattern and (File.file?(path) or (File.directory?(path) and dir))
|
61
|
+
files << path
|
62
|
+
end
|
63
|
+
end
|
64
|
+
return files
|
65
|
+
end
|
66
|
+
|
67
|
+
############################ TASK DEFINITIONS #############################
|
68
|
+
|
69
|
+
# Prints a message.
|
70
|
+
def print(message)
|
71
|
+
error "Parameter must be a String" unless message.kind_of?(String)
|
72
|
+
puts evaluate_string(message)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Make a directory and parent directories if necessary.
|
76
|
+
def mkdir(dir)
|
77
|
+
error "Parameter must be a String" unless dir.kind_of?(String)
|
78
|
+
require "fileutils"
|
79
|
+
FileUtils.makedirs(dir)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Run an ERB file or source and store result in a file or property.
|
83
|
+
def erb(params)
|
84
|
+
require 'erb'
|
85
|
+
# check parameters
|
86
|
+
params_desc = {
|
87
|
+
'source' => :optional,
|
88
|
+
'file' => :optional,
|
89
|
+
'tofile' => :optional,
|
90
|
+
'toprop' => :optional
|
91
|
+
}
|
92
|
+
check_parameters(params, params_desc)
|
93
|
+
source = params['source']
|
94
|
+
file = evaluate_string(params['file'])
|
95
|
+
tofile = evaluate_string(params['tofile'])
|
96
|
+
toprop = evaluate_string(params['toprop'])
|
97
|
+
error "Must pass one of 'source' or 'file' parameters to erb task" if
|
98
|
+
not source and not file
|
99
|
+
error "Must pass one of 'tofile' or 'toprop' parameters to erb task" if
|
100
|
+
not tofile and not toprop
|
101
|
+
# load ERB source
|
102
|
+
erb_source = source||File.read(file)
|
103
|
+
template = ERB.new(erb_source)
|
104
|
+
begin
|
105
|
+
result = template.result(@context_binding)
|
106
|
+
rescue
|
107
|
+
error "Error processing ERB: #{$!}"
|
108
|
+
end
|
109
|
+
# write result in file or set property
|
110
|
+
if tofile
|
111
|
+
File.open(tofile, 'w') { |file| file.write(result) }
|
112
|
+
else
|
113
|
+
set(toprop, result)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
############################## TASKS MAPPING ##############################
|
118
|
+
|
119
|
+
{
|
120
|
+
"print" =>
|
121
|
+
"Print a message passed as parameter.",
|
122
|
+
"mkdir" =>
|
123
|
+
"Create a directory and all parent directories if necessary. Do nothing if
|
124
|
+
directory already exists. Parameter is a String for directory to create.",
|
125
|
+
"erb" =>
|
126
|
+
"Run an ERB:
|
127
|
+
- source: ERB source to run (if no 'file').
|
128
|
+
- file: ERB file to run (if no 'source').
|
129
|
+
- tofile: file where to write ERB result (if no 'toprop').
|
130
|
+
- toprop: bee property where to put result (if no 'tofile')."
|
131
|
+
}
|
@@ -16,13 +16,13 @@
|
|
16
16
|
|
17
17
|
require 'test/unit'
|
18
18
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
19
|
-
require '
|
19
|
+
require 'bee_console'
|
20
20
|
|
21
21
|
class TestBeeConsoleFormatter < Test::Unit::TestCase
|
22
22
|
|
23
23
|
def test_format_target_default
|
24
24
|
expected = "#{'-'*72} TEST --"
|
25
|
-
formatter = Bee::
|
25
|
+
formatter = Bee::Console::Formatter.new(nil)
|
26
26
|
target = Bee::Target.new({ 'target' => 'TEST' }, nil)
|
27
27
|
actual = formatter.format_target(target)
|
28
28
|
assert_equal(expected, actual)
|
@@ -37,7 +37,7 @@ class TestBeeConsoleFormatter < Test::Unit::TestCase
|
|
37
37
|
:target_foreground => :red,
|
38
38
|
:target_background => :green
|
39
39
|
}
|
40
|
-
formatter = Bee::
|
40
|
+
formatter = Bee::Console::Formatter.new(style)
|
41
41
|
target = Bee::Target.new({ 'target' => 'TEST' }, nil)
|
42
42
|
actual = formatter.format_target(target)
|
43
43
|
assert_equal(expected, actual)
|
data/test/ts_bee.rb
CHANGED
@@ -18,11 +18,9 @@
|
|
18
18
|
# in a single test suite.
|
19
19
|
|
20
20
|
require 'find'
|
21
|
-
$:.unshift(File.dirname(__FILE__))
|
22
21
|
|
23
22
|
Find.find(File.dirname(__FILE__)) do |path|
|
24
|
-
|
25
|
-
|
26
|
-
load file
|
23
|
+
if File.file?(path) and path =~ /tc_.+\.rb$/
|
24
|
+
load path
|
27
25
|
end
|
28
26
|
end
|
metadata
CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: bee
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-11-
|
8
|
-
summary:
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2006-11-06 00:00:00 +01:00
|
8
|
+
summary: bee is a build tool
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: michel.casabianca@gmail.com
|
@@ -25,46 +25,30 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
-
post_install_message: Enjoy!
|
28
|
+
post_install_message: Enjoy bee!
|
29
29
|
authors:
|
30
30
|
- Michel Casabianca
|
31
31
|
files:
|
32
32
|
- bin/bee
|
33
|
-
- bin/beedoc
|
34
|
-
- doc/html
|
35
|
-
- doc/png
|
36
|
-
- doc/yml
|
37
|
-
- doc/html/documentation.html
|
38
|
-
- doc/html/quickstart.html
|
39
|
-
- doc/png/style.png
|
40
|
-
- doc/yml/menu.yml
|
41
|
-
- doc/yml/releases.yml
|
42
|
-
- doc/yml/todo.yml
|
43
33
|
- lib/bee.rb
|
44
|
-
- lib/
|
45
|
-
-
|
34
|
+
- lib/bee_console.rb
|
35
|
+
- lib/bee_default_context.rb
|
36
|
+
- test/tc_bee_console_formatter.rb
|
46
37
|
- test/ts_bee.rb
|
47
38
|
- README
|
39
|
+
- LICENSE
|
48
40
|
test_files:
|
49
41
|
- test/ts_bee.rb
|
50
42
|
rdoc_options: []
|
51
43
|
|
52
44
|
extra_rdoc_files:
|
53
45
|
- README
|
46
|
+
- LICENSE
|
54
47
|
executables:
|
55
48
|
- bee
|
56
|
-
- beedoc
|
57
49
|
extensions: []
|
58
50
|
|
59
51
|
requirements: []
|
60
52
|
|
61
|
-
dependencies:
|
62
|
-
|
63
|
-
name: rubyzip
|
64
|
-
version_requirement:
|
65
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 0.0.0
|
70
|
-
version:
|
53
|
+
dependencies: []
|
54
|
+
|
data/bin/beedoc
DELETED
data/doc/html/documentation.html
DELETED
@@ -1,444 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
Copyright 2006 Michel Casabianca <casa@sweetohm.net>
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
-->
|
16
|
-
|
17
|
-
<p>Bee is a build tool parsing YAML build files. These files can embed
|
18
|
-
shell and/or Ruby scripts. It is as fast as Make and its build files are
|
19
|
-
far more readable than Ant ones (without the bloated XML syntax ;o).</p>
|
20
|
-
|
21
|
-
<h2>Installation</h2>
|
22
|
-
|
23
|
-
<p>Bee is a Ruby script, thus an interpreter must be installed on your
|
24
|
-
machine. You can get one for free at
|
25
|
-
<a href="http://www.ruby-lang.org">http://www.ruby-lang.org</a>.</p>
|
26
|
-
|
27
|
-
<p>If <a href="http://docs.rubygems.org/">RubyGems</a> is installed on
|
28
|
-
your machine, type <code>gem install bee</code> (you might need to have
|
29
|
-
administrator privileges to do so).</p>
|
30
|
-
|
31
|
-
<p>If you are reluctant to install RubyGems (which is not a good idea),
|
32
|
-
you can still install bee the old fashion way: unzip installation
|
33
|
-
archive somewhere and put its <i>bin</i> directory in your PATH.</p>
|
34
|
-
|
35
|
-
<p>You can test your installation typing <code>bee -h</code>.</p>
|
36
|
-
|
37
|
-
<h2>Usage</h2>
|
38
|
-
|
39
|
-
<p>Type <code>bee</code> in directory of your build file (which name
|
40
|
-
defaults to <i>build.yml</i>). To get help about usage, type
|
41
|
-
<code>bee -h</code>:</p>
|
42
|
-
|
43
|
-
<pre class="code"><code>$ bee -h
|
44
|
-
Usage: bee [options] [targets]
|
45
|
-
-h Print help about usage and exit.
|
46
|
-
-b Print help about build and exit.
|
47
|
-
-t Write template build file on disk.
|
48
|
-
-v Enable verbose mode.
|
49
|
-
-s style Define style for output (see documentation).
|
50
|
-
-f file Build file to run (defaults to "build.yml").
|
51
|
-
targets Targets to run (default target if omitted).</code></pre>
|
52
|
-
|
53
|
-
<p>You can get help about loaded build file (using <code>-f</code>
|
54
|
-
option if necessary) typing <code>bee -b</code>:</p>
|
55
|
-
|
56
|
-
<pre class="code"><code>$ bee -b
|
57
|
-
- Build: "bee"
|
58
|
-
Description:
|
59
|
-
This build file needs zip command line tool to generate distribution
|
60
|
-
archive.
|
61
|
-
- Properties:
|
62
|
-
- api: "/Users/casa/Desktop/bee/build/api"
|
63
|
-
- archive: "bee-beta-1.zip"
|
64
|
-
- base: "/Users/casa/Desktop/bee"
|
65
|
-
- build: "/Users/casa/Desktop/bee/build"
|
66
|
-
- dist: "/Users/casa/Desktop/bee/build/bee"
|
67
|
-
- doc: "/Users/casa/Desktop/bee/build/doc"
|
68
|
-
- files: "README bin"
|
69
|
-
- name: "bee"
|
70
|
-
- src: "/Users/casa/Desktop/bee/bin/*"
|
71
|
-
- syntax_report: "/Users/casa/Desktop/bee/build/syntax.txt"
|
72
|
-
- test: "/Users/casa/Desktop/bee/test"
|
73
|
-
- test_report: "/Users/casa/Desktop/bee/build/tests.txt"
|
74
|
-
- version: "beta-1"
|
75
|
-
- Targets:
|
76
|
-
- all: Generate all
|
77
|
-
- api: Generate API documentation
|
78
|
-
- clean: Clean generated files
|
79
|
-
- dist: Generate distribution archive
|
80
|
-
- doc: Generate documentation
|
81
|
-
- syntax: Check syntax of ruby files
|
82
|
-
- syntax-report: Check syntax of ruby files and generate report
|
83
|
-
- test: Run unit tests
|
84
|
-
- test-report: Run unit tests and gerenate report
|
85
|
-
- Default: all</code></pre>
|
86
|
-
|
87
|
-
<p>This will print help about:</p>
|
88
|
-
|
89
|
-
<ul>
|
90
|
-
<li>Build file.</li>
|
91
|
-
<li>Defined properties.</li>
|
92
|
-
<li>Build targets.</li>
|
93
|
-
<li>Default target.</li>
|
94
|
-
</ul>
|
95
|
-
|
96
|
-
<p>The <code>-t</code> option writes a template build file. This is
|
97
|
-
convenient to quickly write a new build file editing this example.
|
98
|
-
You can use option <code>-t file</code> to write template to another
|
99
|
-
location than <i>build.yml</i> in current directory. Note that bee
|
100
|
-
will refuse to overwrite an existing build file with a template.</p>
|
101
|
-
|
102
|
-
<p>The <code>-v</code> option enables verbose mode (printing loaded
|
103
|
-
build file, executed scripts and build time). Option <code>-s style</code>
|
104
|
-
defines a style for output (see above section <i>Defining styles</i>
|
105
|
-
for more information). The <code>-f file</code> enables you to load
|
106
|
-
an alternate build file. Without this option, bee will look for
|
107
|
-
a file named <i>build.yml</i> in current directory.</p>
|
108
|
-
|
109
|
-
<h2>Configuration</h2>
|
110
|
-
|
111
|
-
<p>bee doesn't load configuration file st startup, but you can set
|
112
|
-
command line options in environment variable <code>BEEOPT</code> that
|
113
|
-
is appended on command line at startup. For instance, setting:</p>
|
114
|
-
|
115
|
-
<pre class="code">BEEOPT="-v"<code></code></pre>
|
116
|
-
|
117
|
-
<p>Would always run bee in verbose mode.</p>
|
118
|
-
|
119
|
-
<h2>Project files</h2>
|
120
|
-
|
121
|
-
<p>Here is a sample project file (simplified version to generate bee
|
122
|
-
distribution archive):</p>
|
123
|
-
|
124
|
-
<pre class="code"><code># Build info
|
125
|
-
- build: bee
|
126
|
-
default: all
|
127
|
-
description: |
|
128
|
-
This build file needs zip command line tool to generate distribution
|
129
|
-
archive.
|
130
|
-
|
131
|
-
# Build properties
|
132
|
-
- properties:
|
133
|
-
- name: bee
|
134
|
-
- version: "beta-1"
|
135
|
-
- test: "test"
|
136
|
-
- build: "#{base}/build"
|
137
|
-
- dist: "#{build}/#{name}"
|
138
|
-
- files: "README bin"
|
139
|
-
- archive: "#{name}-#{version}.zip"
|
140
|
-
|
141
|
-
# Build targets
|
142
|
-
- target: test
|
143
|
-
description: Run unit tests
|
144
|
-
script:
|
145
|
-
- "testrb #{test}"
|
146
|
-
|
147
|
-
- target: dist
|
148
|
-
description: Generate distribution archive
|
149
|
-
depends: test
|
150
|
-
script: |
|
151
|
-
if [ ! -d #{build} ]
|
152
|
-
then
|
153
|
-
mkdir #{build}
|
154
|
-
fi
|
155
|
-
if [ ! -d #{dist} ]
|
156
|
-
then
|
157
|
-
mkdir #{dist}
|
158
|
-
fi
|
159
|
-
cp -r #{files} #{dist}
|
160
|
-
rm -rf `find #{dist} -name "CVS"`
|
161
|
-
rm -rf `find #{dist} -name ".??*"`
|
162
|
-
cd #{build}
|
163
|
-
zip -r #{archive} #{name}
|
164
|
-
|
165
|
-
- target: clean
|
166
|
-
description: Clean generated files
|
167
|
-
script: |
|
168
|
-
rm -rf #{build}
|
169
|
-
rm -f `find #{base} -name "*~"`
|
170
|
-
rm -f `find #{base} -name ".DS_Store"`
|
171
|
-
|
172
|
-
- target: all
|
173
|
-
description: Generate all
|
174
|
-
depends: [clean, dist]</code></pre>
|
175
|
-
|
176
|
-
<p>This is a <a href="http://www.yaml.org/">YAML</a> file. In such
|
177
|
-
files, list elements are lines starting with a dash (<i>-</i>
|
178
|
-
character) and hash entries are lines made of a key / value pair
|
179
|
-
separated with a colon (<i>:</i> character). Thus, you might already
|
180
|
-
have noticed that this file is a list of hash which can be:</p>
|
181
|
-
|
182
|
-
<h3>Project information</h3>
|
183
|
-
|
184
|
-
<p>This is a piece of information that is not mandatory but used
|
185
|
-
while displaying build help. This looks like:</p>
|
186
|
-
|
187
|
-
<pre class="code"><code>- build: bee
|
188
|
-
default: all
|
189
|
-
description: |
|
190
|
-
This build file needs zip command line tool to generate distribution
|
191
|
-
archive.</code></pre>
|
192
|
-
|
193
|
-
<p>This hash may have following keys:</p>
|
194
|
-
|
195
|
-
<ul>
|
196
|
-
<li><b>build</b>: for the build name (mandatory).</li>
|
197
|
-
<li><b>default</b>: to indicate default target to run (optional). If no
|
198
|
-
default target is set, bee will set default as first target declared in
|
199
|
-
the build file.</li>
|
200
|
-
<li><b>description</b>: build description (optional). This is the place
|
201
|
-
to list dependencies for the build (such as <code>zip</code> in this
|
202
|
-
example).</li>
|
203
|
-
<li><b>context</b>: this is a list of scripts to load at startup in
|
204
|
-
the build context. These scripts can define variables and functons
|
205
|
-
used in embedded scripts. See section <i>Build Context</i> above for
|
206
|
-
more information.</li>
|
207
|
-
</ul>
|
208
|
-
|
209
|
-
<h3>Build properties</h3>
|
210
|
-
|
211
|
-
<p>These are properties used by build file scripts or other properties.
|
212
|
-
They can be seen as build file variable declarations:</p>
|
213
|
-
|
214
|
-
<pre class="code"><code>- properties:
|
215
|
-
- name: bee
|
216
|
-
- version: "beta-1"
|
217
|
-
- test: "test"
|
218
|
-
- build: "#{base}/build"
|
219
|
-
- dist: "#{build}/#{name}"
|
220
|
-
- files: "README bin"
|
221
|
-
- archive: "#{name}-#{version}.zip"</code></pre>
|
222
|
-
|
223
|
-
<p>This entry has a single key <i>properties</i> that contains a list
|
224
|
-
of property definitions. Each definition is a Hash with a single key
|
225
|
-
which is the property name associated to its value. Properties can
|
226
|
-
reference each other using a Ruby syntax <code>#{property}</code>.</p>
|
227
|
-
|
228
|
-
<h3>Targets</h3>
|
229
|
-
|
230
|
-
<p>A target can be seen as build file functions. A target is defined
|
231
|
-
to implement a given goal. For instance, in sample hereafter, target
|
232
|
-
named <i>dist</i> generates distribution archive:</p>
|
233
|
-
|
234
|
-
<pre class="code">- target: dist
|
235
|
-
description: Generate distribution archive
|
236
|
-
depends: test
|
237
|
-
script: |
|
238
|
-
if [ ! -d #{build} ]
|
239
|
-
then
|
240
|
-
mkdir #{build}
|
241
|
-
fi
|
242
|
-
if [ ! -d #{dist} ]
|
243
|
-
then
|
244
|
-
mkdir #{dist}
|
245
|
-
fi
|
246
|
-
cp -r #{files} #{dist}
|
247
|
-
rm -rf `find #{dist} -name "CVS"`
|
248
|
-
rm -rf `find #{dist} -name ".??*"`
|
249
|
-
cd #{build}
|
250
|
-
zip -r #{archive} #{name}<code></code></pre>
|
251
|
-
|
252
|
-
<p>A target entry might have following keys:</p>
|
253
|
-
|
254
|
-
<ul>
|
255
|
-
<li><b>target</b>: the target name (mandatory).</li>
|
256
|
-
<li><b>description</b>: description printed in build help (optional).</li>
|
257
|
-
<li><b>depends</b>: a list of target's dependencies (optional). This
|
258
|
-
might be a list or a single string. Dependencies are executed before a
|
259
|
-
given target.</li>
|
260
|
-
<li><b>script</b>: script to run to achive this target (optinal). This is
|
261
|
-
a single script or a list of scripts to run. Each script might be a
|
262
|
-
shell script or a Ruby script (when prefixed with <code>- rb:</code>).</li>
|
263
|
-
</ul>
|
264
|
-
|
265
|
-
<p>bee writes executed scripts in verbose mode. For instance, running
|
266
|
-
sample script would print on console:</p>
|
267
|
-
|
268
|
-
<pre class="code"><code>$ bee
|
269
|
-
----------------------------------------------------------------------- clean --
|
270
|
-
------------------------------------------------------------------------ test --
|
271
|
-
Loaded suite test
|
272
|
-
Started
|
273
|
-
..
|
274
|
-
Finished in 0.003776 seconds.
|
275
|
-
|
276
|
-
2 tests, 2 assertions, 0 failures, 0 errors
|
277
|
-
------------------------------------------------------------------------ dist --
|
278
|
-
adding: bee/ (stored 0%)
|
279
|
-
adding: bee/bin/ (stored 0%)
|
280
|
-
adding: bee/bin/bee (deflated 73%)
|
281
|
-
adding: bee/bin/beedoc (deflated 69%)
|
282
|
-
adding: bee/README (deflated 30%)
|
283
|
-
------------------------------------------------------------------------- all --
|
284
|
-
OK</code></pre>
|
285
|
-
|
286
|
-
<p>While running in verbose mode, it would output:</p>
|
287
|
-
|
288
|
-
<pre class="code">$ bee -v
|
289
|
-
Starting build 'build.yml'...
|
290
|
-
----------------------------------------------------------------------- clean --
|
291
|
-
- rm -rf #{build}
|
292
|
-
. rm -f `find #{base} -name "*~"`
|
293
|
-
. rm -f `find #{base} -name ".DS_Store"`
|
294
|
-
------------------------------------------------------------------------ test --
|
295
|
-
- testrb #{test}
|
296
|
-
Loaded suite test
|
297
|
-
Started
|
298
|
-
..
|
299
|
-
Finished in 0.003944 seconds.
|
300
|
-
|
301
|
-
2 tests, 2 assertions, 0 failures, 0 errors
|
302
|
-
------------------------------------------------------------------------ dist --
|
303
|
-
- if [ ! -d #{build} ]
|
304
|
-
. then
|
305
|
-
. mkdir #{build}
|
306
|
-
. fi
|
307
|
-
. if [ ! -d #{dist} ]
|
308
|
-
. then
|
309
|
-
. mkdir #{dist}
|
310
|
-
. fi
|
311
|
-
. cp -r #{files} #{dist}
|
312
|
-
. rm -rf `find #{dist} -name "CVS"`
|
313
|
-
. rm -rf `find #{dist} -name ".??*"`
|
314
|
-
. cd #{build}
|
315
|
-
. zip -r #{archive} #{name}
|
316
|
-
adding: bee/ (stored 0%)
|
317
|
-
adding: bee/bin/ (stored 0%)
|
318
|
-
adding: bee/bin/bee (deflated 73%)
|
319
|
-
adding: bee/bin/beedoc (deflated 69%)
|
320
|
-
adding: bee/README (deflated 30%)
|
321
|
-
------------------------------------------------------------------------- all --
|
322
|
-
Built in 0.567582 s
|
323
|
-
OK<code></code></pre>
|
324
|
-
|
325
|
-
<p>First line of a script starts with a dash (<i>-</i> character) while
|
326
|
-
following ones start with a dot (<i>.</i> character). In verbose mode,
|
327
|
-
bee also prints loaded build file and build time.</p>
|
328
|
-
|
329
|
-
<h2>Build Context</h2>
|
330
|
-
|
331
|
-
<p>Setting <code>context</code> key in build info entry load a given
|
332
|
-
Ruby script in the build context. This context is the place where
|
333
|
-
embedded Ruby scripts run (this is similar to the workspace where you
|
334
|
-
run code you type in IRB). This is a simple way to load a library you
|
335
|
-
will call in your Ruby scripts. Let's say you would like to call function
|
336
|
-
<code>say_hello</code> defined in script named <i>hello.rb</i>:</p>
|
337
|
-
|
338
|
-
<pre class="code"><code>def say_hello(who)
|
339
|
-
puts "Hello #{who}!"
|
340
|
-
end</code></pre>
|
341
|
-
|
342
|
-
<p>You would load it in context with following build file: </p>
|
343
|
-
|
344
|
-
<pre class="code"><code>- build: hello
|
345
|
-
context: hello.rb
|
346
|
-
|
347
|
-
- properties:
|
348
|
-
- world: "World"
|
349
|
-
|
350
|
-
- target: hello
|
351
|
-
script:
|
352
|
-
- rb: "say_hello(world)"</code></pre>
|
353
|
-
|
354
|
-
<p>The contex path is relative to the build file. Furthermore, you can
|
355
|
-
load more than one file in your context, using a list:</p>
|
356
|
-
|
357
|
-
<pre class="code"><code>- build: hello
|
358
|
-
context: [foo.rb, bar.rb]</code></pre>
|
359
|
-
|
360
|
-
<h2>Defining Style</h2>
|
361
|
-
|
362
|
-
<p>You can define a style using the <code>-s syle</code> option. This
|
363
|
-
is a way to colorize output on console using ANSI colors for Unix
|
364
|
-
terminals. For instance, on a Unix box, running bee with option
|
365
|
-
<code>-s lc:,tf:yellow,ts:underscore,ss:bright,sf:green,es:bright,ef:red,kf:blue</code>
|
366
|
-
would output:</p>
|
367
|
-
|
368
|
-
<center><img src="style.png"></center>
|
369
|
-
|
370
|
-
<p>Styles are defined as coma separated key/value pairs. Keys are the
|
371
|
-
following:</p>
|
372
|
-
|
373
|
-
<table>
|
374
|
-
<tr>
|
375
|
-
<th>Key</th>
|
376
|
-
<th>Description</th>
|
377
|
-
</tr>
|
378
|
-
<tr>
|
379
|
-
<td><b>lc</b></td>
|
380
|
-
<td>Character for target title (defaults to dash <i>-</i>). To set space,
|
381
|
-
set to an empty value, such as: <code>...,lc:,...</code> as there should
|
382
|
-
not be spaces in style option (this would break command line parsing).</td>
|
383
|
-
</tr>
|
384
|
-
<tr>
|
385
|
-
<td><b>ll</b></td>
|
386
|
-
<td>Line length. If not set, will try to determine it calling IOCTL
|
387
|
-
function. If this call fails, will set line length to <i>80</i>
|
388
|
-
characters.</td>
|
389
|
-
</tr>
|
390
|
-
<tr>
|
391
|
-
<td><b>ts</b></td>
|
392
|
-
<td>Target style.</td>
|
393
|
-
</tr>
|
394
|
-
<tr>
|
395
|
-
<td><b>tf</b></td>
|
396
|
-
<td>Target foreground.</td>
|
397
|
-
</tr>
|
398
|
-
<tr>
|
399
|
-
<td><b>tb</b></td>
|
400
|
-
<td>Target background.</td>
|
401
|
-
</tr>
|
402
|
-
<tr>
|
403
|
-
<td><b>ks</b></td>
|
404
|
-
<td>Task style.</td>
|
405
|
-
</tr>
|
406
|
-
<tr>
|
407
|
-
<td><b>kf</b></td>
|
408
|
-
<td>Task foreground.</td>
|
409
|
-
</tr>
|
410
|
-
<tr>
|
411
|
-
<td><b>kb</b></td>
|
412
|
-
<td>Task background.</td>
|
413
|
-
</tr>
|
414
|
-
<tr>
|
415
|
-
<td><b>ss</b></td>
|
416
|
-
<td>Success style.</td>
|
417
|
-
</tr>
|
418
|
-
<tr>
|
419
|
-
<td><b>sf</b></td>
|
420
|
-
<td>Success foreground.</td>
|
421
|
-
</tr>
|
422
|
-
<tr>
|
423
|
-
<td><b>sb</b></td>
|
424
|
-
<td>Success background.</td>
|
425
|
-
</tr>
|
426
|
-
<tr>
|
427
|
-
<td><b>es</b></td>
|
428
|
-
<td>Error style.</td>
|
429
|
-
</tr>
|
430
|
-
<tr>
|
431
|
-
<td><b>ef</b></td>
|
432
|
-
<td>Error foreground.</td>
|
433
|
-
</tr>
|
434
|
-
<tr>
|
435
|
-
<td><b>eb</b></td>
|
436
|
-
<td>Error background.</td>
|
437
|
-
</tr>
|
438
|
-
</table>
|
439
|
-
|
440
|
-
<p>If a given key is not set, it will keep its default value. The bee
|
441
|
-
options environment variable <code>BEEOPT</code> is the best place
|
442
|
-
to set you style settings.</p>
|
443
|
-
|
444
|
-
<p>Enjoy!</p>
|