Package.setup("1.0") { name "mylib" # "whatever" is installed as executable bin "whatever" # all .rb files under foo/ are installed under foo/ in the specified libdir lib *Dir["foo/**/*.rb"] # same as above lib Dir["foo/**/*.rb"] # installed, with foo renamed as bar lib "foo" => "bar" # install as x.rb under libdir lib "a/b/dsf.rb" => "x.rb" # ditto lib "a/b/dsf.rb" => lambda{|x| "x.rb" } # rename all .doc to .txt doc Dir["doc/**/*"] => lambda{|x| x.sub(/\.doc\z/, ".txt")} # installs as libdir/foo/*.rb translate(:lib, '' => 'foo') lib "a.rb", "b.rb" # installs as libdir/foo/a.rb, libdir/b/b.rb translate(:lib, '' => 'foo') lib "a.rb", "b/b.rb" # installs as docdir/examples/ex{1,2}.rb translate(:doc, '' => 'examples') doc ["ex1", "ex2"] => lambda{|x| "#{x}.rb"} #XXX: maybe translation is rendered useless by renaming? # it's often shorter (no File.join("x", File.dirname(x)) needed) though # renaming is applied before path translation # installs as docdir/examples/*.txt # hence equivalent to # translate(:doc, 'doc/examples' => 'examples') # doc Dir["doc/examples/*.txt"] translate(:doc, '' => 'examples') doc Dir["doc/examples/*.txt"] => lambda{|x| File.basename(x)} # IGNORED files and whatnot doc Dir["doc/**/*"] # ignores boring files doc [".foo"] # ignored doc "foo.orig", "bar.orig" # not ignored # You can add renames to the above without changing the ignore/keep # semantics. # unit tests can be found in test/ unit_test Dir["test/test_*.rb"] }