Sha256: e243aa2111e349d1c6e23dbcb691d20470eb6cca2ec2b38eb4898759e239bda6

Contents?: true

Size: 811 Bytes

Versions: 11

Compression:

Stored size: 811 Bytes

Contents

module CMSScanner
  # Controllers Container
  class Controllers < Array
    attr_reader :option_parser

    def initialize(option_parser = OptParseValidator::OptParser.new(nil, 40))
      @option_parser = option_parser
    end

    # @param [ Controller::Base ] controller
    #
    # @retun [ Controllers ] self
    def <<(controller)
      options = controller.cli_options

      unless include?(controller)
        option_parser.add(*options) if options
        super(controller)
      end
      self
    end

    def run
      parsed_options             = option_parser.results
      first.class.parsed_options = parsed_options

      redirect_output_to_file(parsed_options[:output]) if parsed_options[:output]

      each(&:before_scan)
      each(&:run)
      reverse.each(&:after_scan)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cms_scanner-0.0.23 lib/cms_scanner/controllers.rb
cms_scanner-0.0.22 lib/cms_scanner/controllers.rb
cms_scanner-0.0.21 lib/cms_scanner/controllers.rb
cms_scanner-0.0.20 lib/cms_scanner/controllers.rb
cms_scanner-0.0.19 lib/cms_scanner/controllers.rb
cms_scanner-0.0.18 lib/cms_scanner/controllers.rb
cms_scanner-0.0.17 lib/cms_scanner/controllers.rb
cms_scanner-0.0.16 lib/cms_scanner/controllers.rb
cms_scanner-0.0.15 lib/cms_scanner/controllers.rb
cms_scanner-0.0.14 lib/cms_scanner/controllers.rb
cms_scanner-0.0.13 lib/cms_scanner/controllers.rb