fastlane-plugin-branch 0.6.0 → 0.7.0

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
- SHA1:
3
- metadata.gz: deb9d71578884158d8ac26de9f51633067221bdf
4
- data.tar.gz: 4011ed386f10314697c333a0d194480780e13281
2
+ SHA256:
3
+ metadata.gz: b9698deff778126e250ebc87f1944a952ced21c3ccdc614ba5e91683e39ae18f
4
+ data.tar.gz: ed00d7306008408acc65780eb2bcc18b27ae7db193acbfc15ed6c6c9b6296a63
5
5
  SHA512:
6
- metadata.gz: d8a42857ea57a3d76301a3f308acda6ffc49a8579ff0cfb571461e4c8afd1231d9467b6a33196d414649fe65544715dc61fa594425763124bb2d30adb9eed60f
7
- data.tar.gz: 828cfc8821fb821a6dfdcb4ece5e97b4754aceb1beead4a590cc1948b5f28f7e22f08c499b48e9238bafad11d400778a42052b58083411653b45a901d068d27d
6
+ metadata.gz: a8a15ce1709786a5d21311442c9bcc4f714fccc1b924b4707029c7844051225a00ca0dc50a5f95d118a74837b5a781e4f60a9ecf71a9f980bc63e728b9b29c79
7
+ data.tar.gz: 0d5aaf69ee0ca67d2b559074efe1da5e7f6ef67540c7f5825f0c18d120bd51c6fa4015b36c87307d1f6b649d690c400abbdc7882230c8ace24b00891cb7d5949
data/README.md CHANGED
@@ -29,53 +29,98 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
29
29
  fastlane add_plugin branch
30
30
  ```
31
31
 
32
- ## setup_branch action
32
+ <!-- The following is generated. Do not edit by hand. Run fastlane readme to -->
33
+ <!-- regenerate this section. -->
34
+ <!-- BEGIN ACTION REFERENCE -->
35
+ ### setup_branch action
36
+
37
+ ```Ruby
38
+ setup_branch
39
+ ```
33
40
 
34
41
  Integrates the Branch SDK into a native app project. This currently supports iOS only.
35
42
  It will infer the project location if there is exactly one .xcodeproj anywhere under
36
43
  the current directory, excluding any in a Pods or Carthage folder. Otherwise, specify
37
- the project location using the `--xcodeproj` option, or the CLI will prompt you for the
44
+ the project location using the `xcodeproj` option, or the CLI will prompt you for the
38
45
  location.
39
46
 
40
47
  If a Podfile or Cartfile is detected, the Branch SDK will be added to the relevant
41
48
  configuration file and the dependencies updated to include the Branch framework.
42
- This behavior may be suppressed using `--no-add-sdk`. If no Podfile or Cartfile
49
+ This behavior may be suppressed using `no_add_sdk`. If no Podfile or Cartfile
43
50
  is found, and Branch.framework is not already among the project's dependencies,
44
51
  you will be prompted for a number of choices, including setting up CocoaPods or
45
52
  Carthage for the project or directly installing the Branch.framework.
46
53
 
47
54
  By default, all supplied Universal Link domains are validated. If validation passes,
48
55
  the setup continues. If validation fails, no further action is taken. Suppress
49
- validation using `--no-validate` or force changes when validation fails using
50
- `--force`.
56
+ validation using `no_validate` or force changes when validation fails using
57
+ `force`.
51
58
 
52
59
  By default, this command will look for the first app target in the project. Test
53
- targets are not supported. To set up an extension target, supply the `--target` option.
60
+ targets are not supported. To set up an extension target, supply the `target` option.
54
61
 
55
62
  All relevant target settings are modified. The Branch keys are added to the Info.plist,
56
- along with the `branch_universal_link_domains` key for custom domains (when `--domains`
63
+ along with the `branch_universal_link_domains` key for custom domains (when `domains`
57
64
  is used). For app targets, all domains are added to the project's Associated Domains
58
65
  entitlement. An entitlements file is also added for app targets if none is found.
59
- Optionally, if `--frameworks` is specified, this command can add a list of system
66
+ Optionally, if `frameworks` is specified, this command can add a list of system
60
67
  frameworks to the target's dependencies (e.g., AdSupport, CoreSpotlight, SafariServices).
61
68
 
62
69
  A language-specific patch is applied to the AppDelegate (Swift or Objective-C).
63
- This can be suppressed using `--no-patch-source`.
70
+ This can be suppressed using `no_patch_source`.
64
71
 
65
72
  #### Prerequisites
66
73
 
67
- Before using this command, make sure to set up your app in the [Branch Dashboard](https://dashboard.branch.io). See https://docs.branch.io/pages/dashboard/integrate/ for details. To use the `setup` command, you need:
74
+ Before using this command, make sure to set up your app in the Branch Dashboard
75
+ (https://dashboard.branch.io). See https://docs.branch.io/pages/dashboard/integrate/
76
+ for details. To use the `setup` command, you need:
68
77
 
69
78
  - Branch key(s), either live, test or both
70
79
  - Domain name(s) used for Branch links
71
80
  - Location of your Xcode project (may be inferred in simple projects)
72
81
 
73
- If using the `--commit` option, `git` is required. If not using `--no-add-sdk`,
82
+ If using the `commit` option, `git` is required. If not using `no_add_sdk`,
74
83
  the `pod` or `carthage` command may be required. If not found, the CLI will
75
84
  offer to install and set up these command-line tools for you. Alternately, you can arrange
76
85
  that the relevant commands are available in your `PATH`.
77
86
 
78
- ```ruby
87
+ All parameters are optional. A live key or test key, or both is required, as well
88
+ as at least one domain. Specify `live_key`, `test_key` or both and `app_link_subdomain`,
89
+ `domains` or both. If these are not specified, this command will prompt you
90
+ for this information.
91
+
92
+ See https://github.com/BranchMetrics/branch_io_cli#setup-command for more information.
93
+
94
+
95
+ #### Options
96
+
97
+ |Fastfile key|description|Environment variable|type|default value|
98
+ |---|---|---|---|---|
99
+ |live_key|Branch live key|BRANCH_LIVE_KEY|Boolean||
100
+ |test_key|Branch test key|BRANCH_TEST_KEY|Boolean||
101
+ |domains|Comma-separated list of custom domain(s) or non-Branch domain(s)|BRANCH_DOMAINS|Boolean||
102
+ |app_link_subdomain|Branch app.link subdomain, e.g. myapp for myapp.app.link|BRANCH_APP_LINK_SUBDOMAIN|Boolean||
103
+ |uri_scheme|Custom URI scheme used in the Branch Dashboard for this app|BRANCH_URI_SCHEME|Boolean||
104
+ |setting|Use a custom build setting for the Branch key (default: Use Info.plist)|BRANCH_SETTING|Boolean||
105
+ |test_configurations|List of configurations that use the test key with a user-defined setting (default: Debug configurations)|BRANCH_TEST_CONFIGURATIONS|Boolean||
106
+ |xcodeproj|Path to an Xcode project to update|BRANCH_XCODEPROJ|Boolean||
107
+ |target|Name of a target to modify in the Xcode project|BRANCH_TARGET|Boolean||
108
+ |podfile|Path to the Podfile for the project|BRANCH_PODFILE|Boolean||
109
+ |cartfile|Path to the Cartfile for the project|BRANCH_CARTFILE|Boolean||
110
+ |carthage_command|Command to run when installing from Carthage|BRANCH_CARTHAGE_COMMAND|Boolean|update --platform ios|
111
+ |frameworks|Comma-separated list of system frameworks to add to the project|BRANCH_FRAMEWORKS|Boolean||
112
+ |pod_repo_update|Update the local podspec repo before installing|BRANCH_POD_REPO_UPDATE||true|
113
+ |validate|Validate Universal Link configuration|BRANCH_VALIDATE||true|
114
+ |force|Update project even if Universal Link validation fails|BRANCH_FORCE||false|
115
+ |add_sdk|Add the Branch framework to the project|BRANCH_ADD_SDK||true|
116
+ |patch_source|Add Branch SDK calls to the AppDelegate|BRANCH_PATCH_SOURCE||true|
117
+ |commit|Commit the results to Git if non-blank|BRANCH_COMMIT|Boolean||
118
+ |confirm|Confirm configuration before proceeding|BRANCH_CONFIRM||true|
119
+
120
+
121
+ #### Examples
122
+
123
+ ```Ruby
79
124
  setup_branch(
80
125
  live_key: "key_live_xxxx",
81
126
  test_key: "key_test_yyyy",
@@ -83,143 +128,103 @@ setup_branch(
83
128
  uri_scheme: "myscheme",
84
129
  xcodeproj: "MyIOSApp.xcodeproj"
85
130
  )
131
+
86
132
  ```
87
133
 
88
- Use the `:domains` parameter to specify custom domains, including non-Branch domains
89
- ```ruby
90
- setup_branch(
91
- live_key: "key_live_xxxx",
92
- domains: %w{example.com www.example.com}
93
- xcodeproj: "MyIOSApp.xcodeproj"
94
- )
134
+
135
+
136
+
137
+ ### validate_universal_links action
138
+
139
+ ```Ruby
140
+ validate_universal_links
95
141
  ```
96
142
 
97
- Available options:
143
+ This command validates all Universal Link domains configured in a project without making any
144
+ modification. It validates both Branch and non-Branch domains. Unlike web-based Universal
145
+ Link validators, this command operates directly on the project. It finds the bundle and
146
+ signing team identifiers in the project as well as the app's Associated Domains. It requests
147
+ the apple-app-site-association file for each domain and validates the file against the
148
+ project's settings.
98
149
 
99
- |Fastfile key|description|Environment variable|type|default value|
100
- |---|---|---|---|---|
101
- |:live_key|The Branch live key to use (:live_key or :test_key is required)|BRANCH_LIVE_KEY|string||
102
- |:test_key|The Branch test key to use (:live_key or :test_key is required)|BRANCH_TEST_KEY|string||
103
- |: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||
104
- |: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||
105
- |:uri_scheme|A URI scheme to add to the manifest|BRANCH_URI_SCHEME|string||
106
- |:xcodeproj|Path to a .xcodeproj directory to use. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_XCODEPROJ|string||
107
- |:target|Name of the target to use in the Xcode project (iOS only; optional)|BRANCH_TARGET|string||
108
- |:validate|Determines whether to validate the resulting Universal Link configuration before modifying the project|BRANCH_VALIDATE|boolean|true|
109
- |:force|Update project(s) even if Universal Link validation fails|BRANCH_FORCE_UPDATE|boolean|false|
110
- |:commit|Set to true to commit changes to Git; set to a string to commit with a custom message|BRANCH_COMMIT_CHANGES|boolean or string|false|
111
- |:frameworks|A list of system frameworks to add to the target that uses the Branch SDK (iOS only)|BRANCH_FRAMEWORKS|array|[]|
112
- |:add_sdk|Set to false to disable automatic integration of the Branch SDK|BRANCH_ADD_SDK|boolean|true|
113
- |:podfile|Path to a Podfile to update (iOS only)|BRANCH_PODFILE|string||
114
- |:patch_source|Set to false to disable automatic source-code patching|BRANCH_PATCH_SOURCE|boolean|true|
115
- |:pod_repo_update|Set to false to disable update of local podspec repo before pod install|BRANCH_POD_REPO_UPDATE|boolean|true|
116
- |:cartfile|Path to a Cartfile to update (iOS only)|BRANCH_CARTFILE|string||
117
- |:carthage_command|Command to use when installing with Carthage|BRANCH_CARTHAGE_COMMAND|string|update --platform ios|
150
+ Only app targets are supported for this command. By default, it will validate the first.
151
+ If your project has multiple app targets, specify the `target` option to validate other
152
+ targets.
118
153
 
119
- Individually, all parameters are optional, but the following conditions apply:
154
+ All parameters are optional. If `domains` is specified, the list of Universal Link domains in
155
+ the Associated Domains entitlement must exactly match this list, without regard to order. If
156
+ no `domains` are provided, validation passes if at least one Universal Link domain is
157
+ configured and passes validation, and no Universal Link domain is present that does not pass
158
+ validation.
120
159
 
121
- - :live_key or :test_key must be specified.
122
- - :app_link_subdomain or :domains must be specified.
160
+ See https://github.com/BranchMetrics/branch_io_cli#validate-command for more information.
123
161
 
124
- If these parameters are not specified, you will be prompted for them.
125
162
 
126
- This action also supports an optional Branchfile to specify configuration options.
127
- See the sample [Branchfile](./fastlane/Branchfile) in the fastlane subdirectory of this repo.
163
+ #### Options
128
164
 
129
- ## validate_universal_links action (iOS only)
165
+ |Fastfile key|description|Environment variable|type|default value|
166
+ |---|---|---|---|---|
167
+ |domains|Comma-separated list of domains to validate (Branch domains or non-Branch domains)|BRANCH_DOMAINS|Boolean|[]|
168
+ |xcodeproj|Path to an Xcode project to update|BRANCH_XCODEPROJ|Boolean||
169
+ |target|Name of a target to validate in the Xcode project|BRANCH_TARGET|Boolean||
130
170
 
131
- This action validates all Universal Link domains configured in a project without making any modification.
132
- It validates both Branch and non-Branch domains.
133
171
 
172
+ #### Examples
134
173
 
135
- ```ruby
174
+ ```Ruby
136
175
  validate_universal_links
137
176
  ```
138
177
 
139
- ```ruby
178
+ ```Ruby
140
179
  validate_universal_links(xcodeproj: "MyProject.xcodeproj")
141
180
  ```
142
181
 
143
- ```ruby
182
+ ```Ruby
144
183
  validate_universal_links(xcodeproj: "MyProject.xcodeproj", target: "MyProject")
145
184
  ```
146
185
 
147
- ```ruby
186
+ ```Ruby
148
187
  validate_universal_links(domains: %w{example.com www.example.com})
149
188
  ```
150
189
 
151
- Available options:
152
-
153
- |Fastfile key|description|Environment variable|type|default value|
154
- |---|---|---|---|---|
155
- |:xcodeproj|Path to a .xcodeproj directory to use|BRANCH_XCODEPROJ|string||
156
- |:target|Name of the target to use in the Xcode project|BRANCH_TARGET|string||
157
- |: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||
158
-
159
- All parameters are optional. Without any parameters, the action looks for a single .xcodeproj
160
- folder (with the exception of a Pods project) and reports an error if none or more than one is found.
161
- It uses the first non-test, non-extension target in that project.
162
-
163
- If the :domains parameter is not provided, validation will pass as long as there is at least
164
- one Universal Link domain configured for the target, and all Universal Link domains pass
165
- AASA validation. If the the :domains parameter is provided, the Universal Link domains in
166
- the project must also match the value of this parameter without regard to order.
167
190
 
168
- This action does not use the Branchfile.
169
191
 
170
- ## Examples
171
192
 
172
- There is an example [Fastfile](./fastlane/Fastfile) in this repo that defines a number of
173
- example lanes. Be sure to run `bundle install` before trying any of the examples.
174
193
 
175
- ### setup
194
+ ### branch_report action
176
195
 
177
- This lane sets up the BranchPluginExample project
178
- in
179
- [examples/ios/BranchPluginExample](./examples/ios/BranchPluginExample).
180
- The Xcode project uses CocoaPods and Swift.
181
-
182
- ```bash
183
- bundle exec fastlane setup
196
+ ```Ruby
197
+ branch_report
184
198
  ```
185
199
 
186
- ### setup_and_commit
187
-
188
- This lane sets up the BranchPluginExample projects and also commits the results to git.
200
+ _Work in progress_
189
201
 
190
- ```bash
191
- bundle exec fastlane setup_and_commit
192
- ```
202
+ This command optionally cleans and then builds a workspace or project, generating a verbose
203
+ report with additional diagnostic information suitable for opening a support ticket.
193
204
 
194
- ### setup_objc
195
205
 
196
- This lane sets up the BranchPluginExampleObjc project
197
- in [examples/ios/BranchPluginExampleObjc](./examples/ios/BranchPluginExampleObjc).
198
- The project uses CocoaPods and Objective-C.
206
+ #### Options
199
207
 
200
- ```bash
201
- bundle exec fastlane setup_objc
202
- ```
203
-
204
- ### setup_carthage
205
-
206
- This lane sets up the BranchPluginExampleCarthage project
207
- in [examples/ios/BranchPluginExampleCarthage](./examples/ios/BranchPluginExampleCarthage).
208
- The project uses Carthage and Swift.
208
+ |Fastfile key|description|Environment variable|type|default value|
209
+ |---|---|---|---|---|
210
+ |workspace|Path to an Xcode workspace|BRANCH_WORKSPACE|Boolean||
211
+ |xcodeproj|Path to an Xcode project|BRANCH_XCODEPROJ|Boolean||
212
+ |scheme|A scheme from the project or workspace to build|BRANCH_SCHEME|Boolean||
213
+ |target|A target to build|BRANCH_TARGET|Boolean||
214
+ |configuration|The build configuration to use (default: Scheme-dependent)|BRANCH_CONFIGURATION|Boolean||
215
+ |sdk|Passed as -sdk to xcodebuild|BRANCH_SDK|Boolean|iphonesimulator|
216
+ |podfile|Path to the Podfile for the project|BRANCH_PODFILE|Boolean||
217
+ |cartfile|Path to the Cartfile for the project|BRANCH_CARTFILE|Boolean||
218
+ |clean|Clean before attempting to build|BRANCH_CLEAN||true|
219
+ |header_only|Write a report header to standard output and exit|BRANCH_HEADER_ONLY||false|
220
+ |pod_repo_update|Update the local podspec repo before installing|BRANCH_POD_REPO_UPDATE||true|
221
+ |out|Report output path|BRANCH_REPORT_PATH|Boolean|./report.txt|
209
222
 
210
- ```bash
211
- bundle exec fastlane setup_carthage
212
- ```
213
223
 
214
- ### validate
215
224
 
216
- This lane validates the Universal Link configuration for the BranchPluginExample
217
- project in [examples/ios/BranchPluginExample](./examples/ios/BranchPluginExample).
218
225
 
219
- ```bash
220
- bundle exec fastlane validate
221
- ```
222
226
 
227
+ <!-- END ACTION REFERENCE -->
223
228
 
224
229
  ## Run tests for this plugin
225
230
 
@@ -0,0 +1,52 @@
1
+ require "branch_io_cli"
2
+ require "fastlane/plugin/branch/config_item"
3
+ require "fastlane/plugin/branch/fastlane_format"
4
+
5
+ include Fastlane::Branch::FastlaneDescriptionFormat
6
+
7
+ module Fastlane
8
+ module Actions
9
+ class BranchReportAction < Action
10
+ def self.run(params)
11
+ config = BranchIOCLI::Configuration::ReportConfiguration.wrapper params, false
12
+ BranchIOCLI::Commands::ReportCommand.new(config).run!
13
+ rescue StandardError => e
14
+ UI.user_error! "Error in BranchReportAction: #{e.message}\n#{e.backtrace}"
15
+ end
16
+
17
+ def self.description
18
+ "TODO"
19
+ end
20
+
21
+ def self.authors
22
+ [
23
+ "Branch <integrations@branch.io>",
24
+ "Jimmy Dee <jgvdthree@gmail.com>"
25
+ ]
26
+ end
27
+
28
+ def self.details
29
+ render :report_description
30
+ end
31
+
32
+ def self.example_code
33
+ [
34
+ ]
35
+ end
36
+
37
+ def self.available_options
38
+ BranchIOCLI::Configuration::ReportConfiguration.available_options.map do |option|
39
+ FastlaneCore::ConfigItem.from_branch_option(option)
40
+ end
41
+ end
42
+
43
+ def self.is_supported?(platform)
44
+ platform == :ios
45
+ end
46
+
47
+ def self.category
48
+ :project
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,18 +1,27 @@
1
1
  require "branch_io_cli"
2
+ require "fastlane/plugin/branch/config_item"
3
+ require "fastlane/plugin/branch/fastlane_format"
4
+
5
+ include Fastlane::Branch::FastlaneDescriptionFormat
2
6
 
3
7
  module Fastlane
4
8
  module Actions
5
9
  class SetupBranchAction < Action
6
10
  def self.run(params)
7
11
  params.load_configuration_file "Branchfile"
8
- options = Helper::BranchOptions.new params
9
- BranchIOCLI::Commands::SetupCommand.new(options).run!
12
+ # second arg false: Don't add default values or env. vars. Let Fastlane
13
+ # handle that. This is necessary to work with the Branchfile.
14
+ config = BranchIOCLI::Configuration::SetupConfiguration.wrapper params, false
15
+ BranchIOCLI::Commands::SetupCommand.new(config).run!
10
16
  rescue StandardError => e
11
17
  UI.user_error! "Error in SetupBranchAction: #{e.message}\n#{e.backtrace}"
12
18
  end
13
19
 
14
20
  def self.description
15
- "Adds Branch keys, custom URI schemes and domains to iOS and Android projects."
21
+ "This action automatically configures Xcode projects that use the Branch SDK " \
22
+ "for Universal Links and custom URI handling. It modifies Xcode project settings and " \
23
+ "entitlements as well as Info.plist files. It also validates the Universal Link " \
24
+ "configuration for Xcode projects."
16
25
  end
17
26
 
18
27
  def self.authors
@@ -23,121 +32,27 @@ module Fastlane
23
32
  end
24
33
 
25
34
  def self.details
26
- "This action automatically configures Xcode projects that use the Branch SDK " \
27
- "for Universal Links and custom URI handling. It modifies Xcode project settings and " \
28
- "entitlements as well as Info.plist files. It also validates the Universal Link " \
29
- "configuration for Xcode projects."
35
+ render :setup_description
30
36
  end
31
37
 
32
38
  def self.example_code
33
39
  [
34
40
  <<-EOF
35
- setup_branch(
36
- live_key: "key_live_xxxx",
37
- test_key: "key_test_yyyy",
38
- app_link_subdomain: "myapp",
39
- uri_scheme: "myscheme",
40
- xcodeproj: "MyIOSApp.xcodeproj"
41
- )
41
+ setup_branch(
42
+ live_key: "key_live_xxxx",
43
+ test_key: "key_test_yyyy",
44
+ app_link_subdomain: "myapp",
45
+ uri_scheme: "myscheme",
46
+ xcodeproj: "MyIOSApp.xcodeproj"
47
+ )
42
48
  EOF
43
49
  ]
44
50
  end
45
51
 
46
52
  def self.available_options
47
- [
48
- FastlaneCore::ConfigItem.new(key: :xcodeproj,
49
- env_name: "BRANCH_XCODEPROJ",
50
- description: "Path to an Xcode project to modify",
51
- optional: true,
52
- type: String),
53
- FastlaneCore::ConfigItem.new(key: :live_key,
54
- env_name: "BRANCH_LIVE_KEY",
55
- description: "The Branch live key for your app",
56
- optional: true,
57
- type: String),
58
- FastlaneCore::ConfigItem.new(key: :test_key,
59
- env_name: "BRANCH_TEST_KEY",
60
- description: "The Branch test key for your app",
61
- optional: true,
62
- type: String),
63
- FastlaneCore::ConfigItem.new(key: :domains,
64
- env_name: "BRANCH_DOMAINS",
65
- description: "Branch (and/or non-Branch) Universal Link/App Link domains to add (comma-separated list or array)",
66
- optional: true,
67
- is_string: false),
68
- FastlaneCore::ConfigItem.new(key: :app_link_subdomain,
69
- env_name: "BRANCH_APP_LINK_SUBDOMAIN",
70
- description: "app.link subdomain",
71
- optional: true,
72
- type: String),
73
- FastlaneCore::ConfigItem.new(key: :uri_scheme,
74
- env_name: "BRANCH_URI_SCHEME",
75
- description: "Custom URI scheme used with Branch",
76
- optional: true,
77
- type: String),
78
- FastlaneCore::ConfigItem.new(key: :target,
79
- env_name: "BRANCH_TARGET",
80
- description: "Name of the target in the Xcode project to modify (iOS only)",
81
- optional: true,
82
- type: String),
83
- FastlaneCore::ConfigItem.new(key: :validate,
84
- env_name: "BRANCH_VALIDATE",
85
- description: "Determines whether to validate the resulting Universal Link configuration before modifying the project",
86
- default_value: true,
87
- is_string: false),
88
- FastlaneCore::ConfigItem.new(key: :force,
89
- env_name: "BRANCH_FORCE_UPDATE",
90
- description: "Update project(s) even if Universal Link validation fails",
91
- optional: true,
92
- default_value: false,
93
- is_string: false),
94
- FastlaneCore::ConfigItem.new(key: :commit,
95
- env_name: "BRANCH_COMMIT_CHANGES",
96
- description: "Set to true to commit changes to Git; set to a string to commit with a custom message",
97
- optional: true,
98
- default_value: false,
99
- is_string: false),
100
- FastlaneCore::ConfigItem.new(key: :frameworks,
101
- env_name: "BRANCH_FRAMEWORKS",
102
- description: "A list of system frameworks to add to the target that uses the Branch SDK (iOS only)",
103
- optional: true,
104
- default_value: [],
105
- type: Array),
106
- FastlaneCore::ConfigItem.new(key: :add_sdk,
107
- env_name: "BRANCH_ADD_SDK",
108
- description: "Set to false to disable automatic integration of the Branch SDK",
109
- optional: true,
110
- default_value: true,
111
- is_string: false),
112
- FastlaneCore::ConfigItem.new(key: :podfile,
113
- env_name: "BRANCH_PODFILE",
114
- description: "Path to a Podfile to update (iOS only)",
115
- optional: true,
116
- type: String),
117
- FastlaneCore::ConfigItem.new(key: :patch_source,
118
- env_name: "BRANCH_PATCH_SOURCE",
119
- description: "Set to false to disable automatic source-code patching",
120
- optional: true,
121
- default_value: true,
122
- is_string: false),
123
- FastlaneCore::ConfigItem.new(key: :pod_repo_update,
124
- env_name: "BRANCH_POD_REPO_UPDATE",
125
- description: "Set to false to disable update of local podspec repo before pod install",
126
- optional: true,
127
- default_value: true,
128
- is_string: false),
129
- FastlaneCore::ConfigItem.new(key: :cartfile,
130
- env_name: "BRANCH_CARTFILE",
131
- description: "Path to a Cartfile to update (iOS only)",
132
- optional: true,
133
- type: String),
134
- FastlaneCore::ConfigItem.new(key: :carthage_command,
135
- env_name: "BRANCH_CARTHAGE_COMMAND",
136
- description: "Command to use when installing with Carthage",
137
- optional: true,
138
- default_value: "update --platform ios",
139
- type: String)
140
- ]
53
+ BranchIOCLI::Configuration::SetupConfiguration.available_options.map do |option|
54
+ FastlaneCore::ConfigItem.from_branch_option(option)
55
+ end
141
56
  end
142
57
 
143
58
  def self.is_supported?(platform)
@@ -1,11 +1,15 @@
1
1
  require "branch_io_cli"
2
+ require "fastlane/plugin/branch/config_item"
3
+ require "fastlane/plugin/branch/fastlane_format"
4
+
5
+ include Fastlane::Branch::FastlaneDescriptionFormat
2
6
 
3
7
  module Fastlane
4
8
  module Actions
5
9
  class ValidateUniversalLinksAction < Action
6
10
  def self.run(params)
7
- options = Helper::BranchOptions.new params
8
- BranchIOCLI::Commands::ValidateCommand.new(options).run!
11
+ config = BranchIOCLI::Configuration::ValidateConfiguration.wrapper params, false
12
+ BranchIOCLI::Commands::ValidateCommand.new(config).run! == 0
9
13
  rescue StandardError => e
10
14
  UI.user_error! "Error in ValidateUniversalLinksAction: #{e.message}\n#{e.backtrace}"
11
15
  false
@@ -23,50 +27,26 @@ module Fastlane
23
27
  end
24
28
 
25
29
  def self.details
26
- "This action validates all the Universal Link domains found in an Xcode project's entitlements " \
27
- "file by ensuring that the development team and bundle identifier combination is found in the " \
28
- "domain's apple-app-site-association file."
30
+ render :validate_description
29
31
  end
30
32
 
31
33
  def self.example_code
32
34
  [
33
- <<-EOF
34
- validate_universal_links
35
- EOF,
36
- <<-EOF
37
- validate_universal_links(xcodeproj: "MyProject.xcodeproj")
38
- EOF,
39
- <<-EOF
40
- validate_universal_links(xcodeproj: "MyProject.xcodeproj", target: "MyProject")
41
- EOF,
42
- <<-EOF
43
- validate_universal_links(domains: %w{example.com www.example.com})
44
- EOF
35
+ "validate_universal_links",
36
+ %{validate_universal_links(xcodeproj: "MyProject.xcodeproj")},
37
+ %{validate_universal_links(xcodeproj: "MyProject.xcodeproj", target: "MyProject")},
38
+ %{validate_universal_links(domains: %w{example.com www.example.com})}
45
39
  ]
46
40
  end
47
41
 
48
42
  def self.available_options
49
- [
50
- FastlaneCore::ConfigItem.new(key: :xcodeproj,
51
- env_name: "BRANCH_XCODEPROJ",
52
- description: "Path to an Xcode project to validate",
53
- optional: true,
54
- type: String),
55
- FastlaneCore::ConfigItem.new(key: :target,
56
- env_name: "BRANCH_TARGET",
57
- description: "Name of the target in the Xcode project to validate",
58
- optional: true,
59
- type: String),
60
- FastlaneCore::ConfigItem.new(key: :domains,
61
- env_name: "BRANCH_DOMAINS",
62
- description: "Branch (and/or non-Branch) Universal Link/App Link domains expected to be present in project (comma-separated list or array)",
63
- optional: true,
64
- is_string: false)
65
- ]
43
+ BranchIOCLI::Configuration::ValidateConfiguration.available_options.map do |option|
44
+ FastlaneCore::ConfigItem.from_branch_option(option)
45
+ end
66
46
  end
67
47
 
68
48
  def self.return_value
69
- "Returns true for a valid configuration, false otherwise."
49
+ BranchIOCLI::Configuration::ValidateConfiguration.return_value
70
50
  end
71
51
 
72
52
  def self.is_supported?(platform)
@@ -0,0 +1,15 @@
1
+ module FastlaneCore
2
+ class ConfigItem
3
+ class << self
4
+ def from_branch_option(option)
5
+ new(
6
+ key: option.name,
7
+ env_name: option.env_name,
8
+ description: option.description,
9
+ default_value: option.default_value,
10
+ type: option.type
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,42 @@
1
+ require "branch_io_cli/format"
2
+
3
+ module Fastlane
4
+ module Branch
5
+ module FastlaneMarkdownFormat
6
+ include BranchIOCLI::Format::MarkdownFormat
7
+
8
+ def local_render(template)
9
+ path = File.expand_path(File.join("..", "..", "..", "..", "..", "assets", "templates", "#{template}.erb"), __FILE__)
10
+ ERB.new(File.read(path)).result binding
11
+ end
12
+
13
+ def table_option(option)
14
+ "|#{option.name}|#{option.description}|#{option.env_name}|#{option.type ? 'Boolean' : option.type}|#{option.default_value}|"
15
+ end
16
+
17
+ def option(opt)
18
+ highlight opt.to_s
19
+ end
20
+ end
21
+
22
+ module FastlaneDescriptionFormat
23
+ include BranchIOCLI::Format
24
+
25
+ def option(opt)
26
+ highlight opt.to_s
27
+ end
28
+
29
+ def highlight(text)
30
+ text
31
+ end
32
+
33
+ def italics(text)
34
+ text
35
+ end
36
+
37
+ def header(text, level = 1)
38
+ "#{text}: "
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Branch
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Branch
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-01 00:00:00.000000000 Z
12
+ date: 2017-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: branch_io_cli
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 0.12.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 0.12.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: pry
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -162,9 +162,11 @@ files:
162
162
  - LICENSE
163
163
  - README.md
164
164
  - lib/fastlane/plugin/branch.rb
165
+ - lib/fastlane/plugin/branch/actions/branch_report_action.rb
165
166
  - lib/fastlane/plugin/branch/actions/setup_branch_action.rb
166
167
  - lib/fastlane/plugin/branch/actions/validate_universal_links_action.rb
167
- - lib/fastlane/plugin/branch/helper/branch_options.rb
168
+ - lib/fastlane/plugin/branch/config_item.rb
169
+ - lib/fastlane/plugin/branch/fastlane_format.rb
168
170
  - lib/fastlane/plugin/branch/version.rb
169
171
  homepage: https://github.com/BranchMetrics/fastlane-plugin-branch
170
172
  licenses:
@@ -186,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
188
  version: '0'
187
189
  requirements: []
188
190
  rubyforge_project:
189
- rubygems_version: 2.6.14
191
+ rubygems_version: 2.7.2
190
192
  signing_key:
191
193
  specification_version: 4
192
194
  summary: Adds Branch keys, custom URI schemes and domains to iOS and Android projects.
@@ -1,16 +0,0 @@
1
- module Fastlane
2
- module Helper
3
- class BranchOptions
4
- attr_reader :params
5
-
6
- # :param: params [FastlaneCore::Configuration] Params from an action
7
- def initialize(params)
8
- @params = params
9
- end
10
-
11
- def method_missing(method_sym, *arguments, &block)
12
- return params[method_sym]
13
- end
14
- end
15
- end
16
- end