Sha256: 6bfc6a0de031556ac316172fb884fccf2fa65cbdce9aa490cefef092d745a945

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby
# WANT_JSON

# Load QB's Ansible module autorun harness
load ENV['QB_AM_AUTORUN_PATH']


class YardGetOutputDir < QB::Ansible::Module

  arg :bundle_root, type: t.abs_path
  
  def facts_for rel_dir
    {
      yard_output_dir: rel_dir,
      yard_output_abs_dir: File.expand_path( rel_dir, @bundle_root ),
    }
  end
  
  def default_facts
    facts_for( 'doc' ).merge yard_output_dir_is_default: true
  end
  
  # entry point for the module. invoked by {\#run}.
  # 
  # @return [nil | {Symbol => #to_json}]
  #   when returning:
  #   
  #   -   `nil`: module will successfully exit with no additional changes.
  #       
  #   -   `{Symbol => #to_json}`: Hash will be merged over @facts that
  #       are returned by the module to be set in the Ansible runtime and
  #       the module will exit successfully.
  #       
  def main
    path = File.join bundle_root, '.yardopts'
    
    if File.exists?  path
      contents = File.read path
      match = /^\-\-output-dir[\s\=](.*)$/.match contents
      
      if match
        return facts_for( match[1] )
      end
    end
    
    default_facts
  end # #main
  
end # YardGetOutputDir

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qb-0.4.5 roles/qb/ruby/yard/config/library/yard.get_output_dir
qb-0.4.4 roles/qb/ruby/yard/config/library/yard.get_output_dir
qb-0.4.3 roles/qb/ruby/yard/config/library/yard.get_output_dir
qb-0.4.2 roles/qb/ruby/yard/config/library/yard.get_output_dir
qb-0.4.1 roles/qb/ruby/yard/config/library/yard.get_output_dir
qb-0.4.0 roles/qb/ruby/yard/config/library/yard.get_output_dir