Sha256: 5a8c96fdd9b6a79b2a28949faa4655204ac13f4bf9db069ae7e0aeea5c93fa29

Contents?: true

Size: 1.26 KB

Versions: 26

Compression:

Stored size: 1.26 KB

Contents

module PowerStencil
  module Plugins

    module Capabilities

      include PowerStencil::Utils::FileHelper

      CAPABILITIES = %i(config command_line processors build dsl entity_definitions templates).freeze

      attr_reader :plugin_definition

      def capabilities
        @capabilities ||= CAPABILITIES.dup.zip([false] * CAPABILITIES.size).to_h
      end

      private

      def load_capabilities
        yaml_file = plugin_capabilities_definition_file
        unless File.exists? yaml_file and File.file? yaml_file and File.readable? yaml_file
          raise PowerStencil::Error, "Plugin '#{self.name}' has no definition file !"
        end
        logger.debug "Loading plugin '#{self.name}' capabilities..."
        begin
          @plugin_definition = yaml_file_to_hash yaml_file
          %i(processors entity_definitions templates build dsl).each do |capability|
            unless plugin_definition[capability].nil? or plugin_definition[capability].empty?
              capabilities[capability] = true
            end
          end
        rescue => e
          logger.debug PowerStencil::Error.report_error(e)
          raise PowerStencil::Error, "Invalid plugin capabilities file '#{yaml_file}' for plugin '#{self.name}'"
        end

      end

    end

  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
power_stencil-0.9.2 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.9.1 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.9.0 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.14 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.13 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.12 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.11 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.10 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.9 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.8 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.7 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.6 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.5 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.4 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.3 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.2 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.1 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.8.0 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.7.4 lib/power_stencil/plugins/capabilities.rb
power_stencil-0.7.3 lib/power_stencil/plugins/capabilities.rb