Sha256: 2d49bb35c156a9be0dd3411289e8e0b69b7cb26d8fec788b63eb216c675255f9

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

module PowerStencil
  module Plugins

    module CommandLine

      attr_reader :plugin_command_line_modifier


      def register_processors
        clm = PowerStencil.command_line_manager
        plugin_definition[:processors].each do |processors_name, processor|
          processor_class = Object.const_get processor
          command = clm.command_by_alias(processors_name)
          clm.register_processor command, processor_class.new
          command.add_provider self
        end
      end

      private

      def load_yaml_command_definition
        yaml_file = plugin_command_line_definition_file
        if File.exists? yaml_file and File.file? yaml_file and File.readable? yaml_file
          logger.info "Adding extra command line definition for '#{name}' plugin..."
          @plugin_command_line_modifier = project.yaml_file_to_hash yaml_file
          command_line_manager.contribute_to_definition @plugin_command_line_modifier, layer_name: "Plugin: #{name}"
          capabilities[:command_line] = true
        else
          logger.debug "There is no extra command line definition provided by plugin '#{name}'."
        end
      rescue => e
        logger.debug PowerStencil::Error.report_error(e)
        logger.warn "Could not load yaml file '#{yaml_file}' because '#{e.message}'"
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
power_stencil-0.10.0 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.8 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.7 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.6 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.5 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.4 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.3 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.2 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.1 lib/power_stencil/plugins/command_line.rb
power_stencil-0.9.0 lib/power_stencil/plugins/command_line.rb
power_stencil-0.8.14 lib/power_stencil/plugins/command_line.rb