Class: Fastlane::Actions::AppcenterCodepushReleaseReactAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



12
13
14
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 12

def self.authors
  ["Ivan Sokolovskii"]
end

.available_optionsObject



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 64

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                type: String,
                            env_name: "APPCENTER_API_TOKEN",
                         description: "API Token for App Center Access",
                        verify_block: proc do |value|
                          UI.user_error!("No API token for App Center given, pass using `api_token: 'token'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :owner_name,
                                type: String,
                            env_name: "APPCENTER_OWNER_NAME",
                         description: "Name of the owner of the application on App Center",
                        verify_block: proc do |value|
                          UI.user_error!("No owner name for App Center given, pass using `owner_name: 'owner name'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :app_name,
                                type: String,
                            env_name: "APPCENTER_APP_NAME",
                         description: "Name of the application on App Center",
                        verify_block: proc do |value|
                          UI.user_error!("No app name for App Center given, pass using `app_name: 'app name'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :deployment,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_DEPLOYMENT",
                            optional: true,
                       default_value: "Staging",
                         description: "Deployment name for releasing to"),
    FastlaneCore::ConfigItem.new(key: :target_version,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_TARGET_VERSION",
                            optional: true,
                         description: "Target binary version for example 1.0.1"),
    FastlaneCore::ConfigItem.new(key: :mandatory,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_MANDATORY",
                       default_value: true,
                            optional: true,
                         description: "mandatory update or not"),
    FastlaneCore::ConfigItem.new(key: :description,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_DESCRIPTION",
                            optional: true,
                         description: "Release description for CodePush"),
    FastlaneCore::ConfigItem.new(key: :dry_run,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DRY_RUN",
                       default_value: false,
                            optional: true,
                         description: "Print the command that would be run, and don't run it"),
    FastlaneCore::ConfigItem.new(key: :disabled,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DISABLED",
                       default_value: false,
                            optional: true,
                         description: "Specifies whether this release should be immediately downloadable"),
    FastlaneCore::ConfigItem.new(key: :no_duplicate_release_error,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_NO_DUPLICATE_ERROR",
                       default_value: false,
                            optional: true,
                         description: "Specifies whether to return an error if the main bundle is identical to the latest codepush release"),
    FastlaneCore::ConfigItem.new(key: :bundle_name,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_BUNDLE_NAME",
                            optional: true,
                         description: "Specifies the name of the bundle file"),
    FastlaneCore::ConfigItem.new(key: :output_dir,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_OUTPUT",
                            optional: true,
                         description: "Specifies path to where the bundle and sourcemap should be written"),
    FastlaneCore::ConfigItem.new(key: :sourcemap_output,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_SOURCEMAP_OUTPUT",
                            optional: true,
                         description: "Specifies path to write sourcemap to"),
    FastlaneCore::ConfigItem.new(key: :development,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DEVELOPMENT",
                            optional: true,
                       default_value: false,
                         description: "Specifies whether to generate a dev build")
  ]
end

.descriptionObject



8
9
10
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 8

def self.description
  "CodePush release react action"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 151

def self.is_supported?(platform)
  [:ios, :android].include?(platform)
end

.run(params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 16

def self.run(params)
  app = params[:app_name]
  owner = params[:owner_name]
  token = params[:api_token]
  deployment = params[:deployment]
  dev = params[:development]
  description = params[:description]
  mandatory = params[:mandatory]
  version = params[:target_version]
  disabled = params[:disabled]
  no_errors = params[:no_duplicate_release_error]
  bundle = params[:bundle_name]
  output = params[:output_dir]
  sourcemap_output = params[:sourcemap_output]
  dry_run = params[:dry_run]

  command = "appcenter codepush release-react --token #{token} --app #{owner}/#{app} --deployment-name #{deployment} --development #{dev} "
  if description
    command += "--description \"#{description}\" "
  end
  if mandatory
    command += "--mandatory "
  end
  if version
    command += "--target-binary-version #{version} "
  end
  if disabled
    command += "--disabled "
  end
  if no_errors
    command += "--disable-duplicate-release-error "
  end
  if bundle
    command += "--bundle-name #{bundle} "
  end
  if output
    command += "--output-dir #{output} "
  end
  if sourcemap_output
    command += "--sourcemap-output #{sourcemap_output} "
  end
  if dry_run
    UI.message("Dry run!".red + " Would have run: " + command + "\n")
  else
    sh(command.to_s)
  end
end