Class: Pfm::Command::GeneratorCommands::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/idlc-sdk-pfm/command/generator_commands/base.rb

Overview

## Base

Base class for ‘chef generate` subcommands. Contains basic behaviors for setting up the generator context, detecting git, and launching a chef converge.

The behavior of the generators is largely delegated to a chef cookbook. The default implementation is the ‘code_generator` cookbook in pfm/skeletons/code_generator.

Direct Known Subclasses

ServerBuild

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#build_base_dir, #build_dir, #build_exists?, #build_setup, #deploy_setup, #deploy_setupv2, #inf_base_dir, #needs_help?, #needs_version?, #run_with_default_options, #templates_dir, #verbose?

Methods included from Helpers

debug, err, msg, system_command

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



22
23
24
25
26
27
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 22

def initialize(params)
  super()
  @params_valid = true
  @errors = []
  @params = params
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



18
19
20
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 18

def errors
  @errors
end

#paramsObject (readonly)

Returns the value of attribute params.



17
18
19
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 17

def params
  @params
end

Instance Method Details

#params_valid?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 44

def params_valid?
  @params_valid
end

#read_and_validate_paramsObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 32

def read_and_validate_params
  arguments = parse_options(params)
  case arguments.size
  when 1

  when 2

  else
    @params_valid = false
  end
end

#setup_contextObject



29
30
# File 'lib/idlc-sdk-pfm/command/generator_commands/base.rb', line 29

def setup_context
end