Class: YARD::APIPlugin::YardocTask
- Inherits:
-
Rake::YardocTask
- Object
- Rake::YardocTask
- YARD::APIPlugin::YardocTask
- Defined in:
- lib/yard-api/yardoc_task.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #configure(runtime_config) ⇒ Object
-
#initialize(name = :yard_api) ⇒ YardocTask
constructor
A new instance of YardocTask.
- #run ⇒ Object
Constructor Details
#initialize(name = :yard_api) ⇒ YardocTask
Returns a new instance of YardocTask.
7 8 9 10 11 12 |
# File 'lib/yard-api/yardoc_task.rb', line 7 def initialize(name=:yard_api) super(name) do |t| yield t if block_given? t.run end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/yard-api/yardoc_task.rb', line 5 def config @config end |
Instance Method Details
#configure(runtime_config) ⇒ Object
69 70 71 |
# File 'lib/yard-api/yardoc_task.rb', line 69 def configure(runtime_config) @runtime_config = runtime_config end |
#run ⇒ Object
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yard-api/yardoc_task.rb', line 14 def run YARD::APIPlugin..reset_defaults @config = = YARD::APIPlugin..update(load_config) puts "Config: #{api_options.to_json}" self.verifier = YARD::APIPlugin::Verifier.new(config['verbose']) self.before = proc { FileUtils.rm_rf(config['output']) } self.files = config['files'] config['debug'] ||= ENV['DEBUG'] config['verbose'] ||= ENV['VERBOSE'] config['output'].sub!('$format', .format) set_option('template', 'api') set_option('no-yardopts') set_option('no-document') set_option('markup', config['markup']) if config['markup'] set_option('markup-provider', config['markup_provider']) if config['markup_provider'] if config['markup_provider'] == 'redcarpet' require 'yard-api/markup/redcarpet' end set_option('title', config['title']) set_option('output-dir', config['output']) set_option('one-file') if config['one_file'] set_option('readme', config['readme']) if File.exists?(config['readme']) set_option('verbose') if config['verbose'] set_option('debug') if config['debug'] set_option('no-save') if config['no_save'] set_option('format', .format) get_assets(config).each_pair do |asset_id, rpath| asset_path = rpath if File.directory?(asset_path) set_option 'asset', [ asset_path, asset_id ].join(':') elsif config['strict'] raise " Expected assets of type \"\#{asset_id}\" to be found within\n \"\#{asset_path}\", but they are not.\n Error\n end\n end\n\n if config['debug']\n puts \"Invoking YARD with options: \#{self.options.to_json}\"\n end\nend\n" |