Permalink
Browse files

Add rdoc-data for updating core and stdlib ri data

  • Loading branch information...
0 parents commit 67ae68a3c28555c3bb9b31fb8057293fc2260d3b @drbrain drbrain committed Mar 4, 2010
Showing with 187 additions and 0 deletions.
  1. +6 −0 History.txt
  2. +6 −0 Manifest.txt
  3. +47 −0 README.txt
  4. +54 −0 Rakefile
  5. +7 −0 bin/rdoc-data
  6. +67 −0 lib/rdoc/data.rb
@@ -0,0 +1,6 @@
+=== 1.0.0 / 2010-03-03
+
+* 1 major enhancement
+
+ * Birthday!
+
@@ -0,0 +1,6 @@
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/rdoc-data
+lib/rdoc/data.rb
@@ -0,0 +1,47 @@
+= rdoc-data
+
+* http://rdoc.rubyforge.org
+
+== DESCRIPTION:
+
+Core ri data for use with RDoc 2.5
+
+== FEATURES:
+
+* Core ri data for use with rdoc >= 2.5
+* Core ri data for rdoc <= 2.4.3 will still work (if you uninstall 2.5+)
+* Does not update ri data for gems (use gem rdoc --all --overwrite --no-rdoc)
+
+== SYNOPSIS:
+
+ $ gem install rdoc-data
+ $ rdoc-data --install
+
+== INSTALL:
+
+* sudo gem install rdoc-data
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2010 Eric Hodel
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
+# -*- ruby -*-
+
+require 'rubygems'
+require 'hoe'
+
+Hoe.spec 'rdoc-data' do
+ developer 'Eric Hodel', 'drbrain@segment7.net'
+
+ extra_deps << ['rdoc', '~> 2.5']
+ extra_dev_deps << ['ZenTest', '~> 4.1']
+end
+
+desc "Generates ri data"
+task :generate => [:install_rdoc, :build_ri_data] do
+end
+
+desc "Installs RDoc in multiruby"
+task :install_rdoc do
+ rdoc_gem_path = if File.exist? '../trunk/bin/ri' then
+ cd '../trunk' do
+ sh 'rake', 'package'
+ end
+
+ '../trunk/pkg/rdoc-*.gem'
+ else
+ 'rdoc'
+ end
+
+ sh 'multigem', 'install', rdoc_gem_path, '--no-rdoc', '--no-ri'
+end
+
+task :build_ri_data => [:data] do
+ data_dir = File.expand_path 'data'
+
+ Dir[File.expand_path('~/.multiruby/build/*')].each do |dir|
+ build_name = File.basename dir
+ install_name = build_name.sub 'ruby-', ''
+ data_name = install_name.sub(/-p\d+/, '')
+
+ rdoc_bin_path =
+ File.expand_path "~/.multiruby/install/#{install_name}/bin/rdoc"
+
+ cd dir do
+ rdoc_dir = "#{data_dir}/#{data_name}"
+ sh rdoc_bin_path, '--all', '--ri', '--op', rdoc_dir, '.'
+ end
+ end
+end
+
+file :data do
+ mkdir 'data'
+end
+
+# vim: syntax=Ruby
@@ -0,0 +1,7 @@
+#!/usr/local/bin/ruby -w
+
+require 'rubygems'
+require 'rdoc/data'
+
+RDoc::Data.run
+
@@ -0,0 +1,67 @@
+require 'rdoc'
+require 'rdoc/ri/paths'
+require 'fileutils'
+require 'find'
+
+class RDoc::Data
+
+ VERSION = '2.5'
+
+ def self.process_args args
+ options = {}
+
+ if args.empty? or args.include? '--help' or
+ not args.include? '--install' then
+ puts "Usage: #{$0} [--verbose] [--dryrun] --install"
+ puts
+ puts "Installs updated ruby #{RUBY_VERSION} system ri data (core + stdlib)"
+ exit 1
+ elsif args.include? '--verbose' then
+ options[:verbose] = true
+ elsif args.include? '--dryrun' then
+ options[:dryrun] = true
+ end
+
+ options
+ end
+
+ def self.run argv = ARGV
+ options = process_args argv
+
+ data = new options
+
+ if options[:dryrun] then
+ data.extend FileUtils::DryRun
+ elsif options[:verbose] then
+ data.extend FileUtils::Verbose
+ else
+ data.extend FileUtils
+ end
+
+ data.run
+ end
+
+ def initialize options
+ data_dir = Gem.datadir('rdoc-data') ||
+ File.expand_path('../../../data', __FILE__)
+ @source = File.join data_dir, RUBY_VERSION
+
+ @destination = RDoc::RI::Paths::SYSDIR
+ end
+
+ def run
+ cd @source do
+ files = Dir[File.join('**', '*.ri{d,}')]
+
+ files.each do |file|
+ dest_file = File.join @destination, file
+ dest_dir = File.dirname dest_file
+
+ mkdir_p dest_dir
+ install file, dest_dir, :mode => 0644
+ end
+ end
+ end
+
+end
+

0 comments on commit 67ae68a

Please sign in to comment.