Sha256: 37f8917f7cfcace7b35d71da8c96b445be2e332401d764dc198432d23deba3f4

Contents?: true

Size: 595 Bytes

Versions: 6

Compression:

Stored size: 595 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, state: :published }
      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

6 entries across 6 versions & 1 rubygems

Version Path
dradis-plugins-4.14.0 lib/dradis/plugins/thor_helper.rb
dradis-plugins-4.13.0 lib/dradis/plugins/thor_helper.rb
dradis-plugins-4.11.0 lib/dradis/plugins/thor_helper.rb
dradis-plugins-4.10.0 lib/dradis/plugins/thor_helper.rb
dradis-plugins-4.9.0 lib/dradis/plugins/thor_helper.rb
dradis-plugins-4.8.0 lib/dradis/plugins/thor_helper.rb