Module: Hoe::Yard

Defined in:
lib/hoe/yard.rb

Overview

YARD plugin for hoe.

Tasks Provided:

yard

Generate YARD documentation

docs

Generate YARD documentation

Constant Summary collapse

PLUGIN_VERSION =

hoe-yard version

'0.1.2'
YARD_MARKUP =

Supported markups

[:markdown, :texttile, :rdoc]
YARD_RAW_EXTS =

File extensions indicating raw content

['.txt', '.html']
YARD_EXTS =

File extensions for various markups

{
  :markdown => ['.markdown', '.md'],
  :texttile => ['.texttile', '.tt'],
  :rdoc => ['.rdoc']
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#yard_markupObject

Markup style used in documentation, like textile, markdown or rdoc. (default: :rdoc)



35
36
37
# File 'lib/hoe/yard.rb', line 35

def yard_markup
  @yard_markup
end

#yard_markup_providerObject

Overrides the library used to process markup formatting (specify the gem name)



39
40
41
# File 'lib/hoe/yard.rb', line 39

def yard_markup_provider
  @yard_markup_provider
end

#yard_optionsObject

Options to pass to YARD



42
43
44
# File 'lib/hoe/yard.rb', line 42

def yard_options
  @yard_options
end

#yard_titleObject

Title for the YARD documentation



31
32
33
# File 'lib/hoe/yard.rb', line 31

def yard_title
  @yard_title
end

Instance Method Details

#define_yard_tasksObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/hoe/yard.rb', line 71

def define_yard_tasks
  require 'yard'

  # generate the YARD options
  opts = normalize_yard_opts

  desc "Remove YARD products"
  task :clobber_docs do
    if File.exists?(local_yard_dir)
      rm_r local_yard_dir, :verbose => true
    end
  end

  # define the yard task
  ::YARD::Rake::YardocTask.new do |t|
    t.files = self.spec.files.select { |path| path =~ /^lib\/.+\.rb$/ }
    t.options = opts + ['--files'] + self.yard_files
  end
  task :docs => :yard

  # override the RDoc options
  self.spec.rdoc_options = opts
end

#initialize_yardObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/hoe/yard.rb', line 44

def initialize_yard
  self.yard_title = Hoe.normalize_names(self.name).last + ' Documentation'
  self.yard_markup = nil
  self.yard_markup_provider = nil
  self.yard_options = []

  # find the README.* and History.* files
  self.readme_file = intuit_file_name(File.basename(self.readme_file))
  self.history_file = intuit_file_name(File.basename(self.history_file))

  # disable RDoc and ri tasks
  self.need_rdoc = false

  unless self.name == 'hoe-yard'
    # add hoe-yard as a development dependency
    self.extra_dev_deps << ['hoe-yard', ">=#{PLUGIN_VERSION}"]
  end

  # we have YARD docs
  self.spec_extras.merge!(:has_rdoc => 'yard')

  if self.history_file
    # include the history file
    self.yard_files << self.history_file
  end
end