Sha256: e76b3f3dfff6292994da3bb51542e8fe097105916a8c95412265523c16277d36

Contents?: true

Size: 1.42 KB

Versions: 32

Compression:

Stored size: 1.42 KB

Contents

module Inch
  module CLI
    module YardoptsHelper
      # @return [Array<String>] list of Ruby source files to process
      attr_accessor :yard_files

      # @return [Array<String>] list of excluded paths (regexp matches)
      attr_accessor :excluded

      VALID_YARD_SWITCHES = %w(--private --no-private --protected --no-public
          --plugin --load --safe --yardopts --no-yardopts --document --no-document)

      # Parses the option and gracefully handles invalid switches
      #
      # @param [OptionParser] opts the option parser object
      # @param [Array<String>] args the arguments passed from input. This
      #   array will be modified.
      # @return [void]
      def parse_yardopts_options(opts, args)
        wrapper = YardoptsWrapper.new()

        dupped_args = args.dup
        dupped_args.delete("--help")
        dupped_args.delete_if do |arg|
          arg =~ /^\-/ && !VALID_YARD_SWITCHES.include?(arg)
        end

        ui.debug "Sending args to YARD:\n" \
              "  args: #{dupped_args}"

        wrapper.parse_arguments(*dupped_args)

        self.yard_files = wrapper.files
        self.excluded = wrapper.excluded
      end

      def yardopts_options(opts)
        wrapper = YardoptsWrapper.new()
        wrapper.add_yardoc_options(opts)
      end

      class YardoptsWrapper < YARD::CLI::Yardoc
        def add_yardoc_options(opts)
          yardopts_options(opts)
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
inch-0.5.0.rc3 lib/inch/cli/yardopts_helper.rb
inch-0.5.0.rc2 lib/inch/cli/yardopts_helper.rb
inch-0.5.0.rc1 lib/inch/cli/yardopts_helper.rb
inch-0.4.6 lib/inch/cli/yardopts_helper.rb
inch-0.4.5 lib/inch/cli/yardopts_helper.rb
inch-0.4.4 lib/inch/cli/yardopts_helper.rb
inch-0.4.4.rc4 lib/inch/cli/yardopts_helper.rb
inch-0.4.4.rc3 lib/inch/cli/yardopts_helper.rb
inch-0.4.4.rc2 lib/inch/cli/yardopts_helper.rb
inch-0.4.4.rc1 lib/inch/cli/yardopts_helper.rb
inch-0.4.3 lib/inch/cli/yardopts_helper.rb
inch-0.4.3.rc2 lib/inch/cli/yardopts_helper.rb
inch-0.4.3.rc1 lib/inch/cli/yardopts_helper.rb
inch-0.4.2 lib/inch/cli/yardopts_helper.rb
inch-0.4.1 lib/inch/cli/yardopts_helper.rb
inch-0.4.0 lib/inch/cli/yardopts_helper.rb
inch-0.4.0.rc3 lib/inch/cli/yardopts_helper.rb
inch-0.4.0.rc2 lib/inch/cli/yardopts_helper.rb
inch-0.4.0.rc1 lib/inch/cli/yardopts_helper.rb
inch-0.3.4.rc1 lib/inch/cli/yardopts_helper.rb