fastlane-plugin-branch 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 8305f250691fbd01e191ca2133151dc6ffa22d55
4
- data.tar.gz: 953577ba927bb98740c1b41ed282487b5c23c584
3
+ metadata.gz: 119cbed9a2311d39484ec89b57f62f6553b2f2aa
4
+ data.tar.gz: 701c3ffb36e2150970c24a5b0dc4783400dc4b98
5
5
  SHA512:
6
- metadata.gz: ec225b08a24f31de602203c00c85c6f744d59df021c03f0243b977956f613890b0e69b03a8cd2d9a5fd76d8d06faa46b5e29d540f43ddd33c5e09560b494ee22
7
- data.tar.gz: 3403679f0c139b346dcc2482c1d8b6db7de412ba15be91a5e8febfd4fbe2eae2007bef7cdd3e3b0a87f5f168861ad2e86e34ca17fe99599254b75ba71e54ccbd
6
+ metadata.gz: 79161c0e1e407b9a22f28f9e2bef83ec9b2657db32773b33cb9251d6124c951c79954ca9eb80a3d675cb110085c13fcbca454533379c826eb3c5d0eb31c5e303
7
+ data.tar.gz: 10f2ee0fc9814a9bb97ef51149a21b6df2c02eab09627ce10de3817e81719beab1c1a37cb2fb0f10f9443fc0688cd9a50b0a53abe2ef024efaa2369f8cd6b150
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Jimmy Dee <jgvdthree@gmail.com>
3
+ Copyright (c) 2017 Branch Metrics, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -56,22 +56,23 @@ setup_branch(
56
56
 
57
57
  Available options:
58
58
 
59
- |Fastfile key|Environment variable|description|type|default value|
59
+ |Fastfile key|description|Environment variable|type|default value|
60
60
  |---|---|---|---|---|
61
- |:live_key|BRANCH_LIVE_KEY|The Branch live key to use (:live_key or :test_key is required)|string||
62
- |:test_key|BRANCH_TEST_KEY|The Branch test key to use (:live_key or :test_key is required)|string||
63
- |:app_link_subdomain|BRANCH_APP_LINK_SUBDOMAIN|An app.link subdomain to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|string||
64
- |:domains|BRANCH_DOMAINS|A list of domains (custom domains or Branch domains) to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|string array or comma-separated string||
65
- |:uri_scheme|BRANCH_URI_SCHEME|A URI scheme to add to the manifest (Android only)|string||
66
- |:android_project_path|BRANCH_ANDROID_PROJECT_PATH|Path to an Android project to use. Equivalent to 'android_manifest_path: "app/src/main/AndroidManifest.xml"`. Overridden by :android_manifest_path (:xcodeproj, :android_project_path or :android_manifest_path is required.)|string||
67
- |:android_manifest_path|BRANCH_ANDROID_MANIFEST_PATH|Path to an Android manifest to modify. Overrides :android_project_path. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|string||
68
- |:xcodeproj|BRANCH_XCODEPROJ|Path to a .xcodeproj directory to use. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|string||
69
- |:activity_name|BRANCH_ACTIVITY_NAME|Name of the Activity to use (Android only; optional)|string||
70
- |:target|BRANCH_TARGET|Name of the target to use in the Xcode project (iOS only; optional)|string||
71
- |:update_bundle_and_team_ids|BRANCH_UPDATE_BUNDLE_AND_TEAM_IDS|If true, changes the bundle and team identifiers in the Xcode project to match the AASA file. Mainly useful for sample apps. (iOS only)|boolean|false|
72
- |:remove_existing_domains|BRANCH_REMOVE_EXISTING_DOMAINS|If true, any domains currently configured in the Xcode project or Android manifest will be removed before adding the domains specified by the arguments. Mainly useful for sample apps.|boolean|false|
73
- |:force|BRANCH_FORCE_UPDATE|Update project(s) even if Universal Link validation fails|boolean|false|
74
- |:commit|BRANCH_COMMIT_CHANGES|Set to true to commit changes to Git; set to a string to commit with a custom message|boolean or string|false|
61
+ |:live_key|The Branch live key to use (:live_key or :test_key is required)|BRANCH_LIVE_KEY|string||
62
+ |:test_key|The Branch test key to use (:live_key or :test_key is required)|BRANCH_TEST_KEY|string||
63
+ |:app_link_subdomain|An app.link subdomain to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|BRANCH_APP_LINK_SUBDOMAIN|string||
64
+ |:domains|A list of domains (custom domains or Branch domains) to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|BRANCH_DOMAINS|array of strings or comma-separated string||
65
+ |:uri_scheme|A URI scheme to add to the manifest (Android only)|BRANCH_URI_SCHEME|string||
66
+ |:android_project_path|Path to an Android project to use. Equivalent to 'android_manifest_path: "app/src/main/AndroidManifest.xml"`. Overridden by :android_manifest_path (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_ANDROID_PROJECT_PATH|string||
67
+ |:android_manifest_path|Path to an Android manifest to modify. Overrides :android_project_path. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_ANDROID_MANIFEST_PATH|string||
68
+ |:xcodeproj|Path to a .xcodeproj directory to use. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_XCODEPROJ|string||
69
+ |:activity_name|Name of the Activity to use (Android only; optional)|BRANCH_ACTIVITY_NAME|string||
70
+ |:target|Name of the target to use in the Xcode project (iOS only; optional)|BRANCH_TARGET|string||
71
+ |:update_bundle_and_team_ids|If true, changes the bundle and team identifiers in the Xcode project to match the AASA file. Mainly useful for sample apps. (iOS only)|BRANCH_UPDATE_BUNDLE_AND_TEAM_IDS|boolean|false|
72
+ |:remove_existing_domains|If true, any domains currently configured in the Xcode project or Android manifest will be removed before adding the domains specified by the arguments. Mainly useful for sample apps.|BRANCH_REMOVE_EXISTING_DOMAINS|boolean|false|
73
+ |:validate|Determines whether to validate the resulting Universal Link configuration before modifying the project|BRANCH_VALIDATE|boolean|true|
74
+ |:force|Update project(s) even if Universal Link validation fails|BRANCH_FORCE_UPDATE|boolean|false|
75
+ |:commit|Set to true to commit changes to Git; set to a string to commit with a custom message|boolean or string|BRANCH_COMMIT_CHANGES|false|
75
76
 
76
77
  Individually, all parameters are optional, but the following conditions apply:
77
78
 
@@ -106,11 +107,11 @@ validate_universal_links(domains: %w{example.com www.example.com})
106
107
 
107
108
  Available options:
108
109
 
109
- |Fastfile key|Environment variable|description|type|default value|
110
+ |Fastfile key|description|Environment variable|type|default value|
110
111
  |---|---|---|---|---|
111
- |:xcodeproj|BRANCH_XCODEPROJ|Path to a .xcodeproj directory to use|string||
112
- |:target|BRANCH_TARGET|Name of the target to use in the Xcode project|string||
113
- |:domains|BRANCH_DOMAINS|A list of domains (custom domains or Branch domains) that must be present in the project.|string array or comma-separated string||
112
+ |:xcodeproj|Path to a .xcodeproj directory to use|BRANCH_XCODEPROJ|string||
113
+ |:target|Name of the target to use in the Xcode project|BRANCH_TARGET|string||
114
+ |:domains|A list of domains (custom domains or Branch domains) that must be present in the project.|BRANCH_DOMAINS|array of strings or comma-separated string||
114
115
 
115
116
  All parameters are optional. Without any parameters, the action looks for a single .xcodeproj
116
117
  folder (with the exception of a Pods project) and reports an error if none or more than one is found.
@@ -128,11 +129,10 @@ This action does not use the Branchfile.
128
129
  Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. To try it:
129
130
 
130
131
  ```bash
131
- bundle install
132
- bundle exec fastlane validate # The example project needs to be set up. This will fail.
133
- bundle exec fastlane update # Also validates the UL configuration.
134
- bundle exec fastlane update_and_commit # Also commit changes to Git. (git reset --hard HEAD^ to erase the last commit)
135
- bundle exec fastlane validate # Now validation will pass.
132
+ fastlane validate # The example project needs to be set up. This will fail.
133
+ fastlane update # Also validates the UL configuration.
134
+ fastlane update_and_commit # Also commit changes to Git. (git reset --hard HEAD^ to erase the last commit)
135
+ fastlane validate # Now validation will pass.
136
136
  ```
137
137
 
138
138
  ## Run tests for this plugin
@@ -33,9 +33,10 @@ module Fastlane
33
33
 
34
34
  if params[:update_bundle_and_team_ids]
35
35
  helper.update_team_and_bundle_ids_from_aasa_file xcodeproj, target, domains.first
36
- elsif helper.validate_team_and_bundle_ids_from_aasa_files xcodeproj, target, domains, params[:remove_existing_domains]
36
+ elsif params[:validate] &&
37
+ helper.validate_team_and_bundle_ids_from_aasa_files(xcodeproj, target, domains, params[:remove_existing_domains])
37
38
  UI.message "Universal Link configuration passed validation. ✅"
38
- else
39
+ elsif params[:validate]
39
40
  UI.error "Universal Link configuration failed validation."
40
41
  helper.errors.each { |error| UI.error " #{error}" }
41
42
  return unless params[:force]
@@ -99,12 +100,14 @@ module Fastlane
99
100
  def self.example_code
100
101
  [
101
102
  <<-EOF
102
- setup_branch live_key: "key_live_xxxx",
103
- test_key: "key_test_yyyy",
104
- app_link_subdomain: "myapp",
105
- uri_scheme: "myscheme", # Android only
106
- android_project_path: "MyAndroidApp", # MyAndroidApp/src/main/AndroidManifest.xml
107
- xcodeproj: "MyIOSApp.xcodeproj"
103
+ setup_branch(
104
+ live_key: "key_live_xxxx",
105
+ test_key: "key_test_yyyy",
106
+ app_link_subdomain: "myapp",
107
+ uri_scheme: "myscheme", # Android only
108
+ android_project_path: "MyAndroidApp", # MyAndroidApp/src/main/AndroidManifest.xml
109
+ xcodeproj: "MyIOSApp.xcodeproj"
110
+ )
108
111
  EOF
109
112
  ]
110
113
  end
@@ -173,6 +176,11 @@ module Fastlane
173
176
  optional: true,
174
177
  default_value: false,
175
178
  is_string: false),
179
+ FastlaneCore::ConfigItem.new(key: :validate,
180
+ env_name: "BRANCH_VALIDATE",
181
+ description: "Determines whether to validate the resulting Universal Link configuration before modifying the project",
182
+ default_value: true,
183
+ is_string: false),
176
184
  FastlaneCore::ConfigItem.new(key: :force,
177
185
  env_name: "BRANCH_FORCE_UPDATE",
178
186
  description: "Update project(s) even if Universal Link validation fails",
@@ -74,13 +74,13 @@ module Fastlane
74
74
  validate_universal_links
75
75
  EOF,
76
76
  <<-EOF
77
- validate_universal_links xcodeproj: "MyProject.xcodeproj"
77
+ validate_universal_links(xcodeproj: "MyProject.xcodeproj")
78
78
  EOF,
79
79
  <<-EOF
80
- validate_universal_links xcodeproj: "MyProject.xcodeproj", target: "MyProject"
80
+ validate_universal_links(xcodeproj: "MyProject.xcodeproj", target: "MyProject")
81
81
  EOF,
82
82
  <<-EOF
83
- validate_universal_links domains: %w{example.com www.example.com}
83
+ validate_universal_links(domains: %w{example.com www.example.com})
84
84
  EOF
85
85
  ]
86
86
  end
@@ -89,12 +89,12 @@ module Fastlane
89
89
  [
90
90
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
91
91
  env_name: "BRANCH_XCODEPROJ",
92
- description: "Path to an Xcode project to modify",
92
+ description: "Path to an Xcode project to validate",
93
93
  optional: true,
94
94
  type: String),
95
95
  FastlaneCore::ConfigItem.new(key: :target,
96
96
  env_name: "BRANCH_TARGET",
97
- description: "Name of the target in the Xcode project to modify (iOS only)",
97
+ description: "Name of the target in the Xcode project to validate",
98
98
  optional: true,
99
99
  type: String),
100
100
  FastlaneCore::ConfigItem.new(key: :domains,
@@ -173,7 +173,9 @@ module Fastlane
173
173
  def contents_of_aasa_file(domain)
174
174
  uris = [
175
175
  URI("https://#{domain}/.well-known/apple-app-site-association"),
176
- URI("https://#{domain}/apple-app-site-association")
176
+ URI("https://#{domain}/apple-app-site-association"),
177
+ URI("http://#{domain}/.well-known/apple-app-site-association"),
178
+ URI("http://#{domain}/apple-app-site-association")
177
179
  ]
178
180
 
179
181
  data = nil
@@ -197,7 +199,7 @@ module Fastlane
197
199
  end
198
200
 
199
201
  content_type = response["Content-type"]
200
- @errors << "[#{domain}] AASA Response does not contain a Content-type header" and return nil if content_type.nil?
202
+ @errors << "[#{domain}] AASA Response does not contain a Content-type header" and next if content_type.nil?
201
203
 
202
204
  case content_type
203
205
  when %r{application/pkcs7-mime}
@@ -208,6 +210,7 @@ module Fastlane
208
210
  signature.verify [http.peer_cert], cert_store, nil, OpenSSL::PKCS7::NOVERIFY
209
211
  data = signature.data
210
212
  else
213
+ @error << "[#{domain}] Unsigned AASA files must be served via HTTPS" and next if uri.scheme == "http"
211
214
  data = response.body
212
215
  end
213
216
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Branch
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Branch
7
8
  - Jimmy Dee
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2017-08-04 00:00:00.000000000 Z
12
+ date: 2017-08-05 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: plist
@@ -123,7 +124,9 @@ dependencies:
123
124
  - !ruby/object:Gem::Version
124
125
  version: 2.26.1
125
126
  description:
126
- email: jgvdthree@gmail.com
127
+ email:
128
+ - integrations@branch.io
129
+ - jgvdthree@gmail.com
127
130
  executables: []
128
131
  extensions: []
129
132
  extra_rdoc_files: []
@@ -162,5 +165,6 @@ rubygems_version: 2.6.12
162
165
  signing_key:
163
166
  specification_version: 4
164
167
  summary: Adds Branch keys, custom URI schemes and domains to iOS and Android projects.
168
+ Validates the Universal Link configuration for any Xcode project.
165
169
  test_files: []
166
170
  has_rdoc: