Sha256: 8e6977f96cb9ae00ddb97b88d96c1d7bdadd9b714b04ce2b8c18642386604f3a

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 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 '#{built_entity.type}' type !"
    end
  end

end

Version data entries

10 entries across 5 versions & 1 rubygems

Version Path
power_stencil-0.10.0 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.10.0 etc/templates/plugin_definition/lib/{entity}.rb.erb
power_stencil-0.9.8 etc/templates/plugin_definition/lib/{entity}.rb.erb
power_stencil-0.9.8 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.9.7 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.9.7 etc/templates/plugin_definition/lib/{entity}.rb.erb
power_stencil-0.9.6 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.9.6 etc/templates/plugin_definition/lib/{entity}.rb.erb
power_stencil-0.9.5 etc/meta_templates/plugin_seed/lib/{entity}.rb.erb
power_stencil-0.9.5 etc/templates/plugin_definition/lib/{entity}.rb.erb