bee 0.4.0 → 0.5.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/README +1 -1
 - data/bin/bee +1 -1
 - data/bin/bee.bat +1 -1
 - data/egg/package.yml +100 -0
 - data/egg/package/bee_task.erb +25 -0
 - data/egg/package/build.erb +70 -0
 - data/egg/package/egg.yml +58 -0
 - data/egg/package/egg_build.erb +57 -0
 - data/egg/package/egg_launcher.erb +6 -0
 - data/egg/package/egg_script.rb +31 -0
 - data/egg/package/gem_spec.erb +23 -0
 - data/egg/package/license +202 -0
 - data/egg/package/readme.erb +23 -0
 - data/egg/package/test.erb +28 -0
 - data/egg/package/test_build.erb +16 -0
 - data/{test → egg/package}/test_build.rb +1 -1
 - data/{test → egg/package}/test_build_listener.rb +3 -1
 - data/{test/ts_bee.rb → egg/package/test_suite.rb} +1 -1
 - data/lib/bee.rb +468 -167
 - data/lib/bee_console.rb +174 -94
 - data/lib/bee_task.rb +121 -19
 - data/lib/bee_task_default.rb +1016 -229
 - data/lib/bee_util.rb +217 -64
 - metadata +73 -58
 - data/test/tc_bee_build.rb +0 -216
 - data/test/tc_bee_console.rb +0 -106
 - data/test/tc_bee_console_formatter.rb +0 -81
 - data/test/tc_bee_context.rb +0 -84
 - data/test/tc_bee_task_default.rb +0 -467
 - data/test/tc_bee_util.rb +0 -85
 - data/test/tmp_test_case.rb +0 -58
 
    
        data/lib/bee_util.rb
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Copyright 2006- 
     | 
| 
      
 1 
     | 
    
         
            +
            # Copyright 2006-2008 Michel Casabianca <michel.casabianca@gmail.com>
         
     | 
| 
       2 
2 
     | 
    
         
             
            #           2006 Avi Bryant
         
     | 
| 
       3 
3 
     | 
    
         
             
            #
         
     | 
| 
       4 
4 
     | 
    
         
             
            # Licensed under the Apache License, Version 2.0 (the "License");
         
     | 
| 
         @@ -13,38 +13,53 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
            # See the License for the specific language governing permissions and
         
     | 
| 
       14 
14 
     | 
    
         
             
            # limitations under the License.
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
18 
     | 
    
         
             
            module Bee
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
20 
     | 
    
         
             
              module Util
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                #  
     | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                # Limit of number of HTTP redirections to follow.
         
     | 
| 
      
 23 
     | 
    
         
            +
                HTTP_REDIRECTIONS_LIMIT = 10
         
     | 
| 
      
 24 
     | 
    
         
            +
                # README file where copyright is extracted.
         
     | 
| 
      
 25 
     | 
    
         
            +
                README_FILE = 'README'
         
     | 
| 
      
 26 
     | 
    
         
            +
                # Default package name.
         
     | 
| 
      
 27 
     | 
    
         
            +
                DEFAULT_PACKAGE = 'default'    
         
     | 
| 
      
 28 
     | 
    
         
            +
                # Compact pattern for resource
         
     | 
| 
      
 29 
     | 
    
         
            +
                COMPACT_PATTERN  = /^:(.*?)\.(.*?)(\[(.*)\])?$/
         
     | 
| 
      
 30 
     | 
    
         
            +
                # Expanded pattern for resource
         
     | 
| 
      
 31 
     | 
    
         
            +
                EXPANDED_PATTERN = /^ruby:\/\/(.*?)(:(.*?))?\/(.*)$/
         
     | 
| 
      
 32 
     | 
    
         
            +
                # Default terminal width
         
     | 
| 
      
 33 
     | 
    
         
            +
                DEFAULT_TERM_WIDTH = 80
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                # Get line length calling IOCTL. Return DEFAULT_TERM_WIDTH if call failed.
         
     | 
| 
       23 
36 
     | 
    
         
             
                def self.term_width
         
     | 
| 
       24 
37 
     | 
    
         
             
                  begin
         
     | 
| 
       25 
     | 
    
         
            -
                    tiocgwinsz = 0x5413
         
     | 
| 
      
 38 
     | 
    
         
            +
                    tiocgwinsz = RUBY_PLATFORM =~ /darwin/ ? 0x40087468 : 0x5413
         
     | 
| 
       26 
39 
     | 
    
         
             
                    string = [0, 0, 0, 0].pack('SSSS')
         
     | 
| 
       27 
40 
     | 
    
         
             
                    if $stdin.ioctl(tiocgwinsz, string) >= 0 then
         
     | 
| 
       28 
41 
     | 
    
         
             
                      rows, cols, xpixels, ypixels = string.unpack('SSSS')
         
     | 
| 
      
 42 
     | 
    
         
            +
                      cols = DEFAULT_TERM_WIDTH if cols <= 0
         
     | 
| 
       29 
43 
     | 
    
         
             
                      return cols
         
     | 
| 
      
 44 
     | 
    
         
            +
                    else
         
     | 
| 
      
 45 
     | 
    
         
            +
                      return DEFAULT_TERM_WIDTH
         
     | 
| 
       30 
46 
     | 
    
         
             
                    end
         
     | 
| 
       31 
47 
     | 
    
         
             
                  rescue
         
     | 
| 
       32 
     | 
    
         
            -
                    return  
     | 
| 
      
 48 
     | 
    
         
            +
                    return DEFAULT_TERM_WIDTH
         
     | 
| 
       33 
49 
     | 
    
         
             
                  end
         
     | 
| 
       34 
50 
     | 
    
         
             
                end
         
     | 
| 
       35 
51 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                #  
     | 
| 
       37 
     | 
    
         
            -
                #  
     | 
| 
       38 
     | 
    
         
            -
                 
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
                # Return copyright parsing README file. Returns nil if COPYRIGHT file
         
     | 
| 
      
 53 
     | 
    
         
            +
                # was not found.
         
     | 
| 
      
 54 
     | 
    
         
            +
                def self.copyright
         
     | 
| 
      
 55 
     | 
    
         
            +
                  readme = File.join(File.dirname(__FILE__), '..', README_FILE)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 57 
     | 
    
         
            +
                    copyright = File.read(readme).strip!.split("\n")[-1]
         
     | 
| 
      
 58 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 59 
     | 
    
         
            +
                    copyright = nil
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  return copyright
         
     | 
| 
       44 
62 
     | 
    
         
             
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # Default package name.
         
     | 
| 
       47 
     | 
    
         
            -
                DEFAULT_PACKAGE = 'default'
         
     | 
| 
       48 
63 
     | 
    
         | 
| 
       49 
64 
     | 
    
         
             
                # Parse packaged name and return package and name.
         
     | 
| 
       50 
65 
     | 
    
         
             
                # - packaged: packaged name (such as 'foo.bar').
         
     | 
| 
         @@ -57,12 +72,186 @@ module Bee 
     | 
|
| 
       57 
72 
     | 
    
         
             
                  end
         
     | 
| 
       58 
73 
     | 
    
         
             
                  return package, name
         
     | 
| 
       59 
74 
     | 
    
         
             
                end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                # Get a given file or URL. Manages HTTP redirections.
         
     | 
| 
      
 77 
     | 
    
         
            +
                # - location: file path, resource or URL of the file to get.
         
     | 
| 
      
 78 
     | 
    
         
            +
                # - base: base for relative files (defaults to nil).
         
     | 
| 
      
 79 
     | 
    
         
            +
                def self.get_file(location, base=nil)
         
     | 
| 
      
 80 
     | 
    
         
            +
                  base = base || Dir.pwd
         
     | 
| 
      
 81 
     | 
    
         
            +
                  abs = absolute_path(location, base)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  if abs =~ /^http:/
         
     | 
| 
      
 83 
     | 
    
         
            +
                    # this is HTTP
         
     | 
| 
      
 84 
     | 
    
         
            +
                    return fetch(abs)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  else
         
     | 
| 
      
 86 
     | 
    
         
            +
                    # this is a file
         
     | 
| 
      
 87 
     | 
    
         
            +
                    return File.read(abs)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end  
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                private
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                # Looks recursively up in file system for a file.
         
     | 
| 
      
 94 
     | 
    
         
            +
                # - file: file name to look for.
         
     | 
| 
      
 95 
     | 
    
         
            +
                # Return: found file or raises an exception if file was not found.
         
     | 
| 
      
 96 
     | 
    
         
            +
                def self.find(file)
         
     | 
| 
      
 97 
     | 
    
         
            +
                  return file if File.exists?(file)
         
     | 
| 
      
 98 
     | 
    
         
            +
                  raise "File not found" if File.identical?(File.dirname(file), '/')
         
     | 
| 
      
 99 
     | 
    
         
            +
                  file = File.join('..', file)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  find(file)
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                # Function to tell if a file name is a URL.
         
     | 
| 
      
 104 
     | 
    
         
            +
                # - file: file name to consider.
         
     | 
| 
      
 105 
     | 
    
         
            +
                def self.url?(file)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  return file =~ /^http:/
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                # Tells if a given path is absolute.
         
     | 
| 
      
 110 
     | 
    
         
            +
                # - location: file to consider.
         
     | 
| 
      
 111 
     | 
    
         
            +
                def self.absolute_path?(location)
         
     | 
| 
      
 112 
     | 
    
         
            +
                  if url?(location) or resource?(location)
         
     | 
| 
      
 113 
     | 
    
         
            +
                    return true
         
     | 
| 
      
 114 
     | 
    
         
            +
                  else
         
     | 
| 
      
 115 
     | 
    
         
            +
                    case RUBY_PLATFORM
         
     | 
| 
      
 116 
     | 
    
         
            +
                    when /mswin/
         
     | 
| 
      
 117 
     | 
    
         
            +
                      return location =~ /^(([a-z]|[A-Z]):)?\//
         
     | 
| 
      
 118 
     | 
    
         
            +
                    else
         
     | 
| 
      
 119 
     | 
    
         
            +
                      return location =~ /^\//
         
     | 
| 
      
 120 
     | 
    
         
            +
                    end
         
     | 
| 
      
 121 
     | 
    
         
            +
                  end
         
     | 
| 
      
 122 
     | 
    
         
            +
                end
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                # Utility method that returns absolute path for a given file relative
         
     | 
| 
      
 125 
     | 
    
         
            +
                # to base.
         
     | 
| 
      
 126 
     | 
    
         
            +
                # - location: location to get absolute path for.
         
     | 
| 
      
 127 
     | 
    
         
            +
                # - base: base for relative paths (may be an URL).
         
     | 
| 
      
 128 
     | 
    
         
            +
                def self.absolute_path(location, base)
         
     | 
| 
      
 129 
     | 
    
         
            +
                  if absolute_path?(location)
         
     | 
| 
      
 130 
     | 
    
         
            +
                    if resource?(location)
         
     | 
| 
      
 131 
     | 
    
         
            +
                      location = resource_path(location)
         
     | 
| 
      
 132 
     | 
    
         
            +
                    end
         
     | 
| 
      
 133 
     | 
    
         
            +
                    return location
         
     | 
| 
      
 134 
     | 
    
         
            +
                  else
         
     | 
| 
      
 135 
     | 
    
         
            +
                    return File.join(base, location)
         
     | 
| 
      
 136 
     | 
    
         
            +
                  end
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                # Get a given URL.
         
     | 
| 
      
 140 
     | 
    
         
            +
                # - url: URL to get.
         
     | 
| 
      
 141 
     | 
    
         
            +
                # - limit: redirectrion limit (defaults to HTTP_REDIRECTIONS_LIMIT).
         
     | 
| 
      
 142 
     | 
    
         
            +
                def self.fetch(url, limit = HTTP_REDIRECTIONS_LIMIT)
         
     | 
| 
      
 143 
     | 
    
         
            +
                  raise 'HTTP redirect too deep' if limit == 0
         
     | 
| 
      
 144 
     | 
    
         
            +
                  response = Net::HTTP.get_response(URI.parse(url))
         
     | 
| 
      
 145 
     | 
    
         
            +
                  case response
         
     | 
| 
      
 146 
     | 
    
         
            +
                  when Net::HTTPSuccess
         
     | 
| 
      
 147 
     | 
    
         
            +
                    response.body
         
     | 
| 
      
 148 
     | 
    
         
            +
                  when Net::HTTPRedirection
         
     | 
| 
      
 149 
     | 
    
         
            +
                    fetch(response['location'], limit - 1)
         
     | 
| 
      
 150 
     | 
    
         
            +
                  else
         
     | 
| 
      
 151 
     | 
    
         
            +
                    response.error!
         
     | 
| 
      
 152 
     | 
    
         
            +
                  end
         
     | 
| 
      
 153 
     | 
    
         
            +
                end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                # Tells is a given location is a resource.
         
     | 
| 
      
 156 
     | 
    
         
            +
                # - location: location to examine.
         
     | 
| 
      
 157 
     | 
    
         
            +
                def self.resource?(location)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  return location.to_s =~ /^ruby:\/\// || location.to_s =~ /^:/
         
     | 
| 
      
 159 
     | 
    
         
            +
                end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                # Return the path to a given resoure and test that file exists.
         
     | 
| 
      
 162 
     | 
    
         
            +
                # - resource: the resource (expanded or compact pattern).
         
     | 
| 
      
 163 
     | 
    
         
            +
                def self.resource_path(resource)
         
     | 
| 
      
 164 
     | 
    
         
            +
                  # get gem, version and path from resource
         
     | 
| 
      
 165 
     | 
    
         
            +
                  case resource
         
     | 
| 
      
 166 
     | 
    
         
            +
                  when COMPACT_PATTERN
         
     | 
| 
      
 167 
     | 
    
         
            +
                    gem, version, path = $1, $4, $2
         
     | 
| 
      
 168 
     | 
    
         
            +
                  when EXPANDED_PATTERN
         
     | 
| 
      
 169 
     | 
    
         
            +
                    gem, version, path = $1, $3, $4
         
     | 
| 
      
 170 
     | 
    
         
            +
                  else
         
     | 
| 
      
 171 
     | 
    
         
            +
                    raise "'#{resource}' is not a valid resource"
         
     | 
| 
      
 172 
     | 
    
         
            +
                  end
         
     | 
| 
      
 173 
     | 
    
         
            +
                  # get gem descriptor
         
     | 
| 
      
 174 
     | 
    
         
            +
                  if version
         
     | 
| 
      
 175 
     | 
    
         
            +
                    gem_descriptor = Gem.source_index.find_name(gem, version)[0]
         
     | 
| 
      
 176 
     | 
    
         
            +
                    raise "Gem '#{gem}' was not found in version '#{version}'" if
         
     | 
| 
      
 177 
     | 
    
         
            +
                      not gem_descriptor
         
     | 
| 
      
 178 
     | 
    
         
            +
                  else
         
     | 
| 
      
 179 
     | 
    
         
            +
                    gem_descriptor = Gem.source_index.find_name(gem)[0]
         
     | 
| 
      
 180 
     | 
    
         
            +
                    raise "Gem '#{gem}' was not found" if
         
     | 
| 
      
 181 
     | 
    
         
            +
                      not gem_descriptor
         
     | 
| 
      
 182 
     | 
    
         
            +
                  end
         
     | 
| 
      
 183 
     | 
    
         
            +
                  # get resource path
         
     | 
| 
      
 184 
     | 
    
         
            +
                  gem_path = gem_descriptor.full_gem_path
         
     | 
| 
      
 185 
     | 
    
         
            +
                  file_path = File.join(gem_path, path)
         
     | 
| 
      
 186 
     | 
    
         
            +
                  return file_path
         
     | 
| 
      
 187 
     | 
    
         
            +
                end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                # Find a given template and return associated file.
         
     | 
| 
      
 190 
     | 
    
         
            +
                # - template: template to look for.
         
     | 
| 
      
 191 
     | 
    
         
            +
                # return: found associated file.
         
     | 
| 
      
 192 
     | 
    
         
            +
                def self.find_template(template)
         
     | 
| 
      
 193 
     | 
    
         
            +
                  raise Bee::Util::BuildError.
         
     | 
| 
      
 194 
     | 
    
         
            +
                    new("Invalid template name '#{template}'") if
         
     | 
| 
      
 195 
     | 
    
         
            +
                    not template =~ /^([^.]+\.)?[^.]+$/
         
     | 
| 
      
 196 
     | 
    
         
            +
                  package, egg = template.split('.')
         
     | 
| 
      
 197 
     | 
    
         
            +
                  if not egg
         
     | 
| 
      
 198 
     | 
    
         
            +
                    egg = package
         
     | 
| 
      
 199 
     | 
    
         
            +
                    package = 'bee'
         
     | 
| 
      
 200 
     | 
    
         
            +
                  end
         
     | 
| 
      
 201 
     | 
    
         
            +
                  prefix = (package == 'bee' ? '':'bee_')
         
     | 
| 
      
 202 
     | 
    
         
            +
                  resource = ":#{prefix}#{package}.egg/#{egg}.yml"
         
     | 
| 
      
 203 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 204 
     | 
    
         
            +
                    file = absolute_path(resource, Dir.pwd)
         
     | 
| 
      
 205 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 206 
     | 
    
         
            +
                    raise BuildError.new("Template '#{template}' not found")
         
     | 
| 
      
 207 
     | 
    
         
            +
                  end
         
     | 
| 
      
 208 
     | 
    
         
            +
                  raise BuildError.new("Template '#{template}' not found") if
         
     | 
| 
      
 209 
     | 
    
         
            +
                    not File.exists?(file)
         
     | 
| 
      
 210 
     | 
    
         
            +
                  return file
         
     | 
| 
      
 211 
     | 
    
         
            +
                end
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                # Search files for a given templates that might contain a joker (*).
         
     | 
| 
      
 214 
     | 
    
         
            +
                # - template: template to look for.
         
     | 
| 
      
 215 
     | 
    
         
            +
                # return: a hash associating template and corresponding file.
         
     | 
| 
      
 216 
     | 
    
         
            +
                def self.search_templates(template)
         
     | 
| 
      
 217 
     | 
    
         
            +
                  raise Bee::Util::BuildError.
         
     | 
| 
      
 218 
     | 
    
         
            +
                    new("Invalid template name '#{template}'") if
         
     | 
| 
      
 219 
     | 
    
         
            +
                      not template =~ /^([^.]+\.)?[^.]+$/
         
     | 
| 
      
 220 
     | 
    
         
            +
                  package, egg = template.split('.')
         
     | 
| 
      
 221 
     | 
    
         
            +
                  if not egg
         
     | 
| 
      
 222 
     | 
    
         
            +
                    egg = package
         
     | 
| 
      
 223 
     | 
    
         
            +
                    package = 'bee'
         
     | 
| 
      
 224 
     | 
    
         
            +
                  end
         
     | 
| 
      
 225 
     | 
    
         
            +
                  prefix = (package == 'bee' ? '':'bee_')
         
     | 
| 
      
 226 
     | 
    
         
            +
                  egg = '*' if egg == '?'
         
     | 
| 
      
 227 
     | 
    
         
            +
                  resource = ":#{prefix}#{package}.egg/#{egg}.yml"
         
     | 
| 
      
 228 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 229 
     | 
    
         
            +
                    glob = absolute_path(resource, Dir.pwd)
         
     | 
| 
      
 230 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 231 
     | 
    
         
            +
                    if egg == '*'
         
     | 
| 
      
 232 
     | 
    
         
            +
                      raise BuildError.new("Template package '#{package}' not found")
         
     | 
| 
      
 233 
     | 
    
         
            +
                    else
         
     | 
| 
      
 234 
     | 
    
         
            +
                      raise BuildError.new("Template '#{template}' not found")
         
     | 
| 
      
 235 
     | 
    
         
            +
                    end
         
     | 
| 
      
 236 
     | 
    
         
            +
                  end
         
     | 
| 
      
 237 
     | 
    
         
            +
                  files = Dir.glob(glob)
         
     | 
| 
      
 238 
     | 
    
         
            +
                  hash = {}
         
     | 
| 
      
 239 
     | 
    
         
            +
                  for file in files
         
     | 
| 
      
 240 
     | 
    
         
            +
                    egg = file.match(/.*?([^\/]+)\.yml/)[1]
         
     | 
| 
      
 241 
     | 
    
         
            +
                    name = "#{package}.#{egg}"
         
     | 
| 
      
 242 
     | 
    
         
            +
                    hash[name] = file
         
     | 
| 
      
 243 
     | 
    
         
            +
                  end
         
     | 
| 
      
 244 
     | 
    
         
            +
                  return hash
         
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
       61 
247 
     | 
    
         
             
                # Class that holds information about a given method.
         
     | 
| 
       62 
248 
     | 
    
         
             
                class MethodInfo
         
     | 
| 
       63 
249 
     | 
    
         | 
| 
       64 
250 
     | 
    
         
             
                  attr_accessor :source, :comment, :defn, :params
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
                  # Constructor taking file name and line number.
         
     | 
| 
      
 253 
     | 
    
         
            +
                  # - file: file name of the method.
         
     | 
| 
      
 254 
     | 
    
         
            +
                  # - lineno: line number of the method.
         
     | 
| 
       66 
255 
     | 
    
         
             
                  def initialize(file, lineno)
         
     | 
| 
       67 
256 
     | 
    
         
             
                    lines = file_cache(file)
         
     | 
| 
       68 
257 
     | 
    
         
             
                    @source = match_tabs(lines, lineno, "def")
         
     | 
| 
         @@ -72,7 +261,7 @@ module Bee 
     | 
|
| 
       72 
261 
     | 
    
         
             
                  end
         
     | 
| 
       73 
262 
     | 
    
         | 
| 
       74 
263 
     | 
    
         
             
                  private
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
       76 
265 
     | 
    
         
             
                  @@file_cache = {}
         
     | 
| 
       77 
266 
     | 
    
         | 
| 
       78 
267 
     | 
    
         
             
                  def file_cache(file)
         
     | 
| 
         @@ -118,18 +307,21 @@ module Bee 
     | 
|
| 
       118 
307 
     | 
    
         
             
                class MethodInfoBase
         
     | 
| 
       119 
308 
     | 
    
         | 
| 
       120 
309 
     | 
    
         
             
                  @@minfo = {}
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
                  # Return comment for a given method.
         
     | 
| 
      
 312 
     | 
    
         
            +
                  # - method: the method name to get info for.
         
     | 
| 
       122 
313 
     | 
    
         
             
                  def self.method_info(method)
         
     | 
| 
       123 
314 
     | 
    
         
             
                    @@minfo[method.to_s]
         
     | 
| 
       124 
315 
     | 
    
         
             
                  end
         
     | 
| 
       125 
316 
     | 
    
         | 
| 
       126 
317 
     | 
    
         
             
                  private
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
                  # Called when a method is added.
         
     | 
| 
      
 320 
     | 
    
         
            +
                  # - method: added method.
         
     | 
| 
       128 
321 
     | 
    
         
             
                  def self.method_added(method)
         
     | 
| 
       129 
322 
     | 
    
         
             
                    super if defined? super
         
     | 
| 
       130 
323 
     | 
    
         
             
                    last = caller[0]
         
     | 
| 
       131 
     | 
    
         
            -
                    file = last 
     | 
| 
       132 
     | 
    
         
            -
                    lineno = last[last.rindex(':')+1, last.length]
         
     | 
| 
      
 324 
     | 
    
         
            +
                    file, lineno = last.match(/(.+?):(\d+)/)[1, 2]
         
     | 
| 
       133 
325 
     | 
    
         
             
                    @@minfo[method.to_s] = MethodInfo.new(file, lineno.to_i - 1)
         
     | 
| 
       134 
326 
     | 
    
         
             
                  end
         
     | 
| 
       135 
327 
     | 
    
         | 
| 
         @@ -172,7 +364,7 @@ module Bee 
     | 
|
| 
       172 
364 
     | 
    
         
             
                    for key in description.keys
         
     | 
| 
       173 
365 
     | 
    
         
             
                      case description[key]
         
     | 
| 
       174 
366 
     | 
    
         
             
                      when :mandatory
         
     | 
| 
       175 
     | 
    
         
            -
                        error "Missing mandatory key '#{key}'" if not hash 
     | 
| 
      
 367 
     | 
    
         
            +
                        error "Missing mandatory key '#{key}'" if not hash.has_key?(key)
         
     | 
| 
       176 
368 
     | 
    
         
             
                      when :optional
         
     | 
| 
       177 
369 
     | 
    
         
             
                      else
         
     | 
| 
       178 
370 
     | 
    
         
             
                        error "Unknown symbol '#{description[key]}'"
         
     | 
| 
         @@ -185,45 +377,6 @@ module Bee 
     | 
|
| 
       185 
377 
     | 
    
         
             
                  end
         
     | 
| 
       186 
378 
     | 
    
         | 
| 
       187 
379 
     | 
    
         
             
                end
         
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
                # Module that includes a mixin that provides file selection using include
         
     | 
| 
       190 
     | 
    
         
            -
                # and exclude globs.
         
     | 
| 
       191 
     | 
    
         
            -
                module FileSelector
         
     | 
| 
       192 
     | 
    
         
            -
                  
         
     | 
| 
       193 
     | 
    
         
            -
                  include BuildErrorMixin
         
     | 
| 
       194 
     | 
    
         
            -
                  
         
     | 
| 
       195 
     | 
    
         
            -
                  # Select files with globs to include and exclude.
         
     | 
| 
       196 
     | 
    
         
            -
                  # - include: glob (or list of globs) for files to include.
         
     | 
| 
       197 
     | 
    
         
            -
                  # - exclude: glob (or list of globs) for files to exclude.
         
     | 
| 
       198 
     | 
    
         
            -
                  # Return: a list of files as strings.
         
     | 
| 
       199 
     | 
    
         
            -
                  def select_files(includes, excludes)
         
     | 
| 
       200 
     | 
    
         
            -
                    return [] if !includes
         
     | 
| 
       201 
     | 
    
         
            -
                    error "includes can't be nil" if not includes
         
     | 
| 
       202 
     | 
    
         
            -
                    error "includes must be a glob or a list of globs" unless
         
     | 
| 
       203 
     | 
    
         
            -
                    includes.kind_of?(String) or includes.kind_of?(Array)
         
     | 
| 
       204 
     | 
    
         
            -
                    error "excludes must be a glob or a list of globs" unless
         
     | 
| 
       205 
     | 
    
         
            -
                    !excludes or excludes.kind_of?(String) or excludes.kind_of?(Array)
         
     | 
| 
       206 
     | 
    
         
            -
                    included = []
         
     | 
| 
       207 
     | 
    
         
            -
                    for include in includes
         
     | 
| 
       208 
     | 
    
         
            -
                      error "includes must be a glob or a list of globs" unless
         
     | 
| 
       209 
     | 
    
         
            -
                      include.kind_of?(String)
         
     | 
| 
       210 
     | 
    
         
            -
                      included += Dir.glob(include)
         
     | 
| 
       211 
     | 
    
         
            -
                    end
         
     | 
| 
       212 
     | 
    
         
            -
                    if excludes
         
     | 
| 
       213 
     | 
    
         
            -
                      excluded = []
         
     | 
| 
       214 
     | 
    
         
            -
                      for exclude in excludes
         
     | 
| 
       215 
     | 
    
         
            -
                        error "excludes must be a glob or a list of globs" unless
         
     | 
| 
       216 
     | 
    
         
            -
                        exclude.kind_of?(String)
         
     | 
| 
       217 
     | 
    
         
            -
                        excluded += Dir.glob(exclude)
         
     | 
| 
       218 
     | 
    
         
            -
                      end
         
     | 
| 
       219 
     | 
    
         
            -
                      included = included.select do |file|
         
     | 
| 
       220 
     | 
    
         
            -
                        !excluded.member?(file)
         
     | 
| 
       221 
     | 
    
         
            -
                      end
         
     | 
| 
       222 
     | 
    
         
            -
                    end
         
     | 
| 
       223 
     | 
    
         
            -
                    return included
         
     | 
| 
       224 
     | 
    
         
            -
                  end
         
     | 
| 
       225 
     | 
    
         
            -
                  
         
     | 
| 
       226 
     | 
    
         
            -
                end
         
     | 
| 
       227 
380 
     | 
    
         | 
| 
       228 
381 
     | 
    
         
             
              end
         
     | 
| 
       229 
382 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,71 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
     | 
    
         
            -
            rubygems_version: 0.9.4
         
     | 
| 
       3 
     | 
    
         
            -
            specification_version: 1
         
     | 
| 
       4 
2 
     | 
    
         
             
            name: bee
         
     | 
| 
       5 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       6 
     | 
    
         
            -
              version: 0. 
     | 
| 
       7 
     | 
    
         
            -
            date: 2007-06-25 00:00:00 +02:00
         
     | 
| 
       8 
     | 
    
         
            -
            summary: bee is a build tool
         
     | 
| 
       9 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
       10 
     | 
    
         
            -
            - lib
         
     | 
| 
       11 
     | 
    
         
            -
            email: michel.casabianca@gmail.com
         
     | 
| 
       12 
     | 
    
         
            -
            homepage: http://bee.rubyforge.org
         
     | 
| 
       13 
     | 
    
         
            -
            rubyforge_project: 
         
     | 
| 
       14 
     | 
    
         
            -
            description: 
         
     | 
| 
       15 
     | 
    
         
            -
            autorequire: bee
         
     | 
| 
       16 
     | 
    
         
            -
            default_executable: bee
         
     | 
| 
       17 
     | 
    
         
            -
            bindir: bin
         
     | 
| 
       18 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       19 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
       20 
     | 
    
         
            -
              requirements: 
         
     | 
| 
       21 
     | 
    
         
            -
              - - ">"
         
     | 
| 
       22 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
         
     | 
| 
       23 
     | 
    
         
            -
                  version: 0.0.0
         
     | 
| 
       24 
     | 
    
         
            -
              version: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       25 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       26 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
       27 
     | 
    
         
            -
            cert_chain: 
         
     | 
| 
       28 
     | 
    
         
            -
            post_install_message: Enjoy bee!
         
     | 
| 
       29 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       30 
7 
     | 
    
         
             
            - Michel Casabianca & Contributors
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            - lib/bee.rb
         
     | 
| 
       35 
     | 
    
         
            -
            - lib/bee_console.rb
         
     | 
| 
       36 
     | 
    
         
            -
            - lib/bee_task.rb
         
     | 
| 
       37 
     | 
    
         
            -
            - lib/bee_task_default.rb
         
     | 
| 
       38 
     | 
    
         
            -
            - lib/bee_util.rb
         
     | 
| 
       39 
     | 
    
         
            -
            - test/tc_bee_build.rb
         
     | 
| 
       40 
     | 
    
         
            -
            - test/tc_bee_console.rb
         
     | 
| 
       41 
     | 
    
         
            -
            - test/tc_bee_console_formatter.rb
         
     | 
| 
       42 
     | 
    
         
            -
            - test/tc_bee_context.rb
         
     | 
| 
       43 
     | 
    
         
            -
            - test/tc_bee_task_default.rb
         
     | 
| 
       44 
     | 
    
         
            -
            - test/tc_bee_util.rb
         
     | 
| 
       45 
     | 
    
         
            -
            - test/test_build.rb
         
     | 
| 
       46 
     | 
    
         
            -
            - test/test_build_listener.rb
         
     | 
| 
       47 
     | 
    
         
            -
            - test/tmp_test_case.rb
         
     | 
| 
       48 
     | 
    
         
            -
            - test/ts_bee.rb
         
     | 
| 
       49 
     | 
    
         
            -
            - README
         
     | 
| 
       50 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       51 
     | 
    
         
            -
            test_files: 
         
     | 
| 
       52 
     | 
    
         
            -
            - test/ts_bee.rb
         
     | 
| 
       53 
     | 
    
         
            -
            rdoc_options: []
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            extra_rdoc_files: 
         
     | 
| 
       56 
     | 
    
         
            -
            - README
         
     | 
| 
       57 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       58 
     | 
    
         
            -
            executables: 
         
     | 
| 
       59 
     | 
    
         
            -
            - bee
         
     | 
| 
       60 
     | 
    
         
            -
            extensions: []
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            requirements: []
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
       63 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-12-31 00:00:00 +01:00
         
     | 
| 
      
 13 
     | 
    
         
            +
            default_executable: bee
         
     | 
| 
       64 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       65 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       66 
16 
     | 
    
         
             
              name: archive-tar-minitar
         
     | 
| 
      
 17 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       67 
18 
     | 
    
         
             
              version_requirement: 
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem:: 
     | 
| 
      
 19 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
       69 
20 
     | 
    
         
             
                requirements: 
         
     | 
| 
       70 
21 
     | 
    
         
             
                - - ">="
         
     | 
| 
       71 
22 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
         @@ -73,10 +24,74 @@ dependencies: 
     | 
|
| 
       73 
24 
     | 
    
         
             
                version: 
         
     | 
| 
       74 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       75 
26 
     | 
    
         
             
              name: rubyzip
         
     | 
| 
      
 27 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       76 
28 
     | 
    
         
             
              version_requirement: 
         
     | 
| 
       77 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem:: 
     | 
| 
      
 29 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
       78 
30 
     | 
    
         
             
                requirements: 
         
     | 
| 
       79 
31 
     | 
    
         
             
                - - ">="
         
     | 
| 
       80 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       81 
33 
     | 
    
         
             
                    version: 0.9.1
         
     | 
| 
       82 
34 
     | 
    
         
             
                version: 
         
     | 
| 
      
 35 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 36 
     | 
    
         
            +
            email: michel.casabianca@gmail.com
         
     | 
| 
      
 37 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 38 
     | 
    
         
            +
            - bee
         
     | 
| 
      
 39 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 42 
     | 
    
         
            +
            - README
         
     | 
| 
      
 43 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 44 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 45 
     | 
    
         
            +
            - bin/bee
         
     | 
| 
      
 46 
     | 
    
         
            +
            - bin/bee.bat
         
     | 
| 
      
 47 
     | 
    
         
            +
            - lib/bee.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/bee_console.rb
         
     | 
| 
      
 49 
     | 
    
         
            +
            - lib/bee_task.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - lib/bee_task_default.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/bee_util.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - egg/package
         
     | 
| 
      
 53 
     | 
    
         
            +
            - egg/package/bee_task.erb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - egg/package/build.erb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - egg/package/egg.yml
         
     | 
| 
      
 56 
     | 
    
         
            +
            - egg/package/egg_build.erb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - egg/package/egg_launcher.erb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - egg/package/egg_script.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - egg/package/gem_spec.erb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - egg/package/license
         
     | 
| 
      
 61 
     | 
    
         
            +
            - egg/package/readme.erb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - egg/package/test.erb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - egg/package/test_build.erb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - egg/package/test_build.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - egg/package/test_build_listener.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - egg/package/test_suite.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - egg/package.yml
         
     | 
| 
      
 68 
     | 
    
         
            +
            - README
         
     | 
| 
      
 69 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 70 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 71 
     | 
    
         
            +
            homepage: http://bee.rubyforge.org
         
     | 
| 
      
 72 
     | 
    
         
            +
            post_install_message: Enjoy bee!
         
     | 
| 
      
 73 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 76 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 77 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 78 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 79 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 80 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 81 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 82 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 83 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 84 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 85 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 86 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 87 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 88 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 89 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            rubyforge_project: bee
         
     | 
| 
      
 92 
     | 
    
         
            +
            rubygems_version: 1.3.0
         
     | 
| 
      
 93 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 94 
     | 
    
         
            +
            specification_version: 2
         
     | 
| 
      
 95 
     | 
    
         
            +
            summary: bee is a build tool
         
     | 
| 
      
 96 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     |