Class: Fastlane::Actions::CodepushPromoteAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



32
33
34
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 32

def self.authors
  ['Pranit Harekar']
end

.available_optionsObject



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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 43

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :app_name,
      env_name: "APP_CENTER_APP_NAME",
      description: "Name of the App Center app, optional if ENV['APP_CENTER_APP_NAME'] is set",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :execution_dir_path,
      description: 'Promote CLI command execution dir path',
      optional: true,
      type: String,
      default_value: "./"
    ),
    FastlaneCore::ConfigItem.new(
      key: :target_binary_version,
      description: 'Store/binary version of the app you are releasing the update for',
      optional: true,
      type: String,
      default_value: "\"*\""
    ),
    FastlaneCore::ConfigItem.new(
      key: :source_deployment_name,
      description: 'Source deployment name',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :destination_deployment_name,
      description: 'Destination deployment name',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :description,
      description: "An optional change log for the deployment",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :rollout_percentage,
      description: "Percentage of users that should be eligible to receive this update",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :disable_duplicate_release_error,
      description: "Specify whether duplicate release error should be disabled or not",
      optional: true,
      is_string: false,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :disable_telemetry,
      description: "Specify whether telemetry should be disabled or not",
      optional: true,
      is_string: false,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :dry_run,
      description: "Print the command that would be run, and don't run it",
      is_string: false,
      default_value: false
    )
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 28

def self.description
  'CodePush promote action'
end

.detailsObject



40
41
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 40

def self.details
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 113

def self.is_supported?(platform)
  true
end

.return_valueObject



36
37
38
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 36

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/plugin/codepush/actions/codepush_promote_action.rb', line 6

def self.run(params)
  Dir.chdir(params[:execution_dir_path].to_s) do
    command = "appcenter codepush promote "

    ## params
    command += "-a #{params[:app_name]} "
    command += "-t #{params[:target_binary_version]} " if params[:target_binary_version]
    command += "-s #{params[:source_deployment_name]} " if params[:source_deployment_name]
    command += "-d #{params[:destination_deployment_name]} " if params[:destination_deployment_name]
    command += "-r #{params[:rollout_percentage]} " if params[:rollout_percentage]
    command += '--disable-duplicate-release-error ' if params[:disable_duplicate_release_error]
    command += '--disable-telemetry ' if params[:disable_telemetry]
    command += "--description #{params[:description]} " if params[:description]

    if params[:dry_run]
      UI.message('Dry run!'.red + ' Would have run: ' + command + "\n")
    else
      sh(command.to_s)
    end
  end
end