Module: SfCli::Sf::Project::GenerateManifest

Defined in:
lib/sf_cli/sf/project/generate_manifest.rb

Instance Method Summary collapse

Instance Method Details

#generate_manifest(name: nil, output_dir: nil, api_version: nil, metadata: [], from_org: nil, source_dir: nil, raw_output: false) ⇒ Object

Create a project manifest that lists the metadata components you want to deploy or retrieve

Examples:

sf.project.generate_manifest metadata: %w[CustomObject Layout] # creates a package.xml, which is initialized with CustomObject and Layout
sf.project.generate_manifest from_org: org_name                # creates a package.xml, which is initialized with all metadata types in the org

Parameters:

  • metadata (Array) (defaults to: [])

    an array that consists of metadata type like CustomObject, Layout and so on. (default: [])

  • api_version (Integer) (defaults to: nil)

    API version (default: nil)

  • output_dir (String) (defaults to: nil)

    manifest’s output directory in the project directory. You can use relative path from the project root (default: nil)

  • from_org (String) (defaults to: nil)

    username or alias of the org that contains the metadata components from which to build a manifest (default: nil)

  • source_dir (String) (defaults to: nil)

    paths to the local source files to include in the manifest (default: nil)

  • raw_output (Boolian) (defaults to: false)

    output what original command shows

See Also:



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

def generate_manifest(name: nil, output_dir: nil, api_version: nil, metadata: [], from_org: nil, source_dir: nil, raw_output: false)
  flags    = {
    :name           => name,
    :"metadata"     => (.empty? ? nil : .join(' ')),
    :"from-org"     => from_org,
    :"source-dir"   => source_dir,
    :"output-dir"   => output_dir,
    :"api-version"  => api_version,
  }
  action = __method__.to_s.tr('_', ' ')
  command_output_format = raw_output ? :human : :json
  redirect_type = raw_output ? nil : :null_stderr
  output = exec(action, flags: flags, redirection: redirect_type, raw_output: raw_output, format: command_output_format)
  return output if raw_output

  output['result']['path']
end