rakelib/rbspec.rb
changeset 102 fc572bd895f2
parent 94 61b2540acc91
child 112 9133803c99a2
equal deleted inserted replaced
101:32f9287b419a 102:fc572bd895f2
   430    
   430    
   431     def prereqs(mandatory: false, referenced: false, root: nil)              
   431     def prereqs(mandatory: false, referenced: false, root: nil)              
   432       if not (mandatory or referenced) then
   432       if not (mandatory or referenced) then
   433         raise Exception.new("Nor mandator nor referenced prereqs asked. Must specify either `mandatoryy: true` or `referenced: true` or both")
   433         raise Exception.new("Nor mandator nor referenced prereqs asked. Must specify either `mandatoryy: true` or `referenced: true` or both")
   434       end
   434       end
       
   435 
   435       # Special hack for stx:stc and stx:librun which are actually 
   436       # Special hack for stx:stc and stx:librun which are actually 
   436       # not a smalltalk packages. 
   437       # not a smalltalk packages. 
   437       if @name == 'stx:stc' or @name == 'stx:librun' then
   438       if @name == 'stx:stc'      
   438         return []
   439         return []
       
   440       end
       
   441       if @name == 'stx:librun'
       
   442         # stx:librun depends on STC
       
   443         return ['stx:stc']
   439       end
   444       end
   440 
   445 
   441       root = BUILD_DIR if (not root && defined? BUILD_DIR)
   446       root = BUILD_DIR if (not root && defined? BUILD_DIR)
   442       if not root then
   447       if not root then
   443         raise Exception.new("BUILD_DIR not defined and no package root passed to Package::prereqs()")
   448         raise Exception.new("BUILD_DIR not defined and no package root passed to Package::prereqs()")
   450       source = ''
   455       source = ''
   451       File.open(source_file, 'r').each do | line |
   456       File.open(source_file, 'r').each do | line |
   452         source << line
   457         source << line
   453       end      
   458       end      
   454       source.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
   459       source.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
   455       prereqs = []      
   460       # All packaged depends on STC - one cannot compile them without it!
       
   461       prereqs = ['stx:stc']       
   456       if mandatory then        
   462       if mandatory then        
   457         prereqs += source.scan(/^mandatoryPreRequisites(.*?)!$/m).flatten.to_s.scan(/#'([^']+)'/).flatten
   463         prereqs += source.scan(/^mandatoryPreRequisites(.*?)!$/m).flatten.to_s.scan(/#'([^']+)'/).flatten
   458       end
   464       end
   459       if referenced then        
   465       if referenced then        
   460         prereqs += source.scan(/^referencedPreRequisites(.*?)!$/m).flatten.to_s.scan(/#'([^']+)'/).flatten
   466         prereqs += source.scan(/^referencedPreRequisites(.*?)!$/m).flatten.to_s.scan(/#'([^']+)'/).flatten