branch_io_cli 0.13.0.pre.1 → 0.13.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +112 -7
- data/lib/assets/completions/completion.bash +6 -1
- data/lib/assets/completions/completion.zsh +1 -1
- data/lib/assets/templates/completion.bash.erb +4 -1
- data/lib/assets/templates/completion.zsh.erb +1 -1
- data/lib/assets/templates/env_description.erb +1 -0
- data/lib/branch_io_cli.rb +9 -9
- data/lib/branch_io_cli/branch_app.rb +18 -5
- data/lib/branch_io_cli/cli.rb +1 -1
- data/lib/branch_io_cli/command.rb +5 -4
- data/lib/branch_io_cli/command/command.rb +4 -0
- data/lib/branch_io_cli/command/env_command.rb +22 -0
- data/lib/branch_io_cli/command/report_command.rb +9 -0
- data/lib/branch_io_cli/command/setup_command.rb +2 -2
- data/lib/branch_io_cli/configuration.rb +13 -10
- data/lib/branch_io_cli/configuration/configuration.rb +11 -5
- data/lib/branch_io_cli/configuration/env_configuration.rb +47 -0
- data/lib/branch_io_cli/configuration/env_options.rb +30 -0
- data/lib/branch_io_cli/configuration/environment.rb +107 -0
- data/lib/branch_io_cli/configuration/report_configuration.rb +8 -0
- data/lib/branch_io_cli/configuration/validate_configuration.rb +9 -0
- data/lib/branch_io_cli/core_ext.rb +4 -3
- data/lib/branch_io_cli/core_ext/tty_platform.rb +13 -0
- data/lib/branch_io_cli/core_ext/xcodeproj.rb +4 -4
- data/lib/branch_io_cli/format.rb +3 -3
- data/lib/branch_io_cli/helper.rb +6 -6
- data/lib/branch_io_cli/helper/branch_helper.rb +24 -10
- data/lib/branch_io_cli/helper/ios_helper.rb +15 -17
- data/lib/branch_io_cli/helper/report_helper.rb +5 -1
- data/lib/branch_io_cli/helper/tool_helper.rb +70 -31
- data/lib/branch_io_cli/rake_task.rb +2 -4
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +112 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bbc782e922e498b04f39138c04d0f2ca7ee5c1df7b275b0301765b4f96795dd
|
4
|
+
data.tar.gz: 91eaf176be8ae4ff130714918180f1fb7e6b3cea05d10938ec22b7c6973c58a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 797fa7dc2c642e125bca2da9220ef0380310ed3a08c4bcf538c7c33474faa61379eddfbee61cae20e4c2ec1388adfe2a7f4d20089d69992ca99105a7035d49c6
|
7
|
+
data.tar.gz: 7e872acd6813a7d522ffb16af73fe96eac37f6e0cf25a02ac7f5c5a257047a23e21157616ed762ce5af84ad20e4b819399396c498be0bf4ebf6af689f378945e
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017 Branch Metrics, Inc.
|
3
|
+
Copyright (c) 2017-18 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
@@ -7,10 +7,6 @@ This is a command-line tool to integrate the Branch SDK into mobile app projects
|
|
7
7
|
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/BranchMetrics/branch_io_cli/blob/master/LICENSE)
|
8
8
|
[![CircleCI](https://img.shields.io/circleci/project/github/BranchMetrics/branch_io_cli.svg)](https://circleci.com/gh/BranchMetrics/branch_io_cli)
|
9
9
|
|
10
|
-
## Preliminary release
|
11
|
-
|
12
|
-
This is a preliminary release of this gem. Please report any problems by opening issues in this repo.
|
13
|
-
|
14
10
|
### Using Fastlane?
|
15
11
|
|
16
12
|
See also the [Branch Fastlane plugin](https://github.com/BranchMetrics/fastlane-plugin-branch), which offers
|
@@ -20,12 +16,25 @@ the same support via Fastlane.
|
|
20
16
|
|
21
17
|
## Getting started
|
22
18
|
|
19
|
+
To install a prerelease version of `0.13`:
|
20
|
+
|
23
21
|
```bash
|
24
|
-
gem install branch_io_cli
|
22
|
+
gem install branch_io_cli --pre
|
25
23
|
```
|
26
24
|
|
27
25
|
Note that this command may require `sudo` access if you are using the system Ruby, i.e. `sudo gem install branch_io_cli`.
|
28
26
|
|
27
|
+
### Experimental: Install using Homebrew
|
28
|
+
|
29
|
+
```bash
|
30
|
+
brew tap jdee/tap
|
31
|
+
brew install branch_io_cli
|
32
|
+
```
|
33
|
+
|
34
|
+
**Note:** Prerelease versions of the CLI are only available from RubyGems for now.
|
35
|
+
|
36
|
+
### Getting help
|
37
|
+
|
29
38
|
```bash
|
30
39
|
branch_io -h
|
31
40
|
branch_io setup -h
|
@@ -55,7 +64,7 @@ any Ruby-related environment variables if using the system Ruby.
|
|
55
64
|
Add to `~/.bash_profile` or `~/.bashrc`:
|
56
65
|
|
57
66
|
```bash
|
58
|
-
|
67
|
+
[[ "$(which br)" == "" ]] || . $(br env -cs bash)
|
59
68
|
```
|
60
69
|
|
61
70
|
#### Zsh
|
@@ -63,7 +72,7 @@ Add to `~/.bash_profile` or `~/.bashrc`:
|
|
63
72
|
Add to `~/.zshrc`:
|
64
73
|
|
65
74
|
```zsh
|
66
|
-
|
75
|
+
[[ "$(which br)" == "" ]] || . $(br env -cs zsh)
|
67
76
|
```
|
68
77
|
|
69
78
|
Currently command-line completion for bash is much more extensive than for zsh.
|
@@ -263,6 +272,37 @@ See https://github.com/BranchMetrics/branch_io_cli#validate-command for more inf
|
|
263
272
|
|--[no-]confirm|Enable or disable many prompts (default: yes)|BRANCH_CONFIRM|
|
264
273
|
|
265
274
|
|
275
|
+
#### Examples
|
276
|
+
|
277
|
+
|
278
|
+
##### Ensure project has at least one correctly configured Branch key and domain
|
279
|
+
|
280
|
+
```bash
|
281
|
+
br validate
|
282
|
+
```
|
283
|
+
|
284
|
+
|
285
|
+
##### Ensure project is correctly configured for certain Branch keys
|
286
|
+
|
287
|
+
```bash
|
288
|
+
br validate -L key_live_xxxx -T key_test_yyyy
|
289
|
+
```
|
290
|
+
|
291
|
+
|
292
|
+
##### Ensure project is correctly configured to use specific domains
|
293
|
+
|
294
|
+
```bash
|
295
|
+
br validate -D myapp.app.link,myapp-alternate.app.link
|
296
|
+
```
|
297
|
+
|
298
|
+
|
299
|
+
##### Validate only Universal Link configuration
|
300
|
+
|
301
|
+
```bash
|
302
|
+
br validate --universal-links-only
|
303
|
+
```
|
304
|
+
|
305
|
+
|
266
306
|
|
267
307
|
|
268
308
|
|
@@ -302,6 +342,71 @@ building.
|
|
302
342
|
|--[no-]confirm|Enable or disable many prompts (default: yes)|BRANCH_CONFIRM|
|
303
343
|
|
304
344
|
|
345
|
+
#### Examples
|
346
|
+
|
347
|
+
|
348
|
+
##### Show general project information without building
|
349
|
+
|
350
|
+
```bash
|
351
|
+
br report -H
|
352
|
+
```
|
353
|
+
|
354
|
+
|
355
|
+
##### Perform a full build and report all errors to report.txt
|
356
|
+
|
357
|
+
```bash
|
358
|
+
br report
|
359
|
+
```
|
360
|
+
|
361
|
+
|
362
|
+
##### Don't clean before building
|
363
|
+
|
364
|
+
```bash
|
365
|
+
br report --no-clean
|
366
|
+
```
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
### Env command
|
372
|
+
|
373
|
+
```bash
|
374
|
+
branch_io env [OPTIONS]
|
375
|
+
br env [OPTIONS]
|
376
|
+
```
|
377
|
+
|
378
|
+
Output information about CLI environment.
|
379
|
+
|
380
|
+
|
381
|
+
#### Options
|
382
|
+
|
383
|
+
|Option|Description|Env. var.|
|
384
|
+
|------|-----------|---------|
|
385
|
+
|-h, --help|Prints a list of commands or help for each command||
|
386
|
+
|-v, --version|Prints the current version of the CLI||
|
387
|
+
|-t, --trace|Prints a stack trace when exceptions are raised||
|
388
|
+
|-c, --[no-]completion-script|Get the path to the completion script for this shell (default: no)|BRANCH_COMPLETION_SCRIPT|
|
389
|
+
|-s, --shell zsh|Specify shell for completion script|SHELL|
|
390
|
+
|-V, --[no-]verbose|Generate verbose output (default: no)|BRANCH_VERBOSE|
|
391
|
+
|
392
|
+
|
393
|
+
#### Examples
|
394
|
+
|
395
|
+
|
396
|
+
##### Show CLI environment
|
397
|
+
|
398
|
+
```bash
|
399
|
+
br env
|
400
|
+
```
|
401
|
+
|
402
|
+
|
403
|
+
##### Get completion script for zsh
|
404
|
+
|
405
|
+
```bash
|
406
|
+
br env -cs zsh
|
407
|
+
```
|
408
|
+
|
409
|
+
|
305
410
|
|
306
411
|
|
307
412
|
|
@@ -9,10 +9,12 @@ _branch_io_complete()
|
|
9
9
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
10
10
|
cmd="${COMP_WORDS[1]}"
|
11
11
|
|
12
|
-
commands="setup report validate"
|
12
|
+
commands="env setup report validate"
|
13
13
|
global_opts="-h --help -t --trace -v --version"
|
14
14
|
|
15
15
|
|
16
|
+
env_opts="-c --completion-script -s --shell -V --verbose"
|
17
|
+
|
16
18
|
setup_opts="-L --live-key -T --test-key -D --domains --app-link-subdomain -U --uri-scheme -s --setting --test-configurations --xcodeproj --target --podfile --cartfile --carthage-command --frameworks --no-pod-repo-update --no-validate --force --no-add-sdk --no-patch-source --commit --no-confirm"
|
17
19
|
|
18
20
|
report_opts="--workspace --xcodeproj --scheme --target --configuration --sdk --podfile --cartfile --no-clean -H --header-only --no-pod-repo-update -o --out --no-confirm"
|
@@ -31,6 +33,9 @@ _branch_io_complete()
|
|
31
33
|
validate)
|
32
34
|
opts=$validate_opts
|
33
35
|
;;
|
36
|
+
env)
|
37
|
+
opts=$env_opts
|
38
|
+
;;
|
34
39
|
*)
|
35
40
|
opts=$global_opts
|
36
41
|
;;
|
@@ -5,7 +5,7 @@ _branch_io_complete() {
|
|
5
5
|
local word opts
|
6
6
|
word="$1"
|
7
7
|
opts="-h --help -t --trace -v --version"
|
8
|
-
opts
|
8
|
+
opts="$opts -L --live-key -T --test-key -D --domains --app-link-subdomain -U --uri-scheme -s --setting --test-configurations --xcodeproj --target --podfile --cartfile --carthage-command --frameworks --no-pod-repo-update --no-validate --force --no-add-sdk --no-patch-source --commit --no-confirm"
|
9
9
|
|
10
10
|
reply=( "${(ps: :)opts}" )
|
11
11
|
}
|
@@ -9,7 +9,7 @@ _branch_io_complete()
|
|
9
9
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
10
10
|
cmd="${COMP_WORDS[1]}"
|
11
11
|
|
12
|
-
commands="<%= all_commands.join
|
12
|
+
commands="<%= all_commands.join(' ') %>"
|
13
13
|
global_opts="-h --help -t --trace -v --version"
|
14
14
|
|
15
15
|
<% all_commands.each do |command| %>
|
@@ -27,6 +27,9 @@ _branch_io_complete()
|
|
27
27
|
validate)
|
28
28
|
opts=$validate_opts
|
29
29
|
;;
|
30
|
+
env)
|
31
|
+
opts=$env_opts
|
32
|
+
;;
|
30
33
|
*)
|
31
34
|
opts=$global_opts
|
32
35
|
;;
|
@@ -0,0 +1 @@
|
|
1
|
+
Output information about CLI environment.
|
data/lib/branch_io_cli.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
require_relative "branch_io_cli/ascii_art"
|
2
|
+
require_relative "branch_io_cli/branch_app"
|
3
|
+
require_relative "branch_io_cli/cli"
|
4
|
+
require_relative "branch_io_cli/command"
|
5
|
+
require_relative "branch_io_cli/configuration"
|
6
|
+
require_relative "branch_io_cli/core_ext"
|
7
|
+
require_relative "branch_io_cli/format"
|
8
|
+
require_relative "branch_io_cli/helper"
|
9
|
+
require_relative "branch_io_cli/version"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "active_support/core_ext/hash"
|
2
2
|
require "json"
|
3
|
-
|
3
|
+
require_relative "helper"
|
4
|
+
require "tty/spinner"
|
4
5
|
|
5
6
|
module BranchIOCLI
|
6
7
|
class BranchApp
|
@@ -31,11 +32,19 @@ module BranchIOCLI
|
|
31
32
|
def initialize(key)
|
32
33
|
@key = key
|
33
34
|
|
34
|
-
|
35
|
+
spinner = TTY::Spinner.new "[:spinner] Fetching configuration from Branch Dashboard for #{key}.", format: :flip
|
36
|
+
spinner.auto_spin
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
begin
|
39
|
+
@hash = JSON.parse(Helper::BranchHelper.fetch("#{API_ENDPOINT}#{key}", spin: false)).symbolize_keys.merge key: key
|
40
|
+
spinner.success
|
41
|
+
@valid = true
|
42
|
+
rescue StandardError => e
|
43
|
+
spinner.error
|
44
|
+
say e.message
|
45
|
+
@valid = false
|
46
|
+
return
|
47
|
+
end
|
39
48
|
|
40
49
|
@alternate_short_url_domain = @hash[:alternate_short_url_domain]
|
41
50
|
@android_package_name = @hash[:android_package_name]
|
@@ -47,6 +56,10 @@ module BranchIOCLI
|
|
47
56
|
@short_url_domain = @hash[:short_url_domain]
|
48
57
|
end
|
49
58
|
|
59
|
+
def valid?
|
60
|
+
@valid
|
61
|
+
end
|
62
|
+
|
50
63
|
def domains
|
51
64
|
[alternate_short_url_domain, default_short_url_domain, short_url_domain].compact.uniq
|
52
65
|
end
|
data/lib/branch_io_cli/cli.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require_relative "command/command"
|
2
|
+
require_relative "command/env_command"
|
3
|
+
require_relative "command/report_command"
|
4
|
+
require_relative "command/setup_command"
|
5
|
+
require_relative "command/validate_command"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module BranchIOCLI
|
2
|
+
module Command
|
3
|
+
class EnvCommand < Command
|
4
|
+
def run!
|
5
|
+
if config.show_all?
|
6
|
+
say "\n" unless config.quiet
|
7
|
+
say "<%= color('CLI version:', BOLD) %> #{VERSION}"
|
8
|
+
say env.ruby_header(include_load_path: true)
|
9
|
+
else
|
10
|
+
script_path = env.completion_script
|
11
|
+
if script_path.nil?
|
12
|
+
say "Completion script not available for #{env.shell}"
|
13
|
+
return 1
|
14
|
+
end
|
15
|
+
puts script_path
|
16
|
+
end
|
17
|
+
|
18
|
+
0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -18,6 +18,8 @@ module BranchIOCLI
|
|
18
18
|
end
|
19
19
|
|
20
20
|
if config.header_only
|
21
|
+
say "\n"
|
22
|
+
say env.ruby_header
|
21
23
|
say report_helper.report_header
|
22
24
|
return 0
|
23
25
|
end
|
@@ -35,6 +37,13 @@ module BranchIOCLI
|
|
35
37
|
def write_report(report)
|
36
38
|
report.write "Branch.io Xcode build report v #{VERSION} #{Time.now}\n\n"
|
37
39
|
report.write "#{config.report_configuration}\n"
|
40
|
+
|
41
|
+
if report == STDOUT
|
42
|
+
say env.ruby_header
|
43
|
+
else
|
44
|
+
report.write env.ruby_header(terminal: false, include_load_path: true)
|
45
|
+
end
|
46
|
+
|
38
47
|
report.write "#{report_helper.report_header}\n"
|
39
48
|
|
40
49
|
tool_helper.pod_install_if_required report
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../helper"
|
2
2
|
|
3
3
|
module BranchIOCLI
|
4
4
|
module Command
|
@@ -139,7 +139,7 @@ module BranchIOCLI
|
|
139
139
|
|
140
140
|
case choice
|
141
141
|
when /^Stash/
|
142
|
-
sh
|
142
|
+
sh %w(git stash -q)
|
143
143
|
when /^Commit/
|
144
144
|
message = ask "Please enter a commit message: "
|
145
145
|
sh "git", "commit", "-aqm", message
|
@@ -1,10 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require_relative "configuration/configuration"
|
2
|
+
require_relative "configuration/env_configuration"
|
3
|
+
require_relative "configuration/env_options"
|
4
|
+
require_relative "configuration/environment"
|
5
|
+
require_relative "configuration/option"
|
6
|
+
require_relative "configuration/option_wrapper"
|
7
|
+
require_relative "configuration/report_configuration"
|
8
|
+
require_relative "configuration/report_options"
|
9
|
+
require_relative "configuration/setup_configuration"
|
10
|
+
require_relative "configuration/setup_options"
|
11
|
+
require_relative "configuration/validate_configuration"
|
12
|
+
require_relative "configuration/validate_options"
|
13
|
+
require_relative "configuration/xcode_settings"
|
@@ -81,6 +81,7 @@ module BranchIOCLI
|
|
81
81
|
attr_reader :sdk
|
82
82
|
attr_reader :keys
|
83
83
|
attr_reader :apps
|
84
|
+
attr_reader :quiet
|
84
85
|
|
85
86
|
def initialize(options)
|
86
87
|
@options = options
|
@@ -90,10 +91,13 @@ module BranchIOCLI
|
|
90
91
|
|
91
92
|
Configuration.current = self
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
unless quiet
|
95
|
+
say "\n"
|
96
|
+
print_identification
|
97
|
+
say ASCII_ART
|
98
|
+
say "\n"
|
99
|
+
end
|
100
|
+
|
97
101
|
validate_options
|
98
102
|
log
|
99
103
|
end
|
@@ -103,6 +107,8 @@ module BranchIOCLI
|
|
103
107
|
end
|
104
108
|
|
105
109
|
def log
|
110
|
+
return if quiet
|
111
|
+
|
106
112
|
say <<EOF
|
107
113
|
<%= color('Configuration:', [CYAN, BOLD, UNDERLINE]) %>
|
108
114
|
|
@@ -300,7 +306,7 @@ EOF
|
|
300
306
|
end
|
301
307
|
|
302
308
|
# For now: When using --no-validate with the setup command, don't call the Branch API.
|
303
|
-
return true unless
|
309
|
+
return true unless self.class.available_options.map(&:name).include?(:validate) && validate
|
304
310
|
|
305
311
|
begin
|
306
312
|
# Retrieve info from the API
|