Module: Zayin::Rake
- Defined in:
- lib/zayin/rake/php.rb,
lib/zayin/rake/docco.rb,
lib/zayin/rake/haskell.rb,
lib/zayin/rake/vagrant.rb,
lib/zayin/rake/vagrant/php.rb
Defined Under Namespace
Modules: Vagrant Classes: HaskellTasks, PhpTasks, VagrantTasks
Class Method Summary collapse
-
.docco(name, src_files, *args) ⇒ Object
Defines a Rake task for generating documentation with Docco, which must be on the $PATH.
Class Method Details
.docco(name, src_files, *args) ⇒ Object
Defines a Rake task for generating documentation with Docco, which must be on the $PATH.
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 43 |
# File 'lib/zayin/rake/docco.rb', line 9 def self.docco(name, src_files, *args) args || args = [] args.insert 0, name body = proc { src_files.each do |src| puts "docco #{src}" system %{docco #{src}} basename = File.basename(src, File.extname(src)) + '.html' tmp = File.join('docs', basename) parts = Pathname.new(src).each_filename.to_a parts.shift parts.insert 0, 'docs' parts[-1] = basename dest = File.join(*parts) if tmp == dest # If the tmp and dest are the same, then change dest's filename to # index.html and only copy it. dest = File.join(File.dirname(tmp), 'index.html') FileUtils.cp(tmp, dest, :verbose => true) else dirname = File.dirname(dest) FileUtils.mkdir_p(dirname) FileUtils.mv(tmp, dest, :verbose => true) FileUtils.cp('docs/docco.css', File.join(dirname, 'docco.css'), :verbose => true) end end } Rake::Task.define_task(*args, &body) end |