Class: Toe::Manifest

Inherits:
GemTask
  • Object
show all
Defined in:
lib/toe/manifest.rb

Overview

::task prints files for a manifest

Instance Method Summary collapse

Methods inherited from GemTask

#default_path, #gemspec

Instance Method Details

#process(path = default_path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/toe/manifest.rb', line 9

def process(path=default_path)
  
  # collect files from the gemspec, labeling 
  # with true or false corresponding to the
  # file existing or not
  files = gemspec(path).files.inject({}) do |files, file|
    files[File.expand_path(file)] = [File.exists?(file), file]
    files
  end

  # gather non-rdoc/pkg files for the project
  # and add to the files list if they are not
  # included already (marking by the absence
  # of a label)
  Dir.glob("**/*").each do |file|
    next if File.directory?(file) || omit.any? {|pattern| file =~ pattern }

    path = File.expand_path(file)
    files[path] = ["", file] unless files.has_key?(path)
  end

  # sort and output the results
  files.values.sort_by {|exists, file| file }.each do |entry| 
    puts "%-5s %s" % entry
  end
end