Sha256: 7cac0758651078555944726f05b3c9316d1b2e74bc7f4783add522dc76c160a1

Contents?: true

Size: 576 Bytes

Versions: 21

Compression:

Stored size: 576 Bytes

Contents

module Dradis
  module Plugins
    # Helper methods for plugin Thor tasks
    module ThorHelper
      attr_accessor :task_options, :logger

      def detect_and_set_project_scope
        task_options[:project_id] = Project.new.id
      end

      def task_options
        @task_options ||= { logger: logger }
      end

      def logger
        @logger ||= default_logger
      end


      private
      def default_logger
        STDOUT.sync   = true
        logger        = Logger.new(STDOUT)
        logger.level  = Logger::DEBUG
        logger
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
dradis-plugins-3.10.0 lib/dradis/plugins/thor_helper.rb