fastlane-plugin-firebase_app_distribution 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3316c560bc4c691d569deea229397668e8e3a00ca4201d332602acd112379639
4
- data.tar.gz: 6fe95425b0f4a85d3492ec51ae8353979f3534b635655ee55349f12191c721ae
3
+ metadata.gz: 3322484a56333009e014da42a52738c805177e1343056767b59d6bf92752f511
4
+ data.tar.gz: d3544fef79f17bae724fa9ced433ab6d5f1b35d98548633c85c16cae9772a585
5
5
  SHA512:
6
- metadata.gz: fc0f5ac7cd9081eb02e539cb6bc2f2116dcc51e04ac8b5685ca611469fd76f37470d35c4c5085bf267fa7d296a76d95ddbdc5714ab8fe2388cf249d51101740d
7
- data.tar.gz: 5e8cc15580a5f98491f1d9318728600c751a807a8f5108df4844fe6f371e2725b5dcffb38af560b58de202dc20bb3ba3d77ec2155d065c4452f0b287f15728ec
6
+ metadata.gz: 39465b098a4d080ace440a5d73363d676497bc544f6563d57fde89e72cd37b8a9111d44ca98815ba633744d41045a13654c7e46c2f8f64e1b60669b7ad3944d4
7
+ data.tar.gz: 22079d114aa0558ecdb5e670c05eff74faa68b286b15a2ff5eafd5dabfc6837202b023ee93cfc73969c3961178ae404695c1ef031cb01885a878cae60a3c16ef
@@ -9,41 +9,34 @@ require_relative '../helper/firebase_app_distribution_helper'
9
9
  module Fastlane
10
10
  module Actions
11
11
  class FirebaseAppDistributionAction < Action
12
-
13
- DEFAULT_FIREBASE_CLI_PATH = %x(which firebase).chomp
12
+ DEFAULT_FIREBASE_CLI_PATH = `which firebase`.chomp
14
13
  FIREBASECMD_ACTION = "appdistribution:distribute".freeze
15
-
14
+
16
15
  extend Helper::FirebaseAppDistributionHelper
17
16
 
18
17
  def self.run(params)
19
18
  params.values # to validate all inputs before looking for the ipa/apk
20
-
21
- release_file = params[:release_notes_file]
22
- if params[:release_notes].to_s != ""
23
- release_file = file_for_contents(:release_notes, from: params)
24
- end
25
-
26
- groups_file = file_for_contents(:groups, from: params)
27
- testers_file = file_for_contents(:testers, from: params)
28
19
 
29
20
  cmd = [params[:firebase_cli_path], FIREBASECMD_ACTION]
30
21
  cmd << Shellwords.escape(params[:ipa_path] || params[:apk_path])
31
22
  cmd << "--app #{params[:app]}"
32
- cmd << "--groups-file #{groups_file}" if groups_file
33
- cmd << "--testers-file #{testers_file}" if testers_file
34
- cmd << "--release-notes-file #{release_file}" if release_file
35
23
 
36
- result = Actions.sh_control_output(
37
- cmd.join(" "),
24
+ cmd << groups_flag(params)
25
+ cmd << testers_flag(params)
26
+ cmd << release_notes_flag(params)
27
+
28
+ Actions.sh_control_output(
29
+ cmd.compact.join(" "),
38
30
  print_command: false,
39
31
  print_command_output: true
40
32
  )
41
-
33
+ # make sure we do this, even in the case of an error.
34
+ ensure
42
35
  cleanup_tempfiles
43
36
  end
44
37
 
45
38
  def self.description
46
- "Release your beta builds to Firebase App Distro"
39
+ "Release your beta builds with Firebase App Distribution"
47
40
  end
48
41
 
49
42
  def self.authors
@@ -52,7 +45,7 @@ module Fastlane
52
45
 
53
46
  # supports markdown.
54
47
  def self.details
55
- "Release your beta builds to Firebase App Distro"
48
+ "Release your beta builds with Firebase App Distribution"
56
49
  end
57
50
 
58
51
  def self.available_options
@@ -105,7 +98,7 @@ module Fastlane
105
98
  end
106
99
 
107
100
  unless is_firebasecmd_supported?(value)
108
- UI.user_error!("firebase_cli_path: `#{value}` does not support the `#{FIREBASECMD_ACTION}` command. Please download (https://appdistro.page.link/firebase-cli-download) or specify the path to the correct version of firebse")
101
+ UI.user_error!("firebase_cli_path: `#{value}` does not support the `#{FIREBASECMD_ACTION}` command. Please download (https://appdistro.page.link/firebase-cli-download) or specify the path to the correct version of firebse")
109
102
  end
110
103
  end),
111
104
  FastlaneCore::ConfigItem.new(key: :groups,
@@ -139,7 +132,7 @@ module Fastlane
139
132
  env_name: "FIREBASEAPPDISTRO_RELEASE_NOTES_FILE",
140
133
  description: "Release notes file for this build",
141
134
  optional: true,
142
- type: String),
135
+ type: String)
143
136
  ]
144
137
  end
145
138
 
@@ -162,8 +155,6 @@ module Fastlane
162
155
  ]
163
156
  end
164
157
 
165
- private
166
-
167
158
  ## TODO: figure out if we can surpress color output.
168
159
  def self.is_firebasecmd_supported?(cmd)
169
160
  outerr, status = Open3.capture2e(cmd, "--non-interactive", FIREBASECMD_ACTION, "--help")
@@ -5,35 +5,49 @@ module Fastlane
5
5
 
6
6
  module Helper
7
7
  module FirebaseAppDistributionHelper
8
- ##
9
- # always return a file for a given content
10
- # TODO: explain this more.
11
- def file_for_contents(parameter_name, from: nil, contents: nil)
12
- if parameter_name.to_s.end_with?("_file")
13
- return parameter_name
8
+ def testers_flag(params)
9
+ file_flag_if_supplied("--testers-file", "testers", params)
10
+ end
11
+
12
+ def groups_flag(params)
13
+ file_flag_if_supplied("--groups-file", "groups", params)
14
+ end
15
+
16
+ def release_notes_flag(params)
17
+ file_flag_if_supplied("--release-notes-file", "release_notes", params)
18
+ end
19
+
20
+ def file_flag_if_supplied(flag, param_name, params)
21
+ file = params["#{param_name}_file".to_sym]
22
+ file ||= file_for_contents(param_name.to_sym, params)
23
+
24
+ if file
25
+ return "--#{flag} #{file}"
14
26
  end
27
+ end
15
28
 
16
- if @tempfiles == nil
29
+ ##
30
+ # always return a file for a given content
31
+ def file_for_contents(parameter_name, params)
32
+ if @tempfiles.nil?
17
33
  @tempfiles = []
18
34
  end
19
35
 
20
- contents ||= from[parameter_name]
36
+ contents = params[parameter_name]
21
37
  return nil if contents.nil?
22
38
 
23
39
  file = Tempfile.new(parameter_name.to_s)
24
40
  file.write(contents)
25
41
  file.close
26
42
  @tempfiles << file
27
-
43
+
28
44
  file.path
29
45
  end
30
46
 
31
47
  def cleanup_tempfiles
32
- @tempfiles.each do |f|
33
- f.unlink
34
- end
48
+ return if @tempfiles.nil?
49
+ @tempfiles.each(&:unlink)
35
50
  end
36
-
37
51
  end
38
52
  end
39
53
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FirebaseAppDistribution
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-firebase_app_distribution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry