Rakefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. $:.unshift File.expand_path 'lib'
  2. require 'rdoc'
  3. require 'hoe'
  4. ENV['BENCHMARK'] = 'yes'
  5. task :docs => :generate
  6. task :test => :generate
  7. PARSER_FILES = %w[
  8. lib/rdoc/rd/block_parser.rb
  9. lib/rdoc/rd/inline_parser.rb
  10. ]
  11. Hoe.plugin :git
  12. Hoe.plugin :minitest
  13. Hoe.plugin :rdoc_tags
  14. $rdoc_rakefile = true
  15. hoe = Hoe.spec 'rdoc' do
  16. developer 'Eric Hodel', 'drbrain@segment7.net'
  17. developer 'Dave Thomas', ''
  18. developer 'Phil Hagelberg', 'technomancy@gmail.com'
  19. developer 'Tony Strauss', 'tony.strauss@designingpatterns.com'
  20. self.rsync_args = '-avz'
  21. rdoc_locations << 'docs.seattlerb.org:/data/www/docs.seattlerb.org/rdoc/'
  22. rdoc_locations << 'drbrain@rubyforge.org:/var/www/gforge-projects/rdoc/'
  23. spec_extras[:post_install_message] = <<-MESSAGE
  24. Depending on your version of ruby, you may need to install ruby rdoc/ri data:
  25. <= 1.8.6 : unsupported
  26. = 1.8.7 : gem install rdoc-data; rdoc-data --install
  27. = 1.9.1 : gem install rdoc-data; rdoc-data --install
  28. >= 1.9.2 : nothing to do! Yay!
  29. MESSAGE
  30. self.readme_file = 'README.rdoc'
  31. self.history_file = 'History.rdoc'
  32. self.testlib = :minitest
  33. self.extra_rdoc_files += %w[
  34. DEVELOPERS.rdoc
  35. History.rdoc
  36. LICENSE.rdoc
  37. LEGAL.rdoc
  38. README.rdoc
  39. RI.rdoc
  40. TODO.rdoc
  41. ]
  42. self.clean_globs += PARSER_FILES
  43. require_ruby_version '>= 1.8.7'
  44. extra_deps << ['json', '~> 1.4']
  45. extra_dev_deps << ['racc', '~> 1.4']
  46. extra_dev_deps << ['minitest', '~> 2']
  47. extra_dev_deps << ['ZenTest', '~> 4']
  48. extra_rdoc_files << 'Rakefile'
  49. spec_extras['required_rubygems_version'] = '>= 1.3'
  50. spec_extras['homepage'] = 'http://docs.seattlerb.org/rdoc'
  51. end
  52. task :generate => PARSER_FILES
  53. rule '.rb' => '.ry' do |t|
  54. racc = Gem.bin_path 'racc', 'racc'
  55. ruby "-rubygems #{racc} -l -o #{t.name} #{t.source}"
  56. end
  57. path = "pkg/#{hoe.spec.full_name}"
  58. package_parser_files = PARSER_FILES.map do |parser_file|
  59. package_parser_file = "#{path}/#{parser_file}"
  60. file package_parser_file => parser_file # ensure copy runs before racc
  61. package_parser_file
  62. end
  63. task "#{path}.gem" => package_parser_files
  64. # These tasks expect to have the following directory structure:
  65. #
  66. # git/git.rubini.us/code # Rubinius git HEAD checkout
  67. # svn/ruby/trunk # ruby subversion HEAD checkout
  68. # svn/rdoc/trunk # RDoc subversion HEAD checkout
  69. #
  70. # If you don't have this directory structure, set RUBY_PATH and/or
  71. # RUBINIUS_PATH.
  72. diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
  73. rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig'"
  74. rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
  75. ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
  76. desc "Updates Ruby HEAD with the currently checked-out copy of RDoc."
  77. task :update_ruby do
  78. sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc"
  79. sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri"
  80. sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib"
  81. sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc"
  82. end
  83. desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc."
  84. task :diff_ruby do
  85. options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
  86. sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true"
  87. sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true"
  88. sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true"
  89. sh "diff #{diff_options} lib/rdoc #{ruby_dir}/lib/rdoc; true"
  90. sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true"
  91. end
  92. desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc."
  93. task :update_rubinius do
  94. sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb"
  95. sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb"
  96. sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib"
  97. sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc"
  98. end
  99. desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc."
  100. task :diff_rubinius do
  101. sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true"
  102. sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true"
  103. sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true"
  104. sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true"
  105. sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
  106. end