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) ⇒ 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)

Returns:

  • (Result)

    the retsult of project generation

See Also:



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

def generate(name, manifest: false, template: nil, output_dir: nil)
  flags    = {
    :name         => name,
    :template     => template,
    :"output-dir" => output_dir,
  }
  switches = {
    manifest: manifest,
  }
  json = exec(__method__, flags: flags, switches: switches, redirection: :null_stderr)

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