Sha256: f8440ab8c1a6a39559b4bedc6462408b8e331de792e47140fc5d34427e7e2997

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

module PolishGeeks
  module DevTools
    module Command
      # Command wrapper for Yard statistics
      # @note It validates if everything is well documented
      class Yard < Base
        self.type = :validator

        # Regexp used to match Yard output to check if there are things that
        # are not documented or that include warnings
        MATCH_REGEXP = /(Undocumented Objects|warn)/i

        # Executes this command
        # @return [String] command output
        def execute
          @output = Shell.new.execute("bundle exec yard stats #{options}")
        end

        # @return [Boolean] true if everything is documented and without warnings
        def valid?
          output[MATCH_REGEXP].nil?
        end

        private

        # Settings for yard - they are directly taken from yardopts file in config dir
        # @return [String] yard options that should be used to generate documentation
        def options
          config = File.join(DevTools.gem_root, 'config', 'yardopts')
          File.readlines(config).join(' ').delete("\n") + ' --list-undoc'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
polishgeeks-dev-tools-1.2.0 lib/polishgeeks/dev-tools/command/yard.rb
polishgeeks-dev-tools-1.1.3 lib/polishgeeks/dev-tools/command/yard.rb
polishgeeks-dev-tools-1.1.2 lib/polishgeeks/dev-tools/command/yard.rb
polishgeeks-dev-tools-1.1.1 lib/polishgeeks/dev-tools/command/yard.rb
polishgeeks-dev-tools-1.1.0 lib/polishgeeks/dev-tools/command/yard.rb
polishgeeks-dev-tools-1.0.0 lib/polishgeeks/dev-tools/command/yard.rb