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

Included in:
Core
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) ⇒ 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)

See Also:



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

def generate_manifest(name: nil, output_dir: nil, api_version: nil, metadata: [], from_org: nil, source_dir: nil)
  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('_', ' ')
  json = exec(action, flags: flags, redirection: :null_stderr)

  json['result']['path']
end