fastlane-plugin-fivethree_ionic 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,40 +4,68 @@ module Fastlane
4
4
  def self.run(params)
5
5
  keystore_path = Fastlane::Actions::FivAndroidKeystoreAction.run(params)
6
6
 
7
- keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_storepass")
7
+ keychain_entry =
8
+ CredentialsManager::AccountManager.new(
9
+ user: "#{params[:keystore_name]}_android_keystore_storepass"
10
+ )
8
11
  keystore_storepass = keychain_entry.password
9
12
 
10
- keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_keypass")
13
+ keychain_entry =
14
+ CredentialsManager::AccountManager.new(
15
+ user: "#{params[:keystore_name]}_android_keystore_keypass"
16
+ )
11
17
  keystore_keypass = keychain_entry.password
12
18
 
13
19
  puts "You can delete the password if they are wrong stored in the keychain: 'fastlane fastlane-credentials remove --username android_keystore_storepass' and 'fastlane fastlane-credentials remove --username android_keystore_keypass'"
14
20
 
15
- android_build_tool_path = "#{params[:android_sdk_path]}/build-tools/#{params[:android_build_tool_version]}"
21
+ android_build_tool_path =
22
+ "#{params[:android_sdk_path]}/build-tools/#{
23
+ params[:android_build_tool_version]
24
+ }"
25
+
26
+ zipalign_apk_file = params[:apk_zipalign_target]
27
+ if (File.file?(zipalign_apk_file))
28
+ remove_zipalign = "rm -Rf #{zipalign_apk_file}"
29
+ sh remove_zipalign
30
+ end
16
31
 
17
32
  # zipalign APK
18
- remove_zipalign = "rm -Rf ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk"
19
- sh remove_zipalign
20
- zipalign = "#{android_build_tool_path}/zipalign -v 4 \
21
- ../platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk \
22
- ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk"
33
+ zipalign =
34
+ "#{android_build_tool_path}/zipalign -v 4 \
35
+ #{
36
+ params[:apk_source]
37
+ } \
38
+ #{zipalign_apk_file}"
23
39
  sh zipalign
24
40
 
25
- if(!File.directory?(params[:apk_output_dir]))
26
- Dir.mkdir params[:apk_output_dir]
41
+ if (!File.directory?(params[:apk_signed_target]))
42
+ Dir.mkdir params[:apk_signed_target]
27
43
  end
28
- output_path = "#{params[:apk_output_dir]}/app-release-#{params[:app_version]}-#{params[:app_build_no]}.apk"
29
-
30
- sign = "#{android_build_tool_path}/apksigner sign \
31
- --ks #{keystore_path} \
32
- --ks-key-alias #{params[:key_alias]} \
44
+
45
+ output_path =
46
+ "#{params[:apk_signed_target]}/app-release-#{params[:app_version]}-#{
47
+ params[:app_build_no]
48
+ }.apk"
49
+
50
+ sign =
51
+ "#{android_build_tool_path}/apksigner sign \
52
+ --ks #{
53
+ keystore_path
54
+ } \
55
+ --ks-key-alias #{
56
+ params[:key_alias]
57
+ } \
33
58
  --ks-pass pass:#{keystore_keypass} \
34
- --out #{output_path} \
35
- ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk"
36
- self.run_shell_script(sign, params[:silent])
59
+ --out #{
60
+ output_path
61
+ } \
62
+ #{zipalign_apk_file}"
63
+ self.run_shell_script(sign)
64
+
65
+ verify =
66
+ ("#{android_build_tool_path}/apksigner verify -v #{output_path}")
67
+ self.run_shell_script(verify)
37
68
 
38
- verify = ("#{android_build_tool_path}/apksigner verify -v #{output_path}")
39
- self.run_shell_script(verify, params[:silent])
40
-
41
69
  return output_path
42
70
  end
43
71
 
@@ -46,80 +74,96 @@ module Fastlane
46
74
  #####################################################
47
75
 
48
76
  def self.description
49
- "Zipalign, sign and verify android apk"
77
+ 'Zipalign, sign and verify android apk'
50
78
  end
51
79
 
52
- def self.run_shell_script(command, silent)
53
- Fastlane::Actions::sh(command, log: silent)
80
+ def self.run_shell_script(command)
81
+ Fastlane::Actions.sh(command)
54
82
  end
55
83
 
56
84
  def self.details
57
85
  # Optional:
58
86
  # this is your chance to provide a more detailed description of this action
59
- "You can use this action to do cool things..."
87
+ 'You can use this action to do cool things...'
60
88
  end
61
89
 
62
90
  def self.available_options
63
- # Define all options your action supports.
64
-
91
+ # Define all options your action supports.
92
+
65
93
  # Below a few examples
66
94
  [
67
95
  FastlaneCore::ConfigItem.new(
68
96
  key: :keystore_path,
69
- env_name: "FIV_KEYSTORE_PATH",
70
- description: "Path to android keystore",
97
+ env_name: 'FIV_KEYSTORE_PATH',
98
+ description: 'Path to android keystore',
71
99
  is_string: true,
72
- default_value: "./fastlane/android"),
100
+ default_value: './fastlane/android'
101
+ ),
73
102
  FastlaneCore::ConfigItem.new(
74
103
  key: :keystore_name,
75
- env_name: "FIV_KEYSTORE_NAME",
76
- description: "Name of the keystore",
104
+ env_name: 'FIV_KEYSTORE_NAME',
105
+ description: 'Name of the keystore',
77
106
  is_string: true,
78
- optional: false),
107
+ optional: false
108
+ ),
79
109
  FastlaneCore::ConfigItem.new(
80
110
  key: :android_sdk_path,
81
- env_name: "FIV_ANDROID_SDK_PATH",
82
- description: "Path to your installed Android SDK",
111
+ env_name: 'FIV_ANDROID_SDK_PATH',
112
+ description: 'Path to your installed Android SDK',
83
113
  is_string: true,
84
- default_value: "~/Library/Android/sdk"),
114
+ default_value: '~/Library/Android/sdk'
115
+ ),
85
116
  FastlaneCore::ConfigItem.new(
86
117
  key: :android_build_tool_version,
87
- env_name: "FIV_ANDROID_SDK_BUILD_TOOL_VERSION",
88
- description: "Android Build Tool version used for `zipalign`, `sign` and `verify`",
118
+ env_name: 'FIV_ANDROID_SDK_BUILD_TOOL_VERSION',
119
+ description:
120
+ 'Android Build Tool version used for `zipalign`, `sign` and `verify`',
89
121
  is_string: true,
90
- default_value: "28.0.3"),
122
+ default_value: '28.0.3'
123
+ ),
91
124
  FastlaneCore::ConfigItem.new(
92
- key: :apk_output_dir,
93
- env_name: "FIV_APK_OUTPUT_DIR",
94
- description: "Output path of the signed apk",
125
+ key: :apk_source,
126
+ env_name: 'FIV_APK_SOURCE',
127
+ description: 'Source path to the apk file',
95
128
  is_string: true,
96
- default_value: "../platforms/android/app/build/outputs/apk/release"),
129
+ default_value:
130
+ './platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk'
131
+ ),
132
+ FastlaneCore::ConfigItem.new(
133
+ key: :apk_zipalign_target,
134
+ env_name: 'FIV_APK_ZIPALIGN_TARGET',
135
+ description: 'Target path for the zipaligned apk',
136
+ is_string: true,
137
+ default_value:
138
+ './platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk'
139
+ ),
140
+ FastlaneCore::ConfigItem.new(
141
+ key: :apk_signed_target,
142
+ env_name: 'FIV_APK_SIGNED_TARGET',
143
+ description: 'Tarket path of the signed apk',
144
+ is_string: true,
145
+ default_value: './platforms/android/app/build/outputs/apk/release'
146
+ ),
97
147
  FastlaneCore::ConfigItem.new(
98
148
  key: :key_alias,
99
- env_name: "FIV_ANDROID_KEYSTORE_ALIAS",
100
- description: "Key alias of the keystore",
149
+ env_name: 'FIV_ANDROID_KEYSTORE_ALIAS',
150
+ description: 'Key alias of the keystore',
101
151
  is_string: true,
102
- optional: false),
152
+ optional: false
153
+ ),
103
154
  FastlaneCore::ConfigItem.new(
104
155
  key: :app_version,
105
- env_name: "FIV_APP_VERSION",
106
- description: "App version",
156
+ env_name: 'FIV_APP_VERSION',
157
+ description: 'App version',
107
158
  is_string: true,
108
159
  default_value: ''
109
160
  ),
110
161
  FastlaneCore::ConfigItem.new(
111
162
  key: :app_build_no,
112
- env_name: "FIV_APP_BUILD_NO",
113
- description: "App build number",
163
+ env_name: 'FIV_APP_BUILD_NO',
164
+ description: 'App build number',
114
165
  is_string: true,
115
166
  default_value: ''
116
- ),
117
- FastlaneCore::ConfigItem.new(
118
- key: :silent,
119
- env_name: "FIV_SIGN_ANDROID_SILENT",
120
- description: "Wether to sign android silently",
121
- is_string: false,
122
- default_value: true
123
167
  )
124
168
  ]
125
169
  end
@@ -128,7 +172,10 @@ module Fastlane
128
172
  # Define the shared values you are going to provide
129
173
  # Example
130
174
  [
131
- ['FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE', 'A description of what this value contains']
175
+ [
176
+ 'FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE',
177
+ 'A description of what this value contains'
178
+ ]
132
179
  ]
133
180
  end
134
181
 
@@ -138,11 +185,11 @@ module Fastlane
138
185
 
139
186
  def self.authors
140
187
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
141
- ["marcjulian"]
188
+ %w[marcjulian]
142
189
  end
143
190
 
144
191
  def self.is_supported?(platform)
145
- platform == :android
192
+ platform == :android
146
193
  end
147
194
  end
148
195
  end
@@ -1,15 +1,18 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
- FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE = :FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE
4
+ FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE =
5
+ :FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE
5
6
  end
6
7
 
7
8
  class FivTakeScreenshotsAction < Action
8
9
  def self.run(params)
9
- UI.header "Taking Screenshots..."
10
-
11
- sh "ionic cordova run browser --prod && #{params[:cypress]} run -s #{params[:spec]} -b chrome"
12
- UI.success "Successfully finished taking screenshots"
10
+ UI.header 'Taking Screenshots...'
11
+
12
+ sh "ionic cordova run browser --prod && #{params[:cypress]} run -s #{
13
+ params[:spec]
14
+ } -b chrome"
15
+ UI.success 'Successfully finished taking screenshots'
13
16
  end
14
17
 
15
18
  #####################################################
@@ -17,30 +20,34 @@ module Fastlane
17
20
  #####################################################
18
21
 
19
22
  def self.description
20
- "A short description with <= 80 characters of what this action does"
23
+ 'A short description with <= 80 characters of what this action does'
21
24
  end
22
25
 
23
26
  def self.details
24
27
  # Optional:
25
28
  # this is your chance to provide a more detailed description of this action
26
- "You can use this action to do cool things..."
29
+ 'You can use this action to do cool things...'
27
30
  end
28
31
 
29
32
  def self.available_options
30
- # Define all options your action supports.
31
-
33
+ # Define all options your action supports.
34
+
32
35
  # Below a few examples
33
36
  [
34
- FastlaneCore::ConfigItem.new(key: :cypress,
35
- env_name: "FIV_BUILD_IONIC_ANDROID_IS_PROD",
36
- description: "Dev or Prod build",
37
- optional: false,
38
- type: String),
39
- FastlaneCore::ConfigItem.new(key: :spec,
40
- env_name: "FIV_BUILD_IONIC_ANDROID_IS_PROD",
41
- description: "Dev or Prod build",
42
- optional: false,
43
- type: String)
37
+ FastlaneCore::ConfigItem.new(
38
+ key: :cypress,
39
+ env_name: 'FIV_BUILD_IONIC_ANDROID_IS_PROD',
40
+ description: 'Dev or Prod build',
41
+ optional: false,
42
+ type: String
43
+ ),
44
+ FastlaneCore::ConfigItem.new(
45
+ key: :spec,
46
+ env_name: 'FIV_BUILD_IONIC_ANDROID_IS_PROD',
47
+ description: 'Dev or Prod build',
48
+ optional: false,
49
+ type: String
50
+ )
44
51
  ]
45
52
  end
46
53
 
@@ -48,7 +55,10 @@ module Fastlane
48
55
  # Define the shared values you are going to provide
49
56
  # Example
50
57
  [
51
- ['FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE', 'A description of what this value contains']
58
+ [
59
+ 'FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE',
60
+ 'A description of what this value contains'
61
+ ]
52
62
  ]
53
63
  end
54
64
 
@@ -58,11 +68,11 @@ module Fastlane
58
68
 
59
69
  def self.authors
60
70
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
61
- ["Your GitHub/Twitter Name"]
71
+ ['Your GitHub/Twitter Name']
62
72
  end
63
73
 
64
74
  def self.is_supported?(platform)
65
- platform == :android
75
+ platform == :android
66
76
  end
67
77
  end
68
78
  end
@@ -7,31 +7,36 @@ module Fastlane
7
7
  class FivUpdateVersionAction < Action
8
8
  def self.run(params)
9
9
  # fastlane will take care of reading in the parameter and fetching the environment variable:
10
- old_version = sh "echo \"cat //*[local-name()='widget']/@version\" | xmllint --shell #{params[:pathToConfigXML]}| awk -F'[=\"]' '!/>/{print $(NF-1)}'"
10
+ old_version =
11
+ sh "echo \"cat //*[local-name()='widget']/@version\" | xmllint --shell #{
12
+ params[:pathToConfigXML]
13
+ }| awk -F'[=\"]' '!/>/{print $(NF-1)}'"
11
14
  old_version = old_version.delete!("\n")
12
15
  puts "current version: #{old_version}"
13
16
 
14
- puts "Insert new version number, current version in config.xml is '#{old_version}' (Leave empty and press enter to skip this step): "
17
+ puts "Insert new version number, current version in config.xml is '#{
18
+ old_version
19
+ }' (Leave empty and press enter to skip this step): "
15
20
  new_version_number = STDIN.gets.strip
16
21
  puts "new version: #{new_version_number}"
17
22
 
18
23
  if new_version_number.length > 0
19
- puts "take new version number"
24
+ puts 'take new version number'
20
25
  version = new_version_number
21
26
  else
22
- puts "take old version number"
27
+ puts 'take old version number'
23
28
  version = old_version
24
29
  end
25
30
 
26
31
  text = File.read(params[:pathToConfigXML])
27
32
 
28
- new_contents = text
29
- .gsub(/version="[0-9.]*"/, "version=\"#{version}\"")
30
-
31
- File.open(params[:pathToConfigXML], "w") {|file| file.puts new_contents}
33
+ new_contents = text.gsub(/version="[0-9.]*"/, "version=\"#{version}\"")
32
34
 
33
- return version
35
+ File.open(params[:pathToConfigXML], 'w') do |file|
36
+ file.puts new_contents
37
+ end
34
38
 
39
+ return version
35
40
  end
36
41
 
37
42
  #####################################################
@@ -39,27 +44,34 @@ module Fastlane
39
44
  #####################################################
40
45
 
41
46
  def self.description
42
- "A short description with <= 80 characters of what this action does"
47
+ 'A short description with <= 80 characters of what this action does'
43
48
  end
44
49
 
45
50
  def self.details
46
51
  # Optional:
47
52
  # this is your chance to provide a more detailed description of this action
48
- "You can use this action to do cool things..."
53
+ 'You can use this action to do cool things...'
49
54
  end
50
55
 
51
56
  def self.available_options
52
- # Define all options your action supports.
53
-
57
+ # Define all options your action supports.
58
+
54
59
  [
55
- FastlaneCore::ConfigItem.new(key: :pathToConfigXML,
56
- env_name: "FIV_INCREMENT_BUILD_CONFIG",
57
- description: "---",
58
- optional: false,
59
- verify_block: proc do | value |
60
- UI.user_error!("Couldnt find config.xml! Please change your path.") unless File.exist?(value)
61
- end ,
62
- type: String)
60
+ FastlaneCore::ConfigItem.new(
61
+ key: :pathToConfigXML,
62
+ env_name: 'FIV_INCREMENT_BUILD_CONFIG',
63
+ description: '---',
64
+ optional: false,
65
+ verify_block:
66
+ proc do |value|
67
+ unless File.exist?(value)
68
+ UI.user_error!(
69
+ 'Couldnt find config.xml! Please change your path.'
70
+ )
71
+ end
72
+ end,
73
+ type: String
74
+ )
63
75
  ]
64
76
  end
65
77
 
@@ -67,28 +79,31 @@ module Fastlane
67
79
  # Define the shared values you are going to provide
68
80
  # Example
69
81
  [
70
- ['FIV_UPDATE_VERSION_CUSTOM_VALUE', 'A description of what this value contains']
82
+ [
83
+ 'FIV_UPDATE_VERSION_CUSTOM_VALUE',
84
+ 'A description of what this value contains'
85
+ ]
71
86
  ]
72
87
  end
73
88
 
74
89
  def self.return_value
75
- "returns the new version specified in config.xml"
90
+ 'returns the new version specified in config.xml'
76
91
  end
77
92
 
78
93
  def self.authors
79
94
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
80
- ["Your GitHub/Twitter Name"]
95
+ ['Your GitHub/Twitter Name']
81
96
  end
82
97
 
83
98
  def self.is_supported?(platform)
84
99
  # you can do things like
85
- #
100
+ #
86
101
  # true
87
- #
102
+ #
88
103
  # platform == :ios
89
- #
104
+ #
90
105
  # [:ios, :mac].include?(platform)
91
- #
106
+ #
92
107
 
93
108
  platform == :ios
94
109
  end