bee 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/bee.rb +34 -18
- data/lib/bee_console.rb +1 -1
- metadata +13 -13
data/README
CHANGED
data/lib/bee.rb
CHANGED
@@ -639,13 +639,19 @@ module Bee
|
|
639
639
|
# - dry: tells if we run in dry mode.
|
640
640
|
def construct_if(task, dry)
|
641
641
|
# test entries
|
642
|
-
error "If construct must include 'then' entry" if
|
642
|
+
error "If-then-else construct must include 'then' entry" if
|
643
643
|
not task.keys.include?('then')
|
644
644
|
unknown_keys = task.keys - ['if', 'then', 'else']
|
645
|
-
error "If construct may only include 'if', 'then' and 'else' entries" if
|
645
|
+
error "If-then-else construct may only include 'if', 'then' and 'else' entries" if
|
646
646
|
unknown_keys.length > 0
|
647
|
+
error "If entry in if-then-else construct must be a string" if
|
648
|
+
not task['if'].kind_of?(String)
|
649
|
+
error "Then entry in if-then-else construct must be a list" if
|
650
|
+
not task['then'].kind_of?(Array)
|
651
|
+
error "Else entry in if-then-else construct must be a list" if
|
652
|
+
task['else'] and not task['else'].kind_of?(Array)
|
647
653
|
# evaluate condition in the build context
|
648
|
-
if evaluate(task['if']
|
654
|
+
if evaluate(task['if'])
|
649
655
|
run_block(task['then'], dry)
|
650
656
|
else
|
651
657
|
run_block(task['else'], dry) if task['else']
|
@@ -657,11 +663,15 @@ module Bee
|
|
657
663
|
# - dry: tells if we run in dry mode.
|
658
664
|
def construct_while(task, dry)
|
659
665
|
# test entries
|
660
|
-
error "While construct must include 'do' entry" if
|
666
|
+
error "While-do construct must include 'do' entry" if
|
661
667
|
not task.keys.include?('do')
|
662
668
|
unknown_keys = task.keys - ['while', 'do']
|
663
|
-
error "While construct may only include 'while' and 'do' entries" if
|
669
|
+
error "While-do construct may only include 'while' and 'do' entries" if
|
664
670
|
unknown_keys.length > 0
|
671
|
+
error "While entry in while-do construct must be a string" if
|
672
|
+
not task['while'].kind_of?(String)
|
673
|
+
error "Do entry in while-do construct must be a list" if
|
674
|
+
not task['do'].kind_of?(Array)
|
665
675
|
# evaluate condition in the build context
|
666
676
|
while evaluate(task['while'])
|
667
677
|
run_block(task['do'], dry)
|
@@ -673,18 +683,21 @@ module Bee
|
|
673
683
|
# - dry: tells if we run in dry mode.
|
674
684
|
def construct_for(task, dry)
|
675
685
|
# test entries
|
676
|
-
error "For construct must include 'in' and 'do' entries" if
|
686
|
+
error "For-in-do construct must include 'in' and 'do' entries" if
|
677
687
|
not task.keys.include?('in') or not task.keys.include?('do')
|
678
688
|
unknown_keys = task.keys - ['for', 'in', 'do']
|
679
|
-
error "For construct may only include 'for', 'in' and 'do' entries" if
|
689
|
+
error "For-in-do construct may only include 'for', 'in' and 'do' entries" if
|
680
690
|
unknown_keys.length > 0
|
681
|
-
error "For entry in for construct must be a string" if
|
691
|
+
error "For entry in for-in-do construct must be a string" if
|
682
692
|
not task['for'].kind_of?(String)
|
683
|
-
error "In entry in for construct must be a list or a string" if
|
693
|
+
error "In entry in for-in-do construct must be a list or a string" if
|
684
694
|
not task['in'].kind_of?(Enumerable) and not task['in'].kind_of?(String)
|
695
|
+
error "Do entry in for-in-do construct must be a list" if
|
696
|
+
not task['do'].kind_of?(Array)
|
685
697
|
# iterate over list
|
686
698
|
if task['in'].kind_of?(String)
|
687
|
-
enumerable = evaluate(
|
699
|
+
enumerable = evaluate(@targets.build.context.
|
700
|
+
evaluate_object(task['in']))
|
688
701
|
else
|
689
702
|
enumerable = task['in']
|
690
703
|
end
|
@@ -707,12 +720,12 @@ module Bee
|
|
707
720
|
end
|
708
721
|
end
|
709
722
|
|
710
|
-
# Evaluate a given
|
711
|
-
def evaluate(
|
723
|
+
# Evaluate a given expression and raise a BuildError if an error happens.
|
724
|
+
def evaluate(expression)
|
712
725
|
begin
|
713
|
-
return @targets.build.context.evaluate_script(
|
726
|
+
return @targets.build.context.evaluate_script(expression)
|
714
727
|
rescue
|
715
|
-
error "Error evaluating
|
728
|
+
error "Error evaluating expression: #{$!}"
|
716
729
|
end
|
717
730
|
end
|
718
731
|
|
@@ -783,11 +796,14 @@ module Bee
|
|
783
796
|
# nil: return nil
|
784
797
|
return nil
|
785
798
|
when String
|
786
|
-
# string: replace
|
799
|
+
# string: replace embedded Ruby expressions
|
787
800
|
object = object.gsub(/#\{.+?\}/) do |match|
|
788
|
-
|
789
|
-
|
790
|
-
|
801
|
+
expression = match[2..-2]
|
802
|
+
begin
|
803
|
+
value = evaluate_script(expression)
|
804
|
+
rescue
|
805
|
+
error "Error evaluating expression '#{expression}': #{$!}"
|
806
|
+
end
|
791
807
|
value
|
792
808
|
end
|
793
809
|
return object
|
data/lib/bee_console.rb
CHANGED
@@ -60,7 +60,7 @@ targets Targets to run (default target if omitted).'
|
|
60
60
|
| |__ ___ ___
|
61
61
|
____ | '_ \ / _ \/ _ \ _____ _____ _____ _____ _____ _____ _____ _____ _____
|
62
62
|
|____| | |_) | __/ __/ |_____|_____|_____|_____|_____|_____|_____|_____|_____|
|
63
|
-
|_.__/ \___|\___| 0.6.
|
63
|
+
|_.__/ \___|\___| 0.6.1 http://bee.rubyforge.org
|
64
64
|
|
65
65
|
EOF
|
66
66
|
|
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.6.
|
4
|
+
version: 0.6.1
|
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-02-
|
12
|
+
date: 2010-02-11 00:00:00 +01:00
|
13
13
|
default_executable: bee
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,28 +42,28 @@ extra_rdoc_files:
|
|
42
42
|
- README
|
43
43
|
- LICENSE
|
44
44
|
files:
|
45
|
-
- bin/bee.bat
|
46
45
|
- bin/bee
|
46
|
+
- bin/bee.bat
|
47
|
+
- lib/bee.rb
|
47
48
|
- lib/bee_console.rb
|
48
49
|
- lib/bee_task.rb
|
49
50
|
- lib/bee_task_default.rb
|
50
51
|
- lib/bee_util.rb
|
51
|
-
-
|
52
|
-
- egg/package.yml
|
53
|
-
- egg/package/test.erb
|
54
|
-
- egg/package/test_suite.rb
|
55
|
-
- egg/package/gem_spec.erb
|
52
|
+
- egg/package/bee_task.erb
|
56
53
|
- egg/package/build.erb
|
54
|
+
- egg/package/egg.yml
|
55
|
+
- egg/package/egg_build.erb
|
56
|
+
- egg/package/egg_launcher.erb
|
57
57
|
- egg/package/egg_script.rb
|
58
|
+
- egg/package/gem_spec.erb
|
58
59
|
- egg/package/license
|
59
|
-
- egg/package/egg_launcher.erb
|
60
60
|
- egg/package/readme.erb
|
61
|
-
- egg/package/
|
62
|
-
- egg/package/egg.yml
|
61
|
+
- egg/package/test.erb
|
63
62
|
- egg/package/test_build.erb
|
64
|
-
- egg/package/egg_build.erb
|
65
|
-
- egg/package/test_build_listener.rb
|
66
63
|
- egg/package/test_build.rb
|
64
|
+
- egg/package/test_build_listener.rb
|
65
|
+
- egg/package/test_suite.rb
|
66
|
+
- egg/package.yml
|
67
67
|
- README
|
68
68
|
- LICENSE
|
69
69
|
has_rdoc: true
|