branch_io_cli 0.12.3 → 0.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/bin/br +5 -0
- data/lib/assets/artwork/branch_ascii_art.txt +6 -0
- data/lib/assets/completions/completion.bash +2 -1
- data/lib/assets/completions/completion.zsh +1 -0
- data/lib/assets/templates/command.erb +1 -0
- data/lib/assets/templates/completion.bash.erb +2 -1
- data/lib/assets/templates/completion.zsh.erb +1 -0
- data/lib/branch_io_cli.rb +1 -0
- data/lib/branch_io_cli/ascii_art.rb +5 -0
- data/lib/branch_io_cli/cli.rb +1 -1
- data/lib/branch_io_cli/command/setup_command.rb +8 -2
- data/lib/branch_io_cli/configuration/configuration.rb +22 -24
- data/lib/branch_io_cli/configuration/report_configuration.rb +60 -61
- data/lib/branch_io_cli/configuration/setup_configuration.rb +5 -5
- data/lib/branch_io_cli/helper/tool_helper.rb +0 -2
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +6 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73ff4ce1216540062fb5538541b2872eec3acdebb1471fa7a8b24d2154a3fcfe
|
4
|
+
data.tar.gz: d4b975f00a121acb6ea440e0fdd25de305a00e82625a2469742a07b790cb64ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeaf64c3d4944edcf6edd1d97ebc284c5bd60a5ef6770fbba2fabef05874982cd1add06aee1cd735de01d4dc21c2a46c4b5d883f3d915f95e556bfd90b46d35c
|
7
|
+
data.tar.gz: db25f0205240eb879fd92d76ec5f959f62c1f26d7bd2b96d96425c1c4476aa1d6ca8f3af49ade8bdd3df7024371745081beade2f1c4f6537e17d44e2dba2be14
|
data/README.md
CHANGED
@@ -31,6 +31,15 @@ branch_io validate -h
|
|
31
31
|
branch_io report -h
|
32
32
|
```
|
33
33
|
|
34
|
+
The gem also installs `br` as an alias for `branch_io`:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
br -h
|
38
|
+
br setup -h
|
39
|
+
br validate -h
|
40
|
+
br report -h
|
41
|
+
```
|
42
|
+
|
34
43
|
### Shell completion
|
35
44
|
|
36
45
|
_Work in progress_
|
@@ -66,6 +75,7 @@ Currently command-line completion for bash is much more extensive than for zsh.
|
|
66
75
|
|
67
76
|
```bash
|
68
77
|
branch_io setup [OPTIONS]
|
78
|
+
br setup [OPTIONS]
|
69
79
|
```
|
70
80
|
|
71
81
|
Integrates the Branch SDK into a native app project. This currently supports iOS only.
|
@@ -157,35 +167,35 @@ See https://github.com/BranchMetrics/branch_io_cli#setup-command for more inform
|
|
157
167
|
##### Test without validation (can use dummy keys and domains)
|
158
168
|
|
159
169
|
```bash
|
160
|
-
|
170
|
+
br setup -L key_live_xxxx -D myapp.app.link --no-validate
|
161
171
|
```
|
162
172
|
|
163
173
|
|
164
174
|
##### Use both live and test keys
|
165
175
|
|
166
176
|
```bash
|
167
|
-
|
177
|
+
br setup -L key_live_xxxx -T key_test_yyyy -D myapp.app.link
|
168
178
|
```
|
169
179
|
|
170
180
|
|
171
181
|
##### Use custom or non-Branch domains
|
172
182
|
|
173
183
|
```bash
|
174
|
-
|
184
|
+
br setup -D myapp.app.link,example.com,www.example.com
|
175
185
|
```
|
176
186
|
|
177
187
|
|
178
188
|
##### Avoid pod repo update
|
179
189
|
|
180
190
|
```bash
|
181
|
-
|
191
|
+
br setup --no-pod-repo-update
|
182
192
|
```
|
183
193
|
|
184
194
|
|
185
195
|
##### Install using carthage bootstrap
|
186
196
|
|
187
197
|
```bash
|
188
|
-
|
198
|
+
br setup --carthage-command "bootstrap --no-use-binaries"
|
189
199
|
```
|
190
200
|
|
191
201
|
|
@@ -195,6 +205,7 @@ branch_io --carthage-command "bootstrap --no-use-binaries"
|
|
195
205
|
|
196
206
|
```bash
|
197
207
|
branch_io validate [OPTIONS]
|
208
|
+
br validate [OPTIONS]
|
198
209
|
```
|
199
210
|
|
200
211
|
This command validates all Universal Link domains configured in a project without making any
|
@@ -243,6 +254,7 @@ See https://github.com/BranchMetrics/branch_io_cli#validate-command for more inf
|
|
243
254
|
|
244
255
|
```bash
|
245
256
|
branch_io report [OPTIONS]
|
257
|
+
br report [OPTIONS]
|
246
258
|
```
|
247
259
|
|
248
260
|
This command optionally cleans and then builds a workspace or project, generating a verbose
|
data/bin/br
ADDED
@@ -36,7 +36,7 @@ _branch_io_complete()
|
|
36
36
|
;;
|
37
37
|
esac
|
38
38
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
39
|
-
elif [[ ${prev} == branch_io ]] ; then
|
39
|
+
elif [[ ${prev} == branch_io || ${prev} == br ]] ; then
|
40
40
|
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
|
41
41
|
else
|
42
42
|
COMPREPLY=( $(compgen -o default ${cur}) )
|
@@ -44,3 +44,4 @@ _branch_io_complete()
|
|
44
44
|
return 0
|
45
45
|
}
|
46
46
|
complete -F _branch_io_complete branch_io
|
47
|
+
complete -F _branch_io_complete br
|
@@ -32,7 +32,7 @@ _branch_io_complete()
|
|
32
32
|
;;
|
33
33
|
esac
|
34
34
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
35
|
-
elif [[ ${prev} == branch_io ]] ; then
|
35
|
+
elif [[ ${prev} == branch_io || ${prev} == br ]] ; then
|
36
36
|
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
|
37
37
|
else
|
38
38
|
COMPREPLY=( $(compgen -o default ${cur}) )
|
@@ -40,3 +40,4 @@ _branch_io_complete()
|
|
40
40
|
return 0
|
41
41
|
}
|
42
42
|
complete -F _branch_io_complete branch_io
|
43
|
+
complete -F _branch_io_complete br
|
data/lib/branch_io_cli.rb
CHANGED
data/lib/branch_io_cli/cli.rb
CHANGED
@@ -23,7 +23,7 @@ module BranchIOCLI
|
|
23
23
|
next unless configuration_class && command_class
|
24
24
|
|
25
25
|
command command_name do |c|
|
26
|
-
c.syntax = "branch_io #{c.name} [OPTIONS]"
|
26
|
+
c.syntax = "branch_io #{c.name} [OPTIONS]\n br #{c.name} [OPTIONS]"
|
27
27
|
c.summary = configuration_class.summary if configuration_class.respond_to?(:summary)
|
28
28
|
|
29
29
|
begin
|
@@ -43,22 +43,26 @@ module BranchIOCLI
|
|
43
43
|
# Commit changes if so instructed.
|
44
44
|
commit_changes if config.commit
|
45
45
|
|
46
|
+
say "\nDone ✅"
|
47
|
+
|
46
48
|
# Return success.
|
47
49
|
0
|
48
50
|
end
|
49
51
|
|
50
52
|
def validate_universal_links
|
53
|
+
say "Validating new Universal Link configuration before making any changes.\n\n"
|
51
54
|
valid = helper.validate_team_and_bundle_ids_from_aasa_files @domains
|
52
55
|
if valid
|
53
|
-
say "Universal Link configuration passed validation.
|
56
|
+
say "Universal Link configuration passed validation. ✅\n\n"
|
54
57
|
else
|
55
|
-
say "Universal Link configuration failed validation
|
58
|
+
say "Universal Link configuration failed validation.\n\n"
|
56
59
|
helper.errors.each { |error| say " #{error}" }
|
57
60
|
end
|
58
61
|
valid
|
59
62
|
end
|
60
63
|
|
61
64
|
def update_project_settings
|
65
|
+
say "Updating project settings.\n\n"
|
62
66
|
helper.add_custom_build_setting if config.setting
|
63
67
|
helper.add_keys_to_info_plist @keys
|
64
68
|
config.target.add_system_frameworks config.frameworks unless config.frameworks.blank?
|
@@ -76,6 +80,7 @@ module BranchIOCLI
|
|
76
80
|
end
|
77
81
|
|
78
82
|
def add_sdk
|
83
|
+
say "Making sure Branch dependency is available."
|
79
84
|
case config.sdk_integration_mode
|
80
85
|
when :cocoapods
|
81
86
|
if File.exist? config.podfile_path
|
@@ -92,6 +97,7 @@ module BranchIOCLI
|
|
92
97
|
when :direct
|
93
98
|
tool_helper.add_direct config
|
94
99
|
end
|
100
|
+
say "\n"
|
95
101
|
end
|
96
102
|
|
97
103
|
def commit_changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require "artii"
|
2
1
|
require "cocoapods-core"
|
3
2
|
require "pathname"
|
4
3
|
require "xcodeproj"
|
@@ -78,6 +77,8 @@ module BranchIOCLI
|
|
78
77
|
|
79
78
|
say "\n"
|
80
79
|
print_identification
|
80
|
+
say ASCII_ART
|
81
|
+
say "\n"
|
81
82
|
validate_options
|
82
83
|
log
|
83
84
|
end
|
@@ -97,8 +98,6 @@ EOF
|
|
97
98
|
def print_identification
|
98
99
|
say <<EOF
|
99
100
|
<%= color("branch_io #{self.class.name.sub(/^.*::(.*?)Configuration$/, '\1').downcase} v. #{VERSION}", BOLD) %>
|
100
|
-
|
101
|
-
#{Artii::Base.new.asciify 'Branch'}
|
102
101
|
EOF
|
103
102
|
end
|
104
103
|
|
@@ -145,32 +144,31 @@ EOF
|
|
145
144
|
if options.xcodeproj
|
146
145
|
path = options.xcodeproj
|
147
146
|
else
|
148
|
-
|
149
|
-
# find an xcodeproj (ignoring the Pods and Carthage folders)
|
150
|
-
# TODO: Improve this filter
|
151
|
-
xcodeproj_paths = all_xcodeproj_paths.select do |p|
|
152
|
-
valid = true
|
153
|
-
Pathname.new(p).each_filename do |f|
|
154
|
-
valid = false && break if f == "Carthage" || f == "Pods"
|
155
|
-
end
|
156
|
-
valid
|
157
|
-
end
|
158
|
-
|
159
|
-
path = xcodeproj_paths.first if xcodeproj_paths.count == 1
|
147
|
+
path = find_project
|
160
148
|
end
|
161
149
|
|
162
150
|
loop do
|
163
151
|
path = ask "Please enter the path to your Xcode project or use --xcodeproj: " if path.nil?
|
164
152
|
# TODO: Allow the user to choose if xcodeproj_paths.count > 0
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
153
|
+
return if open_xcodeproj path
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def all_xcodeproj_paths
|
158
|
+
return @all_xcodeproj_paths if @all_xcodeproj_paths
|
159
|
+
xcodeproj_paths = Dir[File.expand_path(File.join(".", "**/*.xcodeproj"))]
|
160
|
+
@all_xcodeproj_paths = xcodeproj_paths.select do |p|
|
161
|
+
valid = true
|
162
|
+
Pathname.new(p).each_filename do |f|
|
163
|
+
valid = false && break if f == "Carthage" || f == "Pods"
|
172
164
|
end
|
165
|
+
valid
|
173
166
|
end
|
167
|
+
@all_xcodeproj_paths
|
168
|
+
end
|
169
|
+
|
170
|
+
def find_project
|
171
|
+
all_xcodeproj_paths.count == 1 ? all_xcodeproj_paths.first : nil
|
174
172
|
end
|
175
173
|
|
176
174
|
def validate_target(allow_extensions = true)
|
@@ -224,7 +222,7 @@ EOF
|
|
224
222
|
|
225
223
|
def open_podfile(path = podfile_path)
|
226
224
|
@podfile = Pod::Podfile.from_file path
|
227
|
-
@podfile_path = path
|
225
|
+
@podfile_path = File.expand_path path
|
228
226
|
@sdk_integration_mode = :cocoapods
|
229
227
|
true
|
230
228
|
rescue Pod::PlainInformative => e
|
@@ -234,7 +232,7 @@ EOF
|
|
234
232
|
|
235
233
|
def open_xcodeproj(path = xcodeproj_path)
|
236
234
|
@xcodeproj = Xcodeproj::Project.open path
|
237
|
-
@xcodeproj_path = path
|
235
|
+
@xcodeproj_path = File.expand_path path
|
238
236
|
true
|
239
237
|
rescue Xcodeproj::PlainInformative => e
|
240
238
|
say e.message
|
@@ -72,47 +72,60 @@ EOF
|
|
72
72
|
EOF
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
def open_workspace(path = workspace_path)
|
76
|
+
@workspace = Xcodeproj::Workspace.new_from_xcworkspace path
|
77
|
+
@workspace_path = File.expand_path path
|
78
|
+
true
|
79
|
+
rescue Xcodeproj::PlainInformative => e
|
80
|
+
say e.message
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
76
84
|
def validate_xcodeproj_and_workspace(options)
|
77
|
-
#
|
78
|
-
|
79
|
-
|
80
|
-
path = options.workspace
|
81
|
-
@workspace = Xcodeproj::Workspace.new_from_xcworkspace options.workspace
|
82
|
-
@workspace_path = File.expand_path options.workspace
|
83
|
-
end
|
84
|
-
if options.xcodeproj
|
85
|
-
path = options.xcodeproj
|
86
|
-
@xcodeproj = Xcodeproj::Project.open options.xcodeproj
|
87
|
-
@xcodeproj_path = File.expand_path options.xcodeproj
|
88
|
-
else
|
89
|
-
# Pass --workspace and --xcodeproj to override this inference.
|
90
|
-
if workspace && workspace.file_references.count > 0 && workspace.file_references.first.path =~ /\.xcodeproj$/
|
91
|
-
@xcodeproj_path = File.expand_path "../#{@workspace.file_references.first.path}", workspace_path
|
92
|
-
@xcodeproj = Xcodeproj::Project.open xcodeproj_path
|
93
|
-
end
|
94
|
-
end
|
95
|
-
return if @workspace || @xcodeproj
|
96
|
-
rescue StandardError => e
|
97
|
-
say e.message
|
85
|
+
# What was passed in?
|
86
|
+
if options.workspace
|
87
|
+
open_workspace options.workspace
|
98
88
|
end
|
99
89
|
|
90
|
+
if options.xcodeproj
|
91
|
+
open_xcodeproj options.xcodeproj
|
92
|
+
elsif workspace
|
93
|
+
open_first_project_in_workspace
|
94
|
+
end
|
95
|
+
|
96
|
+
return if workspace || xcodeproj
|
97
|
+
|
100
98
|
# Try to find first a workspace, then a project
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
99
|
+
path =
|
100
|
+
case all_workspace_paths.count
|
101
|
+
when 1
|
102
|
+
all_workspace_paths.first
|
103
|
+
when 0
|
104
|
+
find_project
|
105
|
+
end
|
106
|
+
# If more than one workspace. Don't try to find a project. Just prompt.
|
107
|
+
|
108
|
+
loop do
|
109
|
+
path = ask "Please enter a path to your Xcode project or workspace: " if path.nil?
|
110
|
+
if path =~ /\.xcworkspace$/
|
111
|
+
next unless open_workspace path
|
112
|
+
open_first_project_in_workspace
|
113
|
+
return
|
114
|
+
elsif path =~ /\.xcodeproj$/
|
115
|
+
return if open_xcodeproj path
|
116
|
+
else
|
117
|
+
say "Path must end with .xcworkspace or .xcodeproj"
|
107
118
|
end
|
108
|
-
valid
|
109
119
|
end
|
120
|
+
end
|
110
121
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
122
|
+
def all_workspace_paths
|
123
|
+
return @all_workspace_paths if @all_workspace_paths
|
124
|
+
|
125
|
+
@all_workspace_paths =
|
126
|
+
Dir[File.expand_path(File.join(".", "**/*.xcworkspace"))]
|
127
|
+
.reject { |w| w =~ %r{/project.xcworkspace$} }
|
128
|
+
.select do |p|
|
116
129
|
valid = true
|
117
130
|
Pathname.new(p).each_filename do |f|
|
118
131
|
valid = false && break if f == "Carthage" || f == "Pods"
|
@@ -120,37 +133,23 @@ EOF
|
|
120
133
|
valid
|
121
134
|
end
|
122
135
|
|
123
|
-
|
136
|
+
@all_workspace_paths
|
137
|
+
end
|
138
|
+
|
139
|
+
def open_first_project_in_workspace
|
140
|
+
# Pass --workspace and --xcodeproj or use the configuration editor to
|
141
|
+
# override this inference.
|
142
|
+
project_path = workspace.file_references.map(&:path).find do |path|
|
143
|
+
path =~ /\.xcodeproj$/ && File.exist?(File.expand_path("../#{path}", workspace_path))
|
124
144
|
end
|
125
|
-
# If more than one workspace. Don't try to find a project. Just prompt.
|
126
145
|
|
127
|
-
|
128
|
-
|
129
|
-
begin
|
130
|
-
if path =~ /\.xcworkspace$/
|
131
|
-
@workspace = Xcodeproj::Workspace.new_from_xcworkspace path
|
132
|
-
@workspace_path = File.expand_path path
|
133
|
-
|
134
|
-
# Pass --workspace and --xcodeproj to override this inference.
|
135
|
-
if workspace.file_references.count > 0 && workspace.file_references.first.path =~ /\.xcodeproj$/
|
136
|
-
@xcodeproj_path = File.expand_path "../#{workspace.file_references.first.path}", workspace_path
|
137
|
-
@xcodeproj = Xcodeproj::Project.open xcodeproj_path
|
138
|
-
end
|
139
|
-
|
140
|
-
return
|
141
|
-
elsif path =~ /\.xcodeproj$/
|
142
|
-
@xcodeproj = Xcodeproj::Project.open path
|
143
|
-
@xcodeproj_path = File.expand_path path
|
144
|
-
return
|
145
|
-
else
|
146
|
-
say "Path must end with .xcworkspace or .xcodeproj"
|
147
|
-
end
|
148
|
-
rescue StandardError => e
|
149
|
-
say e.message
|
150
|
-
end
|
146
|
+
if project_path.nil?
|
147
|
+
raise "No project found in workspace #{workspace_path}"
|
151
148
|
end
|
149
|
+
|
150
|
+
open_xcodeproj project_path
|
151
|
+
# TODO: Handle the case where this cannot be opened (though it exists).
|
152
152
|
end
|
153
|
-
# rubocop: enable Metrics/PerceivedComplexity
|
154
153
|
|
155
154
|
def validate_scheme(options)
|
156
155
|
schemes = all_schemes
|
@@ -8,11 +8,11 @@ module BranchIOCLI
|
|
8
8
|
|
9
9
|
def examples
|
10
10
|
{
|
11
|
-
"Test without validation (can use dummy keys and domains)" => "
|
12
|
-
"Use both live and test keys" => "
|
13
|
-
"Use custom or non-Branch domains" => "
|
14
|
-
"Avoid pod repo update" => "
|
15
|
-
"Install using carthage bootstrap" => "
|
11
|
+
"Test without validation (can use dummy keys and domains)" => "br setup -L key_live_xxxx -D myapp.app.link --no-validate",
|
12
|
+
"Use both live and test keys" => "br setup -L key_live_xxxx -T key_test_yyyy -D myapp.app.link",
|
13
|
+
"Use custom or non-Branch domains" => "br setup -D myapp.app.link,example.com,www.example.com",
|
14
|
+
"Avoid pod repo update" => "br setup --no-pod-repo-update",
|
15
|
+
"Install using carthage bootstrap" => "br setup --carthage-command \"bootstrap --no-use-binaries\""
|
16
16
|
}
|
17
17
|
end
|
18
18
|
end
|
@@ -160,8 +160,6 @@ github "BranchMetrics/ios-branch-deep-linking"
|
|
160
160
|
helper.add_change options.xcodeproj_path
|
161
161
|
helper.add_change framework_path
|
162
162
|
sh "git", "add", framework_path if options.commit
|
163
|
-
|
164
|
-
say "Done. ✅"
|
165
163
|
end
|
166
164
|
|
167
165
|
def update_framework_search_paths(path)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branch_io_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Branch
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
12
|
+
date: 2017-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: artii
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: CFPropertyList
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,12 +242,15 @@ email:
|
|
256
242
|
- jgvdthree@gmail.com
|
257
243
|
executables:
|
258
244
|
- branch_io
|
245
|
+
- br
|
259
246
|
extensions: []
|
260
247
|
extra_rdoc_files: []
|
261
248
|
files:
|
262
249
|
- LICENSE
|
263
250
|
- README.md
|
251
|
+
- bin/br
|
264
252
|
- bin/branch_io
|
253
|
+
- lib/assets/artwork/branch_ascii_art.txt
|
265
254
|
- lib/assets/completions/completion.bash
|
266
255
|
- lib/assets/completions/completion.zsh
|
267
256
|
- lib/assets/patches/ContinueUserActivity.m
|
@@ -309,6 +298,7 @@ files:
|
|
309
298
|
- lib/assets/templates/setup_description.erb
|
310
299
|
- lib/assets/templates/validate_description.erb
|
311
300
|
- lib/branch_io_cli.rb
|
301
|
+
- lib/branch_io_cli/ascii_art.rb
|
312
302
|
- lib/branch_io_cli/cli.rb
|
313
303
|
- lib/branch_io_cli/command.rb
|
314
304
|
- lib/branch_io_cli/command/command.rb
|