Module: SfCli::Sf::Project::Generate

Included in:
Core
Defined in:
lib/sf_cli/sf/project/generate.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#generate(name, manifest: false, template: nil, output_dir: nil, raw_output: false) ⇒ Result

Generate a Salesforce DX project

Parameters:

  • name (Symbol, String)

    project name

  • template (Symbol, String) (defaults to: nil)

    project template name

  • output_dir (String) (defaults to: nil)

    output directory

  • manifest (Boolian) (defaults to: false)

    switch to create manifest file in the project directory (manifest/package.xml)

  • raw_output (Boolian) (defaults to: false)

    output what original command shows

Returns:

  • (Result)

    the retsult of project generation

See Also:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sf_cli/sf/project/generate.rb', line 17

def generate(name, manifest: false, template: nil, output_dir: nil, raw_output: false)
  flags    = {
    :name         => name,
    :template     => template,
    :"output-dir" => output_dir,
  }
  switches = {
    manifest: manifest,
  }
  command_output_format = raw_output ? :human : :json
  redirect_type = raw_output ? nil : :null_stderr
  output = exec(__method__, flags: flags, switches: switches, redirection: redirect_type, raw_output: raw_output, format: command_output_format)
  return output if raw_output

  Result.new(
    output_dir: output['result']['outputDir'],
    files:      output['result']['created'],
    raw_output: output['result']['rawOutput'],
    warnings:   output['warnings']
  )
end