fastlane 2.132.0.beta.20190920200012 → 2.132.0.beta.20190921200021

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3247e4c5b3c80c88baa6b716a4f7650dc61a4e8a
4
- data.tar.gz: 001e2c7f0b92be7c892bf4e5647b0a6071a07f09
3
+ metadata.gz: a9a1370c917620f6b6c1343a7c77d36be8f56b48
4
+ data.tar.gz: 6b12512f2c5a89b7a44f7d488f9a76924603ebcf
5
5
  SHA512:
6
- metadata.gz: 4121debd22ce939ebcafcde83bb556ed5f85ec7bbc801013fd3eb49ec0980253e94f8c40f04654d802bdafb9ecd123b21cbd7e4cfb20726f97866308d9e6ab21
7
- data.tar.gz: d4f8079fb3a28209abc6ba9eb8c122d04b8430aff9bbb62558c5244003420fe59958a78c6d4e76aaaee2605f73f253d75924a917535b93fc2da4485cec9d9610
6
+ metadata.gz: cb7b0fbdcfc4223bedb37c6cebba6e6df517f200bcf26089e2ce7af8a470975ad8ff7b9465738b683c5051a2cf6b3711dbcdd08a72da240c2169d256629c12b3
7
+ data.tar.gz: 017fdafd04e914ffc94f1572a30bd2b7c0f0c8077de032f80f8d7697e9fddb491bce20d4e0f14e6767280bb12925235720afc5fa6bd8d436ee5a45f47c21b001
@@ -0,0 +1,58 @@
1
+ module Fastlane
2
+ module Actions
3
+ class EnsureEnvVarsAction < Action
4
+ def self.run(params)
5
+ variables = params[:env_vars]
6
+
7
+ variables.each do |variable|
8
+ next unless ENV[variable].to_s.strip.empty?
9
+
10
+ UI.user_error!("Missing environment variable '#{variable}'")
11
+ end
12
+
13
+ is_one = variables.length == 1
14
+
15
+ UI.success("Environment variable#{is_one ? '' : 's'} '#{variables.join('\', \'')}' #{is_one ? 'is' : 'are'} set!")
16
+ end
17
+
18
+ def self.description
19
+ 'Raises an exception if the specified env vars are not set'
20
+ end
21
+
22
+ def self.details
23
+ 'This action will check if some environment variables are set.'
24
+ end
25
+
26
+ def self.available_options
27
+ [
28
+ FastlaneCore::ConfigItem.new(key: :env_vars,
29
+ description: 'The environment variables names that should be checked',
30
+ type: Array,
31
+ verify_block: proc do |value|
32
+ UI.user_error!('Specify at least one environment variable name') if value.empty?
33
+ end)
34
+ ]
35
+ end
36
+
37
+ def self.authors
38
+ ['revolter']
39
+ end
40
+
41
+ def self.example_code
42
+ [
43
+ 'ensure_env_vars(
44
+ env_vars: [\'GITHUB_USER_NAME\', \'GITHUB_API_TOKEN\']
45
+ )'
46
+ ]
47
+ end
48
+
49
+ def self.category
50
+ :misc
51
+ end
52
+
53
+ def self.is_supported?(platform)
54
+ true
55
+ end
56
+ end
57
+ end
58
+ end
@@ -11,15 +11,26 @@ module Fastlane
11
11
  require 'uri'
12
12
  require 'base64'
13
13
 
14
- UI.message("Parameter App name: #{params[:app_name]}")
14
+ app_id = params[:app_id].to_s.strip
15
15
  auth_token = params[:auth_token]
16
- app_name = params[:app_name]
16
+ app_name = params[:app_name].to_s
17
17
  apns_p12_password = params[:apns_p12_password]
18
18
  android_token = params[:android_token]
19
19
  android_gcm_sender_id = params[:android_gcm_sender_id]
20
20
 
21
+ has_app_id = !app_id.empty?
22
+ has_app_name = !app_name.empty?
23
+
24
+ is_update = has_app_id
25
+
26
+ UI.user_error!('Please specify the `app_id` or the `app_name` parameters!') if !has_app_id && !has_app_name
27
+
28
+ UI.message("Parameter App ID: #{app_id}") if has_app_id
29
+ UI.message("Parameter App name: #{app_name}") if has_app_name
30
+
21
31
  payload = {}
22
- payload['name'] = app_name
32
+
33
+ payload['name'] = app_name if has_app_name
23
34
 
24
35
  unless params[:apns_p12].nil?
25
36
  data = File.read(params[:apns_p12])
@@ -33,61 +44,70 @@ module Fastlane
33
44
  payload["gcm_key"] = android_token unless android_token.nil?
34
45
  payload["android_gcm_sender_id"] = android_gcm_sender_id unless android_gcm_sender_id.nil?
35
46
 
36
- # here's the actual lifting - POST to OneSignal
47
+ # here's the actual lifting - POST or PUT to OneSignal
37
48
 
38
49
  json_headers = { 'Content-Type' => 'application/json', 'Authorization' => "Basic #{auth_token}" }
39
- uri = URI.parse('https://onesignal.com/api/v1/apps')
50
+ url = +'https://onesignal.com/api/v1/apps'
51
+ url << '/' + app_id if is_update
52
+ uri = URI.parse(url)
40
53
  http = Net::HTTP.new(uri.host, uri.port)
41
54
  http.use_ssl = true
42
- response = http.post(uri.path, payload.to_json, json_headers)
55
+
56
+ if is_update
57
+ response = http.put(uri.path, payload.to_json, json_headers)
58
+ else
59
+ response = http.post(uri.path, payload.to_json, json_headers)
60
+ end
61
+
43
62
  response_body = JSON.parse(response.body)
44
63
 
45
64
  Actions.lane_context[SharedValues::ONE_SIGNAL_APP_ID] = response_body["id"]
46
65
  Actions.lane_context[SharedValues::ONE_SIGNAL_APP_AUTH_KEY] = response_body["basic_auth_key"]
47
66
 
48
- check_response_code(response)
67
+ check_response_code(response, is_update)
49
68
  end
50
69
 
51
- def self.check_response_code(response)
70
+ def self.check_response_code(response, is_update)
52
71
  case response.code.to_i
53
72
  when 200, 204
54
- puts("Successfully created new OneSignal app".green)
73
+ UI.success("Successfully #{is_update ? 'updated' : 'created new'} OneSignal app")
55
74
  else
56
75
  UI.user_error!("Unexpected #{response.code} with response: #{response.body}")
57
76
  end
58
77
  end
59
78
 
60
79
  def self.description
61
- "Create a new [OneSignal](https://onesignal.com/) application"
80
+ "Create or update a new [OneSignal](https://onesignal.com/) application"
62
81
  end
63
82
 
64
83
  def self.details
65
- "You can use this action to automatically create a OneSignal application. You can also upload a `.p12` with password, a GCM key, or both."
84
+ "You can use this action to automatically create or update a OneSignal application. You can also upload a `.p12` with password, a GCM key, or both."
66
85
  end
67
86
 
68
87
  def self.available_options
69
88
  [
70
- FastlaneCore::ConfigItem.new(key: :auth_token,
71
- env_name: "ONE_SIGNAL_AUTH_KEY",
72
- sensitive: true,
73
- description: "OneSignal Authorization Key",
74
- verify_block: proc do |value|
75
- unless value.to_s.length > 0
76
- UI.error("Please add 'ENV[\"ONE_SIGNAL_AUTH_KEY\"] = \"your token\"' to your Fastfile's `before_all` section.")
77
- UI.user_error!("No ONE_SIGNAL_AUTH_KEY given.")
78
- end
79
- end),
89
+ FastlaneCore::ConfigItem.new(key: :app_id,
90
+ env_name: "ONE_SIGNAL_APP_ID",
91
+ sensitive: true,
92
+ description: "OneSignal App ID. Setting this updates an existing app",
93
+ optional: true),
80
94
 
81
- FastlaneCore::ConfigItem.new(key: :app_name,
82
- env_name: "ONE_SIGNAL_APP_NAME",
83
- description: "OneSignal App Name",
95
+ FastlaneCore::ConfigItem.new(key: :auth_token,
96
+ env_name: "ONE_SIGNAL_AUTH_KEY",
97
+ sensitive: true,
98
+ description: "OneSignal Authorization Key",
84
99
  verify_block: proc do |value|
85
- unless value.to_s.length > 0
86
- UI.error("Please add 'ENV[\"ONE_SIGNAL_APP_NAME\"] = \"Your app name\"' to your Fastfile's `before_all` section.")
87
- UI.user_error!("No ONE_SIGNAL_APP_NAME given.")
100
+ if value.to_s.empty?
101
+ UI.error("Please add 'ENV[\"ONE_SIGNAL_AUTH_KEY\"] = \"your token\"' to your Fastfile's `before_all` section.")
102
+ UI.user_error!("No ONE_SIGNAL_AUTH_KEY given.")
88
103
  end
89
104
  end),
90
105
 
106
+ FastlaneCore::ConfigItem.new(key: :app_name,
107
+ env_name: "ONE_SIGNAL_APP_NAME",
108
+ description: "OneSignal App Name. This is required when creating an app (in other words, when `:app_id` is not set, and optional when updating an app",
109
+ optional: true),
110
+
91
111
  FastlaneCore::ConfigItem.new(key: :android_token,
92
112
  env_name: "ANDROID_TOKEN",
93
113
  description: "ANDROID GCM KEY",
@@ -121,8 +141,8 @@ module Fastlane
121
141
 
122
142
  def self.output
123
143
  [
124
- ['ONE_SIGNAL_APP_ID', 'The OneSignal app ID of the newly created app'],
125
- ['ONE_SIGNAL_APP_AUTH_KEY', 'The auth token for the newly created OneSignal app']
144
+ ['ONE_SIGNAL_APP_ID', 'The app ID of the newly created or updated app'],
145
+ ['ONE_SIGNAL_APP_AUTH_KEY', 'The auth token for the newly created or updated app']
126
146
  ]
127
147
  end
128
148
 
@@ -144,6 +164,16 @@ module Fastlane
144
164
  apns_p12: "Path to Apple .p12 file (optional)",
145
165
  apns_p12_password: "Password for .p12 file (optional)",
146
166
  apns_env: "production/sandbox (defaults to production)"
167
+ )',
168
+ 'onesignal(
169
+ app_id: "Your OneSignal App ID",
170
+ auth_token: "Your OneSignal Auth Token",
171
+ app_name: "New Name for OneSignal App",
172
+ android_token: "Your Android GCM key (optional)",
173
+ android_gcm_sender_id: "Your Android GCM Sender ID (optional)",
174
+ apns_p12: "Path to Apple .p12 file (optional)",
175
+ apns_p12_password: "Password for .p12 file (optional)",
176
+ apns_env: "production/sandbox (defaults to production)"
147
177
  )'
148
178
  ]
149
179
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.132.0.beta.20190920200012'.freeze
2
+ VERSION = '2.132.0.beta.20190921200021'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.132.0.beta.20190920200012
4
+ version: 2.132.0.beta.20190921200021
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew McBurney
@@ -27,7 +27,7 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2019-09-20 00:00:00.000000000 Z
30
+ date: 2019-09-21 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: slack-notifier
@@ -1060,6 +1060,7 @@ files:
1060
1060
  - fastlane/lib/fastlane/actions/dsym_zip.rb
1061
1061
  - fastlane/lib/fastlane/actions/echo.rb
1062
1062
  - fastlane/lib/fastlane/actions/ensure_bundle_exec.rb
1063
+ - fastlane/lib/fastlane/actions/ensure_env_vars.rb
1063
1064
  - fastlane/lib/fastlane/actions/ensure_git_branch.rb
1064
1065
  - fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
1065
1066
  - fastlane/lib/fastlane/actions/ensure_no_debug_code.rb
@@ -1746,24 +1747,24 @@ metadata:
1746
1747
  post_install_message:
1747
1748
  rdoc_options: []
1748
1749
  require_paths:
1749
- - frameit/lib
1750
- - sigh/lib
1751
- - spaceship/lib
1752
- - snapshot/lib
1753
1750
  - scan/lib
1754
- - screengrab/lib
1755
- - pilot/lib
1756
- - pem/lib
1751
+ - deliver/lib
1757
1752
  - fastlane_core/lib
1753
+ - spaceship/lib
1754
+ - produce/lib
1755
+ - fastlane/lib
1758
1756
  - gym/lib
1757
+ - match/lib
1758
+ - sigh/lib
1759
1759
  - credentials_manager/lib
1760
- - precheck/lib
1761
- - fastlane/lib
1762
1760
  - cert/lib
1763
- - deliver/lib
1764
- - produce/lib
1761
+ - frameit/lib
1762
+ - pem/lib
1765
1763
  - supply/lib
1766
- - match/lib
1764
+ - screengrab/lib
1765
+ - pilot/lib
1766
+ - precheck/lib
1767
+ - snapshot/lib
1767
1768
  required_ruby_version: !ruby/object:Gem::Requirement
1768
1769
  requirements:
1769
1770
  - - ">="