require 'rake' require 'rake/rdoctask' require 'spec/rake/spectask' require 'rdoc/rdoc' require 'rdoc/generators/html_generator' require 'rdoc/generators/template/html/html' module Generators class HtmlFile < ContextUser alias_method :core_attribute_values, :file_attribute_values def file_attribute_values core_attribute_values @values["analytics"] = @options.analytics if @options.analytics end end class HtmlClass < ContextUser alias_method :core_attribute_values, :class_attribute_values def class_attribute_values core_attribute_values @values["analytics"] = @options.analytics if @options.analytics end end end class Options attr_accessor :analytics module OptionList OPTION_LIST << [ "--analytics", "-y", "code", "Google Analytics Code" ] end alias_method :core_parse, :parse def parse(argv, generators) core_parse(argv, generators) old_args = ARGV.dup ARGV.replace(argv) go = GetoptLong.new(*OptionList.options) go.quiet = true go.each do |opt, arg| case opt when "--analytics" @analytics = arg.strip end end ARGV.replace(old_args) end end module RDoc module Page remove_const :FOOTER const_set :FOOTER, %{