lib/tasks/source_annotation_extractor.rb
def find_in(dir)
    results = {}

    Dir.glob("#{dir}/*") do |item|
      next if File.basename(item)[0] == ?.

      if File.directory?(item)
        results.update(find_in(item))
      elsif item =~ /\.(rb|yml)$/
        results.update(extract_annotations_from(item, /#\s*(#{tag}):?\s*(.*)$/))
      elsif item =~ /\.js$/
        results.update(extract_annotations_from(item, /\/\/\s*(#{tag}):?\s*(.*)$/))
      end
    end

    results
  end
# Returns a hash that maps filenames under +dir+ (recursively) to arrays
# with their annotations. Only files with annotations are included, and only
# those with extension +.rb+, +.js+, +.yml+ are taken into account.
Returns a hash that maps filenames under +dir+ (recursively) to arrays
with their annotations.
Returns a hash that maps filenames under + dir + ( recursively ) to arrays with their annotations .
def find_in(dir)
    results = {}
    Dir.glob("#{dir}/*") do |item|
      next if File.basename(item)[0] == ?.
      if File.directory?(item)
        results.update(find_in(item))
      elsif item =~ /\.(rb|yml)$/
        results.update(extract_annotations_from(item, /#\s*(#{tag}):?\s*(.*)$/))
      elsif item =~ /\.js$/
        results.update(extract_annotations_from(item, /\/\/\s*(#{tag}):?\s*(.*)$/))
      end
    end
    results
  end
def find_in ( dir ) results = { } Dir . glob ( "#{dir}/*" ) do | item | next if File . basename ( item ) [ 0 ] == ?. if File . directory? ( item ) results . update ( find_in ( item ) ) elsif item =~ / \. (rb|yml)$ / results . update ( extract_annotations_from ( item , / # \s *( #{ tag } ):? \s *(.*)$ / ) ) elsif item =~ / \. js$ / results . update ( extract_annotations_from ( item , / \/ \/ \s *( #{ tag } ):? \s *(.*)$ / ) ) end end results end
Returns a hash that maps filenames under +dir+ (recursively) to arrays
with their annotations.
Returns a hash that maps filenames under + dir + ( recursively ) to arrays with their annotations .
dir