branch_io_cli 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/completions/completion.bash +7 -9
- data/lib/assets/completions/completion.zsh +2 -5
- data/lib/assets/templates/completion.bash.erb +42 -0
- data/lib/assets/templates/completion.zsh.erb +13 -0
- data/lib/branch_io_cli/configuration/configuration.rb +7 -1
- data/lib/branch_io_cli/configuration/xcode_settings.rb +1 -0
- data/lib/branch_io_cli/format.rb +1 -0
- data/lib/branch_io_cli/format/shell_format.rb +34 -0
- data/lib/branch_io_cli/helper/report_helper.rb +2 -2
- data/lib/branch_io_cli/helper/xcodeproj_ext.rb +20 -8
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1614c75a346bfa728be2437d7e729a54c381199c1786699210defc36a33e390
|
4
|
+
data.tar.gz: '0334849b987d626b6e606972c552a1ae2e737aad2746b96519da1402a8a48c85'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ddacc36d94b84d8fa6f90b7a80c1964915e9a3b174d2d0928b53be0112cc31de7758a0f441e7c89adb1d0ce3baea2cb74ed5d7b4220dc770b43664ccfb512f
|
7
|
+
data.tar.gz: 29f548ba0c9c57583682f80c0f633cd8ef837f342342ba32ba8472a6f55554efe7a92b38e98ab5902c08c5bc39097251436fade3e53e542af8d0a41c52cc6603
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
|
+
# This file is generated. Run rake readme to regenerate it.
|
2
3
|
|
3
4
|
_branch_io_complete()
|
4
5
|
{
|
@@ -8,19 +9,16 @@ _branch_io_complete()
|
|
8
9
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
9
10
|
cmd="${COMP_WORDS[1]}"
|
10
11
|
|
11
|
-
commands="report
|
12
|
+
commands="setup report validate"
|
12
13
|
global_opts="-h --help -t --trace -v --version"
|
13
14
|
|
14
|
-
setup_opts="$global_opts -L --live-key -T --test-key -D --domains --app-link-subdomain -U --uri-scheme"
|
15
|
-
setup_opts="$setup_opts --xcodeproj --target --frameworks --podfile --cartfile --carthage-command --setting -s"
|
16
|
-
setup_opts="$setup_opts --test-configurations --no-test-configurations --no-check-repo-changes --no-confirm"
|
17
|
-
# Don't autocomplete the default values here, e.g. --no-force, --pod-repo-update.
|
18
|
-
setup_opts="$setup_opts --no-add-sdk --no-validate --force --no-pod-repo-update --commit --no-patch-source"
|
19
15
|
|
20
|
-
|
16
|
+
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
|
+
|
18
|
+
report_opts="--workspace --xcodeproj --scheme --target --configuration --sdk --podfile --cartfile --no-clean -H --header-only --no-pod-repo-update -o --out"
|
19
|
+
|
20
|
+
validate_opts="-D --domains --xcodeproj --target"
|
21
21
|
|
22
|
-
report_opts="$global_opts --xcodeproj --workspace -H --header-only --no-clean --scheme --target --configuration --sdk --out"
|
23
|
-
report_opts="$report_opts --podfile --cartfile --no-pod-repo-update"
|
24
22
|
|
25
23
|
if [[ ${cur} == -* ]] ; then
|
26
24
|
case "${cmd}" in
|
@@ -1,14 +1,11 @@
|
|
1
1
|
#!/bin/zsh
|
2
|
+
# This file is generated. Run rake readme to regenerate it.
|
2
3
|
|
3
4
|
_branch_io_complete() {
|
4
5
|
local word opts
|
5
6
|
word="$1"
|
6
7
|
opts="-h --help -t --trace -v --version"
|
7
|
-
opts="$opts -L --live-key -T --test-key -D --domains --app-link-subdomain -U --uri-scheme"
|
8
|
-
opts="$opts --xcodeproj --target --frameworks --podfile --cartfile --carthage-command --setting -s"
|
9
|
-
opts="$opts --test-configurations --no-test-configurations --no-check-repo-changes --no-confirm"
|
10
|
-
# Don't autocomplete the default values here, e.g. --no-force, --pod-repo-update.
|
11
|
-
opts="$opts --no-add-sdk --no-validate --force --no-pod-repo-update --commit --no-patch-source"
|
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"
|
12
9
|
|
13
10
|
reply=( "${(ps: :)opts}" )
|
14
11
|
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# This file is generated. Run rake readme to regenerate it.
|
3
|
+
|
4
|
+
_branch_io_complete()
|
5
|
+
{
|
6
|
+
local cur prev opts global_opts setup_opts validate_opts commands cmd
|
7
|
+
COMPREPLY=()
|
8
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
9
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
10
|
+
cmd="${COMP_WORDS[1]}"
|
11
|
+
|
12
|
+
commands="<%= all_commands.join (' ') %>"
|
13
|
+
global_opts="-h --help -t --trace -v --version"
|
14
|
+
|
15
|
+
<% all_commands.each do |command| %>
|
16
|
+
<%= %(#{command}_opts="#{options_for_command command}") %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
if [[ ${cur} == -* ]] ; then
|
20
|
+
case "${cmd}" in
|
21
|
+
report)
|
22
|
+
opts=$report_opts
|
23
|
+
;;
|
24
|
+
setup)
|
25
|
+
opts=$setup_opts
|
26
|
+
;;
|
27
|
+
validate)
|
28
|
+
opts=$validate_opts
|
29
|
+
;;
|
30
|
+
*)
|
31
|
+
opts=$global_opts
|
32
|
+
;;
|
33
|
+
esac
|
34
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
35
|
+
elif [[ ${prev} == branch_io ]] ; then
|
36
|
+
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
|
37
|
+
else
|
38
|
+
COMPREPLY=( $(compgen -o default ${cur}) )
|
39
|
+
fi
|
40
|
+
return 0
|
41
|
+
}
|
42
|
+
complete -F _branch_io_complete branch_io
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/zsh
|
2
|
+
# This file is generated. Run rake readme to regenerate it.
|
3
|
+
|
4
|
+
_branch_io_complete() {
|
5
|
+
local word opts
|
6
|
+
word="$1"
|
7
|
+
opts="-h --help -t --trace -v --version"
|
8
|
+
<%= %(opts = "$opts #{options_for_command 'setup'}") %>
|
9
|
+
|
10
|
+
reply=( "${(ps: :)opts}" )
|
11
|
+
}
|
12
|
+
|
13
|
+
compctl -K _branch_io_complete branch_io
|
@@ -61,10 +61,12 @@ module BranchIOCLI
|
|
61
61
|
attr_reader :workspace
|
62
62
|
attr_reader :workspace_path
|
63
63
|
attr_reader :pod_repo_update
|
64
|
+
attr_reader :sdk
|
64
65
|
|
65
66
|
def initialize(options)
|
66
67
|
@options = options
|
67
68
|
@pod_repo_update = options.pod_repo_update if self.class.available_options.map(&:name).include?(:pod_repo_update)
|
69
|
+
@sdk = "iphonesimulator" # to load Xcode build settings for commands without a --sdk option
|
68
70
|
|
69
71
|
Configuration.current = self
|
70
72
|
|
@@ -359,7 +361,7 @@ EOF
|
|
359
361
|
return @branch_imports if @branch_imports
|
360
362
|
|
361
363
|
source_files = target.source_build_phase.files.map { |f| f.file_ref.real_path.to_s }
|
362
|
-
source_files << bridging_header_path if bridging_header_path
|
364
|
+
source_files << bridging_header_path if bridging_header_path && File.exist?(bridging_header_path)
|
363
365
|
@branch_imports = source_files.compact.map do |f|
|
364
366
|
imports = branch_imports_from_file f
|
365
367
|
next {} if imports.empty?
|
@@ -377,6 +379,10 @@ EOF
|
|
377
379
|
imports << "#{line_no}: #{line.chomp}"
|
378
380
|
end
|
379
381
|
imports
|
382
|
+
rescue StandardError
|
383
|
+
# Quietly ignore anything that can't be opened for now.
|
384
|
+
# TODO: Get these errors into report output.
|
385
|
+
[]
|
380
386
|
end
|
381
387
|
|
382
388
|
def method_missing(method_sym, *arguments, &block)
|
data/lib/branch_io_cli/format.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
module BranchIOCLI
|
2
|
+
module Format
|
3
|
+
module ShellFormat
|
4
|
+
include Format
|
5
|
+
|
6
|
+
def option(opt)
|
7
|
+
o = @configuration.available_options.find { |o1| o1.name == opt.to_sym }
|
8
|
+
|
9
|
+
cli_opt = opt.to_s.gsub(/_/, '-')
|
10
|
+
|
11
|
+
all_opts = o.aliases || []
|
12
|
+
|
13
|
+
if o.nil? || o.default_value.nil? || o.default_value != true
|
14
|
+
all_opts << "--#{cli_opt}"
|
15
|
+
else
|
16
|
+
all_opts << "--no-#{cli_opt}"
|
17
|
+
end
|
18
|
+
|
19
|
+
all_opts.join(" ")
|
20
|
+
end
|
21
|
+
|
22
|
+
def all_commands
|
23
|
+
Dir[File.expand_path(File.join("..", "..", "command", "**_command.rb"), __FILE__)].map { |p| p.sub(%r{^.*/([a-z0-9_]+)_command.rb$}, '\1') }
|
24
|
+
end
|
25
|
+
|
26
|
+
def options_for_command(command)
|
27
|
+
@configuration = Object.const_get("BranchIOCLI")
|
28
|
+
.const_get("Configuration")
|
29
|
+
.const_get("#{command.capitalize}Configuration")
|
30
|
+
@configuration.available_options.map { |o| option(o.name) }.join(" ")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -168,11 +168,11 @@ module BranchIOCLI
|
|
168
168
|
report += " Branch key(s) #{annotation}:\n"
|
169
169
|
if branch_key.kind_of? Hash
|
170
170
|
branch_key.each_key do |key|
|
171
|
-
resolved_key =
|
171
|
+
resolved_key = config.target.expand_build_settings branch_key[key], configuration
|
172
172
|
report += " #{key.capitalize}: #{resolved_key}\n"
|
173
173
|
end
|
174
174
|
elsif branch_key
|
175
|
-
resolved_key =
|
175
|
+
resolved_key = config.target.expand_build_settings branch_key, configuration
|
176
176
|
report += " #{resolved_key}\n"
|
177
177
|
else
|
178
178
|
report += " (none found)\n"
|
@@ -72,7 +72,13 @@ module Xcodeproj
|
|
72
72
|
setting_value = resolved_build_setting(setting_name, false)[configuration]
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
# TODO: What is the correct resolution order here? Which overrides which in
|
76
|
+
# Xcode?
|
77
|
+
if setting_value.nil? && defined?(BranchIOCLI::Configuration::XcodeSettings)
|
78
|
+
setting_value = BranchIOCLI::Configuration::XcodeSettings[configuration][setting_name]
|
79
|
+
end
|
80
|
+
|
81
|
+
return nil if setting_value.nil?
|
76
82
|
|
77
83
|
expand_build_settings setting_value, configuration
|
78
84
|
end
|
@@ -89,13 +95,10 @@ module Xcodeproj
|
|
89
95
|
search_position = 0
|
90
96
|
string = string.clone
|
91
97
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
original_macro = matches[1] || matches[2] || matches[3]
|
97
|
-
delimiter_length = matches[3] ? 0 : 3 # $() or ${}
|
98
|
-
delimiter_offset = matches[3] ? 0 : 2 # $( or ${
|
98
|
+
while (matches = /\$\(([^(){}]*)\)|\$\{([^(){}]*)\}/.match(string, search_position))
|
99
|
+
original_macro = matches[1] || matches[2]
|
100
|
+
delimiter_length = 3 # $() or ${}
|
101
|
+
delimiter_offset = 2 # $( or ${
|
99
102
|
search_position = string.index(original_macro) - delimiter_offset
|
100
103
|
|
101
104
|
if (m = /^(.+):(.+)$/.match original_macro)
|
@@ -118,6 +121,15 @@ module Xcodeproj
|
|
118
121
|
string.gsub!(/\$\(#{original_macro}\)|\$\{#{original_macro}\}|^#{original_macro}/, expanded_macro)
|
119
122
|
search_position += expanded_macro.length
|
120
123
|
end
|
124
|
+
|
125
|
+
# HACK: When matching against an xcconfig, as here, sometimes the macro is just returned
|
126
|
+
# without delimiters, e.g. TARGET_NAME or PROJECT_DIR/PROJECT_NAME/BridgingHeader.h. We allow
|
127
|
+
# these two patterns for now.
|
128
|
+
string = string.split("/").map do |component|
|
129
|
+
next component unless component =~ /^[A-Z0-9_]+$/
|
130
|
+
expanded_build_setting(component, configuration) || component
|
131
|
+
end.join("/")
|
132
|
+
|
121
133
|
string
|
122
134
|
end
|
123
135
|
end
|
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.1
|
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-
|
12
|
+
date: 2017-11-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: CFPropertyList
|
@@ -288,6 +288,8 @@ files:
|
|
288
288
|
- lib/assets/patches/open_url_swift.yml
|
289
289
|
- lib/assets/patches/swift_import.yml
|
290
290
|
- lib/assets/templates/command.erb
|
291
|
+
- lib/assets/templates/completion.bash.erb
|
292
|
+
- lib/assets/templates/completion.zsh.erb
|
291
293
|
- lib/assets/templates/program_description.erb
|
292
294
|
- lib/assets/templates/report_description.erb
|
293
295
|
- lib/assets/templates/setup_description.erb
|
@@ -313,6 +315,7 @@ files:
|
|
313
315
|
- lib/branch_io_cli/format.rb
|
314
316
|
- lib/branch_io_cli/format/highline_format.rb
|
315
317
|
- lib/branch_io_cli/format/markdown_format.rb
|
318
|
+
- lib/branch_io_cli/format/shell_format.rb
|
316
319
|
- lib/branch_io_cli/helper.rb
|
317
320
|
- lib/branch_io_cli/helper/android_helper.rb
|
318
321
|
- lib/branch_io_cli/helper/branch_helper.rb
|