summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/ruboids/generateManifest.rb
blob: f877b0b3e07becd3f472fc1d0cf3dec56c4af262 (plain)
1
2
3
4
5
6
7
8
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
35
36
37
38
39
40
41
42
#! /usr/bin/env ruby
#
# Copyright (c) 2001 by Jim Menard <jimm@io.com>
#
# Released under the same license as Ruby. See
# http://www.ruby-lang.org/en/LICENSE.txt.
#
# This script builds the Manifest file. It can be run stand-alone, but
# is normally used from within release.rb.
#

def recurseDirectory(io, dirName, indentLevel)
    Dir.entries(dirName).sort.each { | f |
	next if f =~ /^\.\.?/
	fileName = "#{dirName}/#{f}"
	fileName.sub!(/^\.\//, '')
	if File.directory?(fileName)
	    io.puts "\t" * indentLevel + fileName + '/'
	    recurseDirectory(io, fileName, indentLevel + 1)
	else
	    io.puts "\t" * indentLevel + f
	end
    }
end

def generateManifest
    io = nil
    begin
	io = File.open('Manifest', 'w')
	recurseDirectory(io, '.', 0)
    ensure
	io.close() if io
    end
end

if $0 == __FILE__
    generateManifest()
end