Sha256: cc85754b86a345a11111159d45da2e861e5645e42b0b7b3782d80af468c1e9aa

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require '<%= plugin_name %>/version'
require '<%= plugin_name %>/plugin_helper'
require '<%= plugin_name %>/<%= plugin_name %>_processor'
require '<%= plugin_name %>/dsl/<%= plugin_name %>_dsl'

module <%= plugin_module_name %>

  extend Climatic::Utils::SafeExec

  def self.generate_build_files(entity_to_build, target_directory)
    # This is an example of what you could do to generate files, here using default detemplatization...
    PowerStencil.logger.debug "By default plugin '<%= plugin_name %>' uses standard build..."
    PowerStencil.project.engine.generate_build_files entity_to_build, target_directory
  end

  def self.post_build_hook(built_entity, generated_files_path)
    # This is an example of what you could do after files are generated, ie pretty much anything...
    case built_entity.type
    when :<%= plugin_name %>_entity
      generated_file = File.join generated_files_path, 'message.txt'
      # Enclose in `safely_exec_code` code that is protected by the `--simulate` command-line flag.
      safely_exec_code(message: "Displaying content of '#{generated_file}'.") do
        puts File.readlines(generated_file)
      end
    else
      raise PowerStencil::Error, 'Plugin <%= plugin_name %> doesnt know how handle the build of a <%= plugin_name %>_entity entity type !'
    end
  end

end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
power_stencil-0.9.4 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.9.4 etc/templates/plugin_definition/lib/{entity}.rb.erb