fastlane-plugin-aws_sns 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +5 -1
- data/lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb +65 -12
- data/lib/fastlane/plugin/aws_sns/version.rb +1 -1
- metadata +14 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6351c19e2e89f7ec0eea828700d498ca257039d9daf43e3bc57bbe62e02436d6
|
4
|
+
data.tar.gz: 6f86d72e9b70ade835f3633a9f60a1004b0e26ae3ba3c8295f2b174c72d77b54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e3b9f85b2b69d528cd8ac2be15caa9bdc437904630350897e9e6cf006bf5e1e2bbf6f2178edd7e433c699b0f7ed73faaa0474227df74c81ad61750a971f3e4f
|
7
|
+
data.tar.gz: b5a6d85880e49188d181fd2fff16b3106d6690dab69bde9ad372d479eadb503a70a482a270b2bab3d3b7bcb8c2ea200d96830bb07d3661766aa7064ca4764b93
|
data/README.md
CHANGED
@@ -31,6 +31,8 @@ aws_sns(
|
|
31
31
|
|
32
32
|
# Optional private key password
|
33
33
|
# platform_apns_private_key_password: 'joshissupercool'
|
34
|
+
# Optional: updating certificate if platform_name already exists
|
35
|
+
# update_if_exist: true
|
34
36
|
)
|
35
37
|
```
|
36
38
|
|
@@ -40,6 +42,8 @@ aws_sns(
|
|
40
42
|
platform: 'GCM',
|
41
43
|
platform_name: 'your_awesome_android_app',
|
42
44
|
platform_gcm_api_key: 'your_gcm_api_key'
|
45
|
+
# Optional: updating key if platform_name already exists
|
46
|
+
# update_if_exist: true
|
43
47
|
)
|
44
48
|
```
|
45
49
|
|
@@ -86,7 +90,7 @@ For more information about how the `fastlane` plugin system works, check out the
|
|
86
90
|
|
87
91
|
## Author
|
88
92
|
|
89
|
-
Josh Holtz,
|
93
|
+
Josh Holtz, me@joshholtz.com, [@joshdholtz](https://twitter.com/joshdholtz)
|
90
94
|
|
91
95
|
I'm available for freelance work (Fastlane, iOS, and Android development) :muscle:
|
92
96
|
Feel free to contact me :rocket:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'aws-sdk'
|
1
|
+
require 'aws-sdk-sns'
|
2
2
|
|
3
3
|
module Fastlane
|
4
4
|
module Actions
|
@@ -15,11 +15,12 @@ module Fastlane
|
|
15
15
|
|
16
16
|
platform = params[:platform]
|
17
17
|
platform_name = params[:platform_name]
|
18
|
-
|
18
|
+
update_attributes = params[:update_if_exists]
|
19
19
|
platform_apns_private_key_path = params[:platform_apns_private_key_path]
|
20
20
|
platform_apns_private_key_password = params[:platform_apns_private_key_password]
|
21
21
|
|
22
|
-
|
22
|
+
platform_fcm_server_key = params[:platform_fcm_server_key]
|
23
|
+
platform_fcm_server_key ||= params[:platform_gcm_api_key]
|
23
24
|
|
24
25
|
UI.user_error!("No S3 access key given, pass using `access_key: 'key'`") unless access_key.to_s.length > 0
|
25
26
|
UI.user_error!("No S3 secret access key given, pass using `secret_access_key: 'secret key'`") unless secret_access_key.to_s.length > 0
|
@@ -50,9 +51,10 @@ module Fastlane
|
|
50
51
|
'PlatformCredential': p12.key.to_s,
|
51
52
|
'PlatformPrincipal': cert.to_s
|
52
53
|
}
|
53
|
-
elsif ['GCM'].include?(platform) && !
|
54
|
+
elsif ['GCM', 'FCM'].include?(platform) && !platform_fcm_server_key.nil?
|
55
|
+
platform = 'GCM'
|
54
56
|
attributes = {
|
55
|
-
'PlatformCredential':
|
57
|
+
'PlatformCredential': platform_fcm_server_key
|
56
58
|
}
|
57
59
|
end
|
58
60
|
|
@@ -61,12 +63,52 @@ module Fastlane
|
|
61
63
|
#
|
62
64
|
UI.crash!("Unable to create any attributes to create platform application") unless attributes
|
63
65
|
begin
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
|
67
|
+
arn = nil
|
68
|
+
|
69
|
+
#
|
70
|
+
# Try to find the arn for platform_name
|
71
|
+
#
|
72
|
+
if update_attributes
|
73
|
+
|
74
|
+
# Loop as long as list platform applications returns next_page or return the desired name
|
75
|
+
next_token = nil
|
76
|
+
loop do
|
77
|
+
|
78
|
+
resp = client.list_platform_applications({
|
79
|
+
next_token: next_token,
|
80
|
+
})
|
81
|
+
|
82
|
+
next_token = resp.next_token
|
83
|
+
# TODO: Must find a best search method !
|
84
|
+
platform_application = resp.platform_applications.find { |platform_application| platform_application.platform_application_arn.end_with? platform_name }
|
85
|
+
|
86
|
+
unless platform_application.nil?
|
87
|
+
arn = platform_application.platform_application_arn
|
88
|
+
break
|
89
|
+
end
|
90
|
+
break if next_token.nil?
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# Not arn? OK, we create it !
|
96
|
+
if arn.nil?
|
97
|
+
resp = client.create_platform_application({
|
98
|
+
name: platform_name,
|
99
|
+
platform: platform,
|
100
|
+
attributes: attributes,
|
101
|
+
})
|
102
|
+
arn = resp.platform_application_arn
|
103
|
+
UI.important("Created #{arn}")
|
104
|
+
else
|
105
|
+
# else, updating
|
106
|
+
client.set_platform_application_attributes({
|
107
|
+
platform_application_arn: arn,
|
108
|
+
attributes: attributes,
|
109
|
+
})
|
110
|
+
UI.important("Updated #{arn}")
|
111
|
+
end
|
70
112
|
|
71
113
|
Actions.lane_context[SharedValues::AWS_SNS_PLATFORM_APPLICATION_ARN] = arn
|
72
114
|
ENV[SharedValues::AWS_SNS_PLATFORM_APPLICATION_ARN.to_s] = arn
|
@@ -115,7 +157,7 @@ module Fastlane
|
|
115
157
|
description: "AWS Platform",
|
116
158
|
optional: false,
|
117
159
|
verify_block: proc do |value|
|
118
|
-
UI.user_error!("Invalid platform #{value}") unless ['APNS', 'APNS_SANDBOX', 'GCM'].include?(value)
|
160
|
+
UI.user_error!("Invalid platform #{value}") unless ['APNS', 'APNS_SANDBOX', 'GCM', 'FCM'].include?(value)
|
119
161
|
end),
|
120
162
|
FastlaneCore::ConfigItem.new(key: :platform_name,
|
121
163
|
env_name: "AWS_SNS_PLATFORM_NAME",
|
@@ -130,9 +172,20 @@ module Fastlane
|
|
130
172
|
description: "AWS Platform APNS Private Key Password",
|
131
173
|
optional: true,
|
132
174
|
default_value: ""),
|
175
|
+
FastlaneCore::ConfigItem.new(key: :platform_fcm_server_key,
|
176
|
+
env_name: "AWS_SNS_PLATFORM_FCM_SERVER_KEY",
|
177
|
+
description: "AWS Platform FCM SERVER KEY",
|
178
|
+
optional: true),
|
133
179
|
FastlaneCore::ConfigItem.new(key: :platform_gcm_api_key,
|
134
180
|
env_name: "AWS_SNS_PLATFORM_GCM_API_KEY",
|
135
181
|
description: "AWS Platform GCM API KEY",
|
182
|
+
deprecated: "Use :platform_fcm_server_key instead",
|
183
|
+
optional: true),
|
184
|
+
FastlaneCore::ConfigItem.new(key: :update_if_exists,
|
185
|
+
env_name: "AWS_SNS_UDPATE_IF_EXISTS",
|
186
|
+
description: "updating certificate/key if platform_name already exists",
|
187
|
+
default_value: false,
|
188
|
+
is_string: false,
|
136
189
|
optional: true)
|
137
190
|
]
|
138
191
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-aws_sns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Holtz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-sdk
|
14
|
+
name: aws-sdk-sns
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,16 +100,16 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.144.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
111
|
-
description:
|
112
|
-
email:
|
110
|
+
version: 2.144.0
|
111
|
+
description:
|
112
|
+
email: me@joshholtz.com
|
113
113
|
executables: []
|
114
114
|
extensions: []
|
115
115
|
extra_rdoc_files: []
|
@@ -120,11 +120,11 @@ files:
|
|
120
120
|
- lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb
|
121
121
|
- lib/fastlane/plugin/aws_sns/helper/aws_sns_helper.rb
|
122
122
|
- lib/fastlane/plugin/aws_sns/version.rb
|
123
|
-
homepage: https://github.com/
|
123
|
+
homepage: https://github.com/fastlane-community/fastlane-plugin-aws_sns
|
124
124
|
licenses:
|
125
125
|
- MIT
|
126
126
|
metadata: {}
|
127
|
-
post_install_message:
|
127
|
+
post_install_message:
|
128
128
|
rdoc_options: []
|
129
129
|
require_paths:
|
130
130
|
- lib
|
@@ -139,10 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
|
143
|
-
|
144
|
-
signing_key:
|
142
|
+
rubygems_version: 3.0.3
|
143
|
+
signing_key:
|
145
144
|
specification_version: 4
|
146
145
|
summary: Creates AWS SNS platform applications
|
147
146
|
test_files: []
|
148
|
-
has_rdoc:
|