bee 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/bin/bash_completion_bee +35 -0
- data/lib/bee.rb +13 -1
- data/lib/bee_console.rb +48 -22
- data/lib/bee_version.rb +5 -0
- metadata +5 -2
data/README
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
# To enable bash completion for Bee, copy this file in directory
|
3
|
+
# /etc/bash_completion.d/ and rename it bee. Next time you open a terminal,
|
4
|
+
# Bee completion should work:
|
5
|
+
#
|
6
|
+
# $ bee --help[TAB]
|
7
|
+
# --help --help-build --help-task --help-template
|
8
|
+
#
|
9
|
+
# $ bee t[TAB]
|
10
|
+
# tag test
|
11
|
+
#
|
12
|
+
# Completion works on long options (starting with --) and targets of the build
|
13
|
+
# file.
|
14
|
+
|
15
|
+
_bee()
|
16
|
+
{
|
17
|
+
local cur prev opts
|
18
|
+
COMPREPLY=()
|
19
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
20
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
21
|
+
|
22
|
+
if [[ ${cur} == -* ]] ; then
|
23
|
+
opts="`bee -o`"
|
24
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
25
|
+
return 0
|
26
|
+
else
|
27
|
+
opts="`bee -a`"
|
28
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
29
|
+
return 0
|
30
|
+
fi
|
31
|
+
}
|
32
|
+
|
33
|
+
complete -F _bee bee
|
34
|
+
complete -F _bee b
|
35
|
+
|
data/lib/bee.rb
CHANGED
@@ -392,6 +392,18 @@ module Bee
|
|
392
392
|
return description
|
393
393
|
end
|
394
394
|
|
395
|
-
end
|
395
|
+
end
|
396
|
+
|
397
|
+
# Return Bee version. Try to load bee_version file or return UNKNOWN.
|
398
|
+
def version
|
399
|
+
begin
|
400
|
+
require 'bee_version'
|
401
|
+
return Bee::VERSION
|
402
|
+
rescue Exception
|
403
|
+
return 'UNKNOWN'
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
module_function :version
|
396
408
|
|
397
409
|
end
|
data/lib/bee_console.rb
CHANGED
@@ -43,7 +43,29 @@ module Bee
|
|
43
43
|
-f file Build file to run (defaults to "build.yml").
|
44
44
|
-r Look for build file recursively up in file system.
|
45
45
|
-l Print bee logo on console.
|
46
|
+
-a Print list of available targets.
|
47
|
+
-o Print list of available options.
|
46
48
|
targets Targets to run (default target if omitted).'
|
49
|
+
# Options descriptions.
|
50
|
+
OPTIONS = [
|
51
|
+
['--version', '-V', GetoptLong::NO_ARGUMENT],
|
52
|
+
['--help', '-h', GetoptLong::NO_ARGUMENT],
|
53
|
+
['--help-build', '-b', GetoptLong::NO_ARGUMENT],
|
54
|
+
['--help-task','-k', GetoptLong::REQUIRED_ARGUMENT],
|
55
|
+
['--help-template','-e', GetoptLong::REQUIRED_ARGUMENT],
|
56
|
+
['--dry-run', '-n', GetoptLong::NO_ARGUMENT],
|
57
|
+
['--property', '-p', GetoptLong::REQUIRED_ARGUMENT],
|
58
|
+
['--template', '-t', GetoptLong::REQUIRED_ARGUMENT],
|
59
|
+
['--verbose', '-v', GetoptLong::NO_ARGUMENT],
|
60
|
+
['--style', '-s', GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
['--color', '-c', GetoptLong::NO_ARGUMENT],
|
62
|
+
['--black-and-white', '-w', GetoptLong::NO_ARGUMENT],
|
63
|
+
['--file', '-f', GetoptLong::REQUIRED_ARGUMENT],
|
64
|
+
['--recursive', '-r', GetoptLong::NO_ARGUMENT],
|
65
|
+
['--logo', '-l', GetoptLong::NO_ARGUMENT],
|
66
|
+
['--targets', '-a', GetoptLong::NO_ARGUMENT],
|
67
|
+
['--options', '-o', GetoptLong::NO_ARGUMENT],
|
68
|
+
]
|
47
69
|
# Name for default build file.
|
48
70
|
DEFAULT_BUILD_FILE = 'build.yml'
|
49
71
|
# Exit value on error parsing command line
|
@@ -57,12 +79,12 @@ targets Targets to run (default target if omitted).'
|
|
57
79
|
# Bee options environment variable.
|
58
80
|
BEE_OPT_ENV = 'BEEOPT'
|
59
81
|
# Bee text logo (generated with http://www.network-science.de/ascii/)
|
60
|
-
BEE_LOGO = <<
|
82
|
+
BEE_LOGO = <<"EOF"
|
61
83
|
_
|
62
84
|
| |__ ___ ___
|
63
|
-
____ | '_
|
85
|
+
____ | '_ \\ / _ \\/ _ \\ _____ _____ _____ _____ _____ _____ _____ _____ _____
|
64
86
|
|____| | |_) | __/ __/ |_____|_____|_____|_____|_____|_____|_____|_____|_____|
|
65
|
-
|_.__/
|
87
|
+
|_.__/ \\___|\\___| #{Bee.version.ljust(8)} http://bee.rubyforge.org
|
66
88
|
|
67
89
|
EOF
|
68
90
|
|
@@ -85,6 +107,8 @@ EOF
|
|
85
107
|
file = DEFAULT_BUILD_FILE
|
86
108
|
recursive = false
|
87
109
|
logo = false
|
110
|
+
print_targets = false
|
111
|
+
print_options = false
|
88
112
|
targets = []
|
89
113
|
# read options in BEEOPT environment variable
|
90
114
|
options = ENV[BEE_OPT_ENV]
|
@@ -93,21 +117,7 @@ EOF
|
|
93
117
|
# parse command line arguments
|
94
118
|
old_argv = ARGV
|
95
119
|
ARGV.replace(arguments)
|
96
|
-
opts = GetoptLong.new(
|
97
|
-
['--help', '-h', GetoptLong::NO_ARGUMENT],
|
98
|
-
['--help-build', '-b', GetoptLong::NO_ARGUMENT],
|
99
|
-
['--help-task','-k', GetoptLong::REQUIRED_ARGUMENT],
|
100
|
-
['--help-template','-e', GetoptLong::REQUIRED_ARGUMENT],
|
101
|
-
['--dry-run', '-n', GetoptLong::NO_ARGUMENT],
|
102
|
-
['--property', '-p', GetoptLong::REQUIRED_ARGUMENT],
|
103
|
-
['--template', '-t', GetoptLong::REQUIRED_ARGUMENT],
|
104
|
-
['--verbose', '-v', GetoptLong::NO_ARGUMENT],
|
105
|
-
['--style', '-s', GetoptLong::REQUIRED_ARGUMENT],
|
106
|
-
['--color', '-c', GetoptLong::NO_ARGUMENT],
|
107
|
-
['--black-and-white', '-w', GetoptLong::NO_ARGUMENT],
|
108
|
-
['--file', '-f', GetoptLong::REQUIRED_ARGUMENT],
|
109
|
-
['--recursive', '-r', GetoptLong::NO_ARGUMENT],
|
110
|
-
['--logo', '-l', GetoptLong::NO_ARGUMENT])
|
120
|
+
opts = GetoptLong.new(*OPTIONS)
|
111
121
|
opts.each do |opt, arg|
|
112
122
|
case opt
|
113
123
|
when '--version'
|
@@ -144,13 +154,17 @@ EOF
|
|
144
154
|
recursive = true
|
145
155
|
when '--logo'
|
146
156
|
logo = true
|
157
|
+
when '--targets'
|
158
|
+
print_targets = true
|
159
|
+
when '--options'
|
160
|
+
print_options = true
|
147
161
|
end
|
148
162
|
end
|
149
163
|
targets = Array.new(ARGV)
|
150
164
|
ARGV.replace(old_argv)
|
151
165
|
return [version, help, help_build, help_task, help_template, task,
|
152
166
|
properties, dry_run, template, verbose, style, color, file,
|
153
|
-
recursive, logo, targets]
|
167
|
+
recursive, logo, print_targets, print_options, targets]
|
154
168
|
end
|
155
169
|
|
156
170
|
# Parse a command line property.
|
@@ -175,8 +189,11 @@ EOF
|
|
175
189
|
begin
|
176
190
|
version, help, help_build, help_task, help_template, task,
|
177
191
|
properties, dry_run, template, verbose, style, color, file,
|
178
|
-
recursive, logo,
|
192
|
+
recursive, logo, print_targets, print_options,
|
193
|
+
targets = parse_command_line(arguments)
|
179
194
|
rescue
|
195
|
+
# DEBUG
|
196
|
+
puts $!.backtrace
|
180
197
|
puts "ERROR: parsing command line (type 'bee -h' for help)"
|
181
198
|
exit(EXIT_PARSING_CMDLINE)
|
182
199
|
end
|
@@ -191,8 +208,7 @@ EOF
|
|
191
208
|
puts BEE_LOGO
|
192
209
|
end
|
193
210
|
if version
|
194
|
-
|
195
|
-
puts copyright if copyright
|
211
|
+
puts Bee.version
|
196
212
|
elsif help
|
197
213
|
puts HELP
|
198
214
|
elsif help_build
|
@@ -208,6 +224,16 @@ EOF
|
|
208
224
|
listener = Listener.new(formatter, verbose)
|
209
225
|
build = Build.load(file, false, properties)
|
210
226
|
build.run(targets, listener, dry_run)
|
227
|
+
elsif print_targets
|
228
|
+
begin
|
229
|
+
build = Build.load(file)
|
230
|
+
targets = build.targets.hash.keys
|
231
|
+
rescue Exception
|
232
|
+
targets = []
|
233
|
+
end
|
234
|
+
print targets.join(' ')
|
235
|
+
elsif print_options
|
236
|
+
print OPTIONS.map {|o| o[0]}.join(' ')
|
211
237
|
else
|
212
238
|
listener = Listener.new(formatter, verbose)
|
213
239
|
build = Build.load(file, recursive, properties)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Casabianca & Contributors
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-11-30 00:00:00 +01:00
|
13
13
|
default_executable: bee
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -46,12 +46,14 @@ description:
|
|
46
46
|
email: michel.casabianca@gmail.com
|
47
47
|
executables:
|
48
48
|
- bee
|
49
|
+
- bash_completion_bee
|
49
50
|
extensions: []
|
50
51
|
|
51
52
|
extra_rdoc_files:
|
52
53
|
- README
|
53
54
|
- LICENSE
|
54
55
|
files:
|
56
|
+
- bin/bash_completion_bee
|
55
57
|
- bin/bee
|
56
58
|
- bin/bee.bat
|
57
59
|
- lib/bee.rb
|
@@ -62,6 +64,7 @@ files:
|
|
62
64
|
- lib/bee_task.rb
|
63
65
|
- lib/bee_task_default.rb
|
64
66
|
- lib/bee_util.rb
|
67
|
+
- lib/bee_version.rb
|
65
68
|
- egg/application/bin/start
|
66
69
|
- egg/application/bin/start.bat
|
67
70
|
- egg/application/build.yml
|