Sha256: e4c271a055b0087926d941e0c873e6edb73357ac9248cbde93b1bea2cfe8dbcd
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
module CMSScanner # Controllers Container class Controllers < Array attr_reader :option_parser # @param [ OptParsevalidator::OptParser ] options_parser def initialize(option_parser = OptParseValidator::OptParser.new(nil, 40)) @option_parser = option_parser register_options_files end # Adds the potential option file paths to the option_parser def register_options_files [Dir.home, Dir.pwd].each do |dir| option_parser.options_files.supported_extensions.each do |ext| @option_parser.options_files << File.join(dir, ".#{NS.app_name}", "cli_options.#{ext}") end end 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cms_scanner-0.0.35.1 | lib/cms_scanner/controllers.rb |
cms_scanner-0.0.35 | lib/cms_scanner/controllers.rb |
cms_scanner-0.0.34 | lib/cms_scanner/controllers.rb |