Module: Bones::Plugins::Yard
Instance Method Summary collapse
Instance Method Details
#define_tasks ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/bones/plugins/yard.rb', line 48 def define_tasks return unless have?(:yard) config = ::Bones.config namespace :doc do desc 'Generate Yard documentation' YARD::Rake::YardocTask.new(:yard) do |yd| yard = config.yard incl = Regexp.new(yard.include.join('|')) excl = Regexp.new(yard.exclude.join('|')) yd.files = config.gem.files.find_all do |fn| case fn when excl; false when incl; true else false end end yd. << '--main' << yard.main yd. << '--output-dir' << yard.dir yd. << '--title' << "#{config.name}-#{config.version} Documentation" yd..concat(yard.opts) end task :clobber_yard do rm_r config.yard.dir rescue nil end end # namespace :doc desc 'Alias to doc:yard' task :doc => 'doc:yard' task :clobber => %w(doc:clobber_yard) end |
#initialize_yard ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bones/plugins/yard.rb', line 6 def initialize_yard require 'yard' require 'yard/rake/yardoc_task' have?(:yard) { true } ::Bones.config { desc 'Configuration settings for yard' yard { opts [], :desc => 'Array of yard options to use when generating documentation.' include %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$), :desc => <<-__ An array of patterns that will be used to find the files for which documentation should be generated. This is an array of strings that will be converted in regular expressions. __ exclude %w(extconf\.rb$), :desc => <<-__ An array of patterns that will be used to exclude files from yard processing. This is an array of strings that will be converted in regular expressions. __ main nil, :desc => <<-__ The main yard file for the project. This defaults to the project's README file. __ dir 'doc', :desc => 'Output directory for generated documentation.' } } rescue LoadError have?(:yard) { false } end |
#post_load ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/bones/plugins/yard.rb', line 40 def post_load return unless have? :yard config = ::Bones.config config.exclude << "^#{Regexp.escape(config.yard.dir)}/" config.yard.main ||= config.readme_file end |