bee 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -25,4 +25,4 @@ or go to URL http://www.apache.org/licenses/LICENSE-2.0).
25
25
 
26
26
  = Copyright
27
27
 
28
- bee version 0.11.3 (C) Michel Casabianca & Contributors - 2006-2012
28
+ bee version 0.11.4 (C) Michel Casabianca & Contributors - 2006-2012
@@ -194,11 +194,19 @@ module Bee
194
194
  error "'default' entry of the 'build' block must be a string or an array" if
195
195
  entry['default'] and (!entry['default'].kind_of?(String) and
196
196
  !entry['default'].kind_of?(Array))
197
- @targets.default = Array(entry['default']) if entry['default']
197
+ if entry['default']
198
+ @targets.default = Array(entry['default'])
199
+ @targets.default_set = true
200
+ end
198
201
  # check that 'alias' entry is a hash
199
202
  error "'alias' entry of the 'build' block must be a hash" if
200
203
  entry['alias'] and !entry['alias'].kind_of?(Hash)
201
- @targets.alias = entry['alias'] if entry['alias']
204
+ if entry['alias']
205
+ @targets.alias = entry['alias']
206
+ @targets.alias_set = @targets.alias.keys()
207
+ else
208
+ @targets.alias_set = []
209
+ end
202
210
  @description = entry['description']
203
211
  @abstract = entry['abstract']
204
212
  # load parents build if any
@@ -31,8 +31,12 @@ module Bee
31
31
  attr_reader :already_run
32
32
  # Default target.
33
33
  attr_accessor :default
34
+ # Tells if defautl target was set in build file
35
+ attr_accessor :default_set
34
36
  # Alias for targets
35
37
  attr_accessor :alias
38
+ # Tells if alias was set in build file
39
+ attr_accessor :alias_set
36
40
 
37
41
  # Constructor.
38
42
  # - build: build object.
@@ -85,16 +89,22 @@ module Bee
85
89
  @hash[name] = parent.hash[name]
86
90
  end
87
91
  end
88
- # set default default target to parent one if none was set
92
+ # manage default target
93
+ if parent.default and !@default_set
94
+ @default = [] if !@default
95
+ @default += parent.default
96
+ end
89
97
  @default = @default || parent.default
90
- # manage alias
98
+ # manage aliases
99
+ @alias = {} if !@alias
91
100
  if parent.alias
92
- @alias = {} if !@alias
93
101
  for key in parent.alias.keys
94
- if @alias.has_key?(key)
95
- @alias[key] = Array(@alias[key]) + Array(parent.alias[key])
96
- else
97
- @alias[key] = Array(parent.alias[key])
102
+ if !@alias_set.include?(key)
103
+ if @alias.has_key?(key)
104
+ @alias[key] = Array(@alias[key]) + Array(parent.alias[key])
105
+ else
106
+ @alias[key] = Array(parent.alias[key])
107
+ end
98
108
  end
99
109
  end
100
110
  end
@@ -560,9 +560,6 @@ EOF
560
560
  # false.
561
561
  # - flatten: tells if included files should be copied in destination
562
562
  # directory, ignoring their subdirectory. Optional, defaults to false.
563
- # - sets: a single or list of sets made of root, includes, excludes,
564
- # dotmatch and flatten entries, as defined previously. Can be defined
565
- # only if no root, includes, excludes, dotmatch or flatten are defined.
566
563
  # - dest: destination directory for the copy, must be an existing
567
564
  # directory.
568
565
  # - lenient: tells if copy is lenient, which will silently succeed on
@@ -580,18 +577,6 @@ EOF
580
577
  # excludes: **/CVS/**/*
581
578
  # dest: destination
582
579
  #
583
- # Example:
584
- #
585
- # With sets, you could write :
586
- #
587
- # - copy:
588
- # sets:
589
- # - root: src
590
- # excludes: **/CVS/**/*
591
- # - root: res
592
- # includes: **/*.properties
593
- # dest: destination
594
- #
595
580
  # Note: this task only deals with files. Thus, 'includes' and 'excludes'
596
581
  # globs should be ones for files.
597
582
  def copy(params)
@@ -601,7 +586,6 @@ EOF
601
586
  :includes => { :mandatory => false, :type => :string_or_array },
602
587
  :excludes => { :mandatory => false, :type => :string_or_array },
603
588
  :dotmatch => { :mandatory => false, :type => :boolean },
604
- :sets => { :mandatory => false, :type => :hash_or_array },
605
589
  :dest => { :mandatory => true, :type => :string },
606
590
  :flatten => { :mandatory => false, :type => :boolean,
607
591
  :default => false },
@@ -613,7 +597,6 @@ EOF
613
597
  includes = params[:includes]
614
598
  excludes = params[:excludes]
615
599
  dotmatch = params[:dotmatch]
616
- sets = params[:sets]
617
600
  dest = params[:dest]
618
601
  flatten = params[:flatten]
619
602
  lenient = params[:lenient]
@@ -625,44 +608,17 @@ EOF
625
608
  error "copy 'dest' parameter must be an existing directory"
626
609
  end
627
610
  end
628
- # if no sets defined
629
- if sets == nil
630
- root = '.' if root == nil
631
- dotmatch = false if dotmatch == nil
632
- if not (File.exists?(root) and File.directory?(root))
633
- if lenient
634
- return
635
- else
636
- error "copy 'root' parameter must be an existing directory"
637
- end
638
- end
639
- files = filter_files(root, includes, excludes, dotmatch)
640
- copy_files(root, files, dest, flatten)
641
- # if sets are defined
642
- else
643
- for _set in sets
644
- _unknown = _set.keys - ['root', 'includes', 'excludes', 'dotmatch', 'flatten']
645
- error "copy 'sets' parameter has unknown entry #{_unknown.join(', ')}" if
646
- _unknown.size > 0
647
- _root = _set['root']
648
- _root = '.' if _root == nil
649
- if not (File.exists?(_root) and File.directory?(_root))
650
- if lenient
651
- continue
652
- else
653
- error "copy 'root' entries of 'sets' parameter must be an existing directory"
654
- end
655
- end
656
- _includes = _set['includes']
657
- _excludes = _set['excludes']
658
- _dotmatch = _set['dotmatch']
659
- _dotmatch = false if _dotmatch == nil
660
- _flatten = _set['flatten']
661
- _flatten = false if _flatten == nil
662
- _files = filter_files(_root, _includes, _excludes, _dotmatch)
663
- copy_files(_root, _files, dest, _flatten)
611
+ root = '.' if root == nil
612
+ dotmatch = false if dotmatch == nil
613
+ if not (File.exists?(root) and File.directory?(root))
614
+ if lenient
615
+ return
616
+ else
617
+ error "copy 'root' parameter must be an existing directory"
664
618
  end
665
619
  end
620
+ files = filter_files(root, includes, excludes, dotmatch)
621
+ copy_files(root, files, dest, flatten)
666
622
  end
667
623
 
668
624
  # Move filtered files. Parameter is a hash with following entries:
@@ -164,53 +164,6 @@ module Bee
164
164
  end
165
165
  end
166
166
 
167
- def evaluate_sets(root, includes, excludes, dotmatch, flatten, sets, lenient)
168
- response = []
169
- # check that no root and sets are defined at the same time
170
- if (root || includes || excludes || dotmatch || flatten) && sets
171
- error "Sets might not be used along with root, includes, excludes, dotmatch or flatten"
172
- end
173
- # if no sets defined
174
- if sets == nil
175
- root = '.' if root == nil
176
- dotmatch = false if dotmatch == nil
177
- flatten = false if flatten == nil
178
- if not (File.exists?(root) and File.directory?(root))
179
- if lenient
180
- return
181
- else
182
- error "'root' parameter must be an existing directory"
183
- end
184
- end
185
- response << {:files => filter_files(root, includes, excludes, dotmatch), :flatten => flatten}
186
- # if sets are defined
187
- else
188
- for _set in sets
189
- _unknown = _set.keys - ['root', 'includes', 'excludes', 'dotmatch', 'flatten']
190
- error "'sets' parameter has unknown entry #{_unknown.join(', ')}" if
191
- _unknown.size > 0
192
- _root = _set['root']
193
- _root = '.' if _root == nil
194
- if not (File.exists?(_root) and File.directory?(_root))
195
- if lenient
196
- continue
197
- else
198
- error "'root' entries of 'sets' parameter must be an existing directory"
199
- end
200
- end
201
- _includes = _set['includes']
202
- _excludes = _set['excludes']
203
- _dotmatch = _set['dotmatch']
204
- _dotmatch = false if _dotmatch == nil
205
- _flatten = _set['flatten']
206
- _flatten = false if _flatten == nil
207
- files += filter_files(_root, _includes, _excludes, _dotmatch)
208
- end
209
- response << {:files => files, :flatten => _flatten}
210
- end
211
- return response
212
- end
213
-
214
167
  # Copy a list of files to a given diretory:
215
168
  # - root: root directory of source files.
216
169
  # - files: a list of files to copy relative to root.
@@ -1,5 +1,5 @@
1
1
  module Bee
2
2
 
3
- VERSION = '0.11.3'
3
+ VERSION = '0.11.4'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 3
10
- version: 0.11.3
9
+ - 4
10
+ version: 0.11.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michel Casabianca & Contributors
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-01 00:00:00 +02:00
18
+ date: 2012-08-16 00:00:00 +02:00
19
19
  default_executable: bee
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency