Class: Fastlane::Actions::FirCliAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



51
52
53
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 51

def self.authors
  ["atpking"]
end

.available_optionsObject



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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 65

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "FIR_CLI_API_TOKEN",
                                 description: "A description of your option",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :specify_file_path,
                                 env_name: "FIR_SPECIFY_FILE_PATH",
                                 description: "FILE APP PATH",
                                 default_value: nil,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :short,
                                 env_name: "FIR_APP_SHORT",
                                 description: "fir short",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :force_pin_history,
                                 env_name: "FIR_APP_FORCE_PIN_HISTORY",
                                 description: "pin this release to download page",
                                 default_value: false,
                                 type: Boolean,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :skip_update_icon,
                                 env_name: "FIR_APP_SKIP_UPDATE_ICON",
                                 description: "skip upload icon",
                                 default_value: false,
                                 type: Boolean,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :specify_icon_file,
                                 env_name: "FIR_SPECIFY_ICON_FILE_PATH",
                                 description: "APP ICON FILE PATH",
                                 default_value: nil,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :changelog,
                                 env_name: "FIR_APP_CHANGELOG",
                                 description: "changelog path or content",
                                 default_value: nil,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :open,
                                 env_name: "FIR_APP_OPEN",
                                 description: "true/false if open for everyone",
                                 default_value: true,
                                 type: Boolean,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :password,
                                 env_name: "FIR_APP_PASSWORD",
                                 description: "Set password for app",
                                 default_value: nil,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :switch_to_qiniu,
                                 env_name: "FIR_SWITCH_TO_QINIU",
                                 description: "switch to qiniu upload",
                                 default_value: false,
                                 type: Boolean,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :need_release_id,
                                 env_name: "FIR_NEED_RELEASE_ID",
                                 description: "would build download url with release id",
                                 default_value: false,
                                 type: Boolean,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :specify_app_display_name,
                                 env_name: "FIR_SPECIFY_APP_DISPLAY_NAME",
                                 description: "specify app display name",
                                 default_value: nil,
                                 type: String,
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :dingtalk_access_token,
                                 env_name: "FIR_DINGTALK_ACCESS_TOKEN",
                                 description: "dingtalk_access_token",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :dingtalk_custom_message,
                                 env_name: "FIR_DINGTALK_CUSTOM_MESSAGE",
                                 description: "dingtalk custom message",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :dingtalk_at_phones,
                                 env_name: "FIR_DINGTALK_AT_PHONES",
                                 description: "dingtalk at phones, split with ','",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :dingtalk_at_all,
                                 env_name: "FIR_DINGTALK_AT_ALL",
                                 description: "dingtalk at all people",
                                 type: Boolean,
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :dingtalk_secret,
                                 env_name: "FIR_DINGTALK_SECRET",
                                 description: "Dingtalk secret code (eg: SECxxxxx)",
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :oversea_turbo,
                                 env_name: "FIR_OVERSEA_TURBO",
                                 description: "fir oversea turbo, increase upload speed for oversea users",
                                 type: Boolean,
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :feishu_access_token,
                                 env_name: "FIR_FEISHU_ACCESS_TOKEN",
                                 description: "feishu_access_token",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :feishu_custom_message,
                                 env_name: "FIR_FEISHU_CUSTOM_MESSAGE",
                                 description: "feishu custom message",
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :wxwork_access_token,
                                 env_name: "FIR_WXWORK_ACCESS_TOKEN",
                                 description: "wechat work webhook access_token",
                                 optional: true),

    FastlaneCore::ConfigItem.new(key: :wxwork_pic_url,
                                 env_name: "FIR_WXWORK_PIC_URL",
                                 description: "wechat work webhook pic url",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :wxwork_custom_message,
                                 env_name: "FIR_WXWORK_CUSTOM_MESSAGE",
                                 description: "wechat work custom message",
                                 optional: true),

  ]
end

.descriptionObject



47
48
49
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 47

def self.description
  "upload ipa or apk to fir.im using fir-cli (This plugin is maintained by fir.im official)"
end

.detailsObject



60
61
62
63
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 60

def self.details
  # Optional:
  "invoke fir-cli from fastlane plugin directly. \nfir-cli: https://github.com/FIRHQ/fir-cli"
end

.find_app_location(file_path) ⇒ Object



196
197
198
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 196

def self.find_app_location(file_path)
  file_path || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] || Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


188
189
190
191
192
193
194
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 188

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



55
56
57
58
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 55

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

.run(params) ⇒ Object



9
10
11
12
13
14
15
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
# File 'lib/fastlane/plugin/fir_cli/actions/fir_cli_action.rb', line 9

def self.run(params)
  UI.message("The fir_cli plugin is working!")

  fir_args = find_app_location(params[:specify_file_path])
  options = {
    token: params[:api_token],
    specify_file_path: params[:specify_file_path],
    force_pin_history: params[:force_pin_history],
    skip_update_icon: params[:skip_update_icon],
    specify_icon_file: params[:specify_icon_file],
    changelog: params[:changelog],
    open: params[:open],
    password: params[:password],
    need_release_id: params[:need_release_id],
    short: params[:short],
    switch_to_qiniu: params[:switch_to_qiniu],
    specify_app_display_name: params[:specify_app_display_name],

    dingtalk_access_token: params[:dingtalk_access_token],
    dingtalk_custom_message: params[:dingtalk_custom_message],
    dingtalk_at_phones: params[:dingtalk_at_phones],
    dingtalk_at_all: params[:dingtalk_at_all],
    dingtalk_secret: params[:dingtalk_secret],
    oversea_turbo: params[:oversea_turbo],

    feishu_access_token: params[:feishu_access_token],
    feishu_custom_message: params[:feishu_custom_message],

    wxwork_access_token: params[:wxwork_access_token],
    wxwork_custom_message: params[:wxwork_custom_message],
    wxwork_pic_url: params[:wxwork_pic_url],

  }.reject { |_k, v| v.nil? }
  answer = Helper::FirHelper.publish(fir_args, options)
  UI.message("fastlane-plugin-fir_cli answer: #{answer}")
  answer
end