Module: GeneSystem::Generators

Defined in:
lib/gene_system/generators.rb

Overview

Generators create empty projects for the gene_system gem

Constant Summary collapse

DEFAULT_STEP =

Default sample step

{
  'name' => 'say hello',
  'exe' => {
    'install' => {
      'cmd' => [
        'echo hello'
      ]
    },
    'remove' => {
      'cmd' => [
        'echo goodbye'
      ]
    }
  },
  'tags' => 'example step'
}.freeze
TEMPLATE_MANIFEST =

Function that creates a named, empty manifest

lambda do |name|
  {
    'name' => name,
    'version' => '0.0.1',
    'metadata' => {
      'gene_system' => {
        'version' => GeneSystem::VERSION
      }
    },
    'steps' => [
      DEFAULT_STEP
    ]
  }
end

Class Method Summary collapse

Class Method Details

.render_empty_manifest(name, path) ⇒ Object

Renders empty manifest at specified path

Parameters:

  • name (String)
  • path (String)


47
48
49
50
51
52
53
54
55
# File 'lib/gene_system/generators.rb', line 47

def render_empty_manifest(name, path)
  manifest_path = File.join(path, name)

  File.open(manifest_path, 'w') do |f|
    f.write(
      TEMPLATE_MANIFEST.call(name).to_json
    )
  end
end