Sha256: ff2b3009865c7d73f7879cec149d133aca2560a3f23478bd93a3b88f36df2229

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'rubygems/doc_manager'

module Shoe
  module Tasks

    class Rdoc < Abstract
      def define
        desc 'Generate documentation'
        task :rdoc do
          LocalDocManager.new(spec).generate_rdoc

          case RUBY_PLATFORM
          when /darwin/
            sh 'open rdoc/index.html'
          when /mswin|mingw/
            sh 'start rdoc\index.html'
          else
            sh 'firefox rdoc/index.html'
          end
        end
      end

      private

      # Using Gem::DocManager instead of Rake::RDocTask means you get to see your
      # rdoc *exactly* as users who install your gem will.
      class LocalDocManager < Gem::DocManager #:nodoc:
        def initialize(spec)
          @spec      = spec
          @doc_dir   = Dir.pwd
          @rdoc_args = []
          adjust_spec_so_that_we_can_generate_rdoc_locally
        end

        def adjust_spec_so_that_we_can_generate_rdoc_locally
          def @spec.full_gem_path
            Dir.pwd
          end
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoe-0.4.0 lib/shoe/tasks/rdoc.rb