Module: SfCli::Sf::Project::DeployStart

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

Defined Under Namespace

Classes: Result

Constant Summary collapse

DeployedFile =
Data.define(:full_name, :type, :state, :file_path)

Instance Method Summary collapse

Instance Method Details

#deploy_start(metadata: nil, manifest: nil, source_dir: nil, target_org: nil, raw_output: false, metadata_dir: nil, tests: nil, test_level: nil, api_version: nil, wait: nil, dry_run: false, ignore_conflicts: false, ignore_errors: false, ignore_warnings: false, single_package: false) ⇒ Result

Deploy metadata to an org from your local project.

Parameters:

  • manifest (String) (defaults to: nil)

    path of the manifest file(package.xml) that specifies the components to retrieve

  • metadata (Array) (defaults to: nil)

    metadata names that specifies the components to retrieve

  • source_dir (String) (defaults to: nil)

    file or directory path to retrieve from the org.

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

    an alias of paticular org, or username can be used

  • api_version (Numeric) (defaults to: nil)

    override the api version used for api requests made by this command

  • wait (Integer) (defaults to: nil)

    number of minutes to wait for command to complete

  • raw_output (Boolian) (defaults to: false)

    output what original command shows

  • dry_run (Boolian) (defaults to: false)

    validate deploy and run Apex tests but don’t save to the org.

  • ignore_conflicts (Boolian) (defaults to: false)

    ignore conflicts and deploy local files, even if they overwrite changes in the org.

  • ignore_errors (Boolian) (defaults to: false)

    ignore any errors and don’t roll back deployment. Never use this flag when deploying to a production org.

  • ignore_warnings (Boolian) (defaults to: false)

    ignore warnings and allow a deployment to complete successfully.

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

    root of directory or zip file of metadata formatted files to deploy.

  • single_package (Boolian) (defaults to: false)

    indicates that the metadata zip file points to a directory structure for a single package.

  • tests (Array) (defaults to: nil)

    Apex tests to run when –test-level is RunSpecifiedTests.

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

    deployment Apex testing level. Available values are NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg.

Returns:

  • (Result)

    the retsult of the command

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/sf_cli/sf/project/deploy_start.rb', line 32

def deploy_start(metadata: nil, manifest: nil,  source_dir: nil, target_org: nil, raw_output: false, metadata_dir: nil, tests: nil, test_level: nil,
  api_version: nil, wait: nil, dry_run: false, ignore_conflicts: false, ignore_errors: false, ignore_warnings: false, single_package: false)

  flags = {
    :manifest       => manifest,
    :metadata       => &.join(' '),
    :"source-dir"   => source_dir,
    :"target-org"   => target_org,
    :"api-version"  => api_version,
    :"metadata-dir" => ,
    :tests          => tests&.join(' '),
    :"test-level"   => test_level,
    :"wait"         => wait,
  }
  switches = {
    :"dry-run"          => dry_run,
    :"ignore-conflicts" => ignore_conflicts,
    :"ignore-errors"    => ignore_errors,
    :"ignore-warnings"  => ignore_warnings,
    :"single-package"   => single_package,
  }
  action = __method__.to_s.tr('_', ' ')
  command_output_format = raw_output ? :human : :json
  redirect_type = raw_output ? nil : :null_stderr
  output = exec(action, flags: flags, switches: switches, redirection: redirect_type, raw_output: raw_output, format: command_output_format)
  return output if raw_output

  Result.new(
    done:    output['result']['done'],
    id:      output['result']['id'],
    details: output['result']['details'],
    status:  output['result']['status'],
    success: output['result']['success'],
    files:   output['result']['files'].map{|f| create_deployed_file(f)}
  )
end