Skip to content

Instantly share code, notes, and snippets.

@rmm5t
Created July 28, 2009 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmm5t/157707 to your computer and use it in GitHub Desktop.
Save rmm5t/157707 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
Package = Struct.new(:name, :path, :main, :globs)
packages =
[
Package.new("ruby", "~/external/ruby-1.8.7-p72", "README", %w(*.c lib/**/*.rb)),
Package.new("rails", "~/external/rails", "railties/README", %w(*/README */lib/**/*)),
Package.new("shoulda", "~/external/shoulda", "README.rdoc", %w(lib/**/*.rb))
]
class Package
def files
files = Dir[main]
globs.each do |glob|
files.concat(Dir[glob])
end
files
end
end
def run(cmd)
puts cmd
system cmd
end
packages.each do |package|
Dir.chdir(File.expand_path(package.path)) do
run "rm -rf sdoc"
run "sdoc -o sdoc -m #{package.main} #{package.files.join(" ")}"
end
end
destination = File.expand_path("~/Sites/sdoc-merged")
names = packages.map(&:name).join(",")
directories = packages.map { |p| File.expand_path(File.join(p.path, "sdoc")) }
run "rm -rf #{destination}"
run "sdoc-merge -t #{names.inspect} -n #{names.inspect} -o #{destination} #{directories.join(" ")}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment