Permalink
Browse files

Generate documentation to target version of Ruby

Version used for RDoc was hardcoded to interpreters definition, not
taking in consideration building Ruby 2.0 using 'ruby19' recipe.

Switch rdoc generation to use runtime Ruby information to determine
namespace and target directory.
  • Loading branch information...
1 parent 8857d92 commit 8562137cdc2fc0aa65d1f6b2a31f795251f30dcc @luislavena luislavena committed Feb 24, 2013
Showing with 68 additions and 42 deletions.
  1. +3 −0 History.txt
  2. +2 −0 config/ruby_installer.rb
  3. +55 −0 rake/ruby_tools.rb
  4. +1 −0 rakefile.rb
  5. +0 −41 recipes/packager/inno.rake
  6. +7 −1 recipes/tools/docs.rake
View
@@ -3,6 +3,9 @@
* Enhancements:
* Upgraded Ruby 2.0.0 to patchlevel 0
+* Bugfixes:
+ * Generate documentation for target version of Ruby
+
=== 2013-02-22
* Enhancements:
@@ -91,6 +91,8 @@ module RubyInstaller
Ruby19.files = ["ruby-2.0.0-p0.tar.bz2"]
Ruby19.installer_guid = "{ABAA9781-845A-43CC-BABA-76CB580FE35D}"
Ruby19.installer_guid_x64 = "{B5BD4615-7C8A-4E50-9179-71B593CA6B67}"
+ Ruby19.short_version = "ruby20"
+ Ruby19.doc_target = "sandbox/doc/ruby20"
end
# COMPAT mode for Ruby 1.9.2
View
@@ -0,0 +1,55 @@
+module RubyTools
+ # use provided ruby.exe to figure out runtime information
+ def self.parse_ruby(ruby_exe)
+ result = `#{ruby_exe} -rrbconfig -ve \"puts 'ruby_version: %s' % RbConfig::CONFIG['ruby_version']\"`
+ return nil unless $?.success?
+ return nil if result.empty?
+
+ h = {}
+
+ if result =~ /(\d\.\d.\d)/
+ h[:version] = $1
+ end
+
+ if result =~ /patchlevel (\d+)/
+ h[:patchlevel] = $1
+ end
+
+ if result =~ /\dp(\d+)/
+ h[:patchlevel] = $1
+ end
+
+ if result =~ /ruby_version: (\S+)/
+ h[:lib_version] = $1
+ end
+
+ if result =~ /\[(\S+)\]/
+ h[:platform] = $1
+ end
+
+ if result =~ /trunk (\d+)/
+ h[:revision] = $1
+ end
+
+ if result =~ /(\d+-\d+-\d+)/
+ h[:release_date] = $1
+ end
+
+ # construct either X.Y.Z-p123 or X.Y.Z-rNNNN (dev)
+ version_human = h[:version].dup
+ if h[:patchlevel]
+ version_human << "-p%s" % h[:patchlevel]
+ else
+ version_human << "-r%s" % h[:revision]
+ end
+
+ h[:version_human] = version_human
+
+ major_minor = h[:version][0..2]
+ namespace_version = major_minor.sub('.', '')
+
+ h[:namespace_version] = namespace_version
+
+ h
+ end
+end
View
@@ -29,6 +29,7 @@
require 'rake/extracttask'
require 'rake/checkpoint'
require 'rake/env'
+require 'rake/ruby_tools'
# scan all override definitions and load them
Dir.glob('override/*.rb').sort.each do |f|
@@ -11,47 +11,6 @@ module PkgTools
end
end
-module RubyTools
- # use provided ruby.exe to figure out runtime information
- def self.parse_ruby(ruby_exe)
- result = `#{ruby_exe} -rrbconfig -ve \"puts 'ruby_version: %s' % RbConfig::CONFIG['ruby_version']\"`
- return nil unless $?.success?
- return nil if result.empty?
-
- h = {}
-
- if result =~ /(\d\.\d.\d)/
- h[:version] = $1
- end
-
- if result =~ /patchlevel (\d+)/
- h[:patchlevel] = $1
- end
-
- if result =~ /\dp(\d+)/
- h[:patchlevel] = $1
- end
-
- if result =~ /ruby_version: (\S+)/
- h[:lib_version] = $1
- end
-
- if result =~ /\[(\S+)\]/
- h[:platform] = $1
- end
-
- if result =~ /trunk (\d+)/
- h[:revision] = $1
- end
-
- if result =~ /(\d+-\d+-\d+)/
- h[:release_date] = $1
- end
-
- h
- end
-end
-
# TODO: port this to it's own innosetup recipe
module InnoSetup
extend Rake::DSL if defined?(Rake::DSL)
@@ -35,6 +35,12 @@ EOT
end
interpreters.each do |package|
+ ruby_exe = File.join(package.install_target, "bin", "ruby.exe")
+ next unless File.exist?(ruby_exe)
+
+ info = RubyTools.parse_ruby(ruby_exe)
+ next if info.empty?
+
default_opts = ['--format=chm', '--encoding=UTF-8']
meta_chm = package.meta_chm
expanded_doc_target = File.join(RubyInstaller::ROOT, package.doc_target)
@@ -111,7 +117,7 @@ interpreters.each do |package|
end
end
- namespace package.short_version do
+ namespace "ruby#{info[:namespace_version]}" do
task "docs:check_source" do
unless File.exist? package.target
fail "Source directory doesn't exist. Perhaps you built using LOCAL or CHECKOUT?"

0 comments on commit 8562137

Please sign in to comment.