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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e5aed004a45c8ab9ba1551d603e972affbc07660351c1495d378e9d08492452
4
- data.tar.gz: 54786f9bcb72a71855dab1575482a964b26779c6a3b6fd4a8053cbe553c33507
3
+ metadata.gz: 73ff4ce1216540062fb5538541b2872eec3acdebb1471fa7a8b24d2154a3fcfe
4
+ data.tar.gz: d4b975f00a121acb6ea440e0fdd25de305a00e82625a2469742a07b790cb64ed
5
5
  SHA512:
6
- metadata.gz: 434932c0f1da70515c63b5d069a2171ea5bac2109cd47ad405b3a057a98bad4a145c52316616a12ff31bd8cff84761373ea47e5b51b918160070f9c3c418ae36
7
- data.tar.gz: 4cfdc82ca1e78119bb0e3fa9a1d1a5c0b82eba4e38292f443aee726900e6f709cde5f22959aebf60637bee42ede08d00a81d0bc57a1ac9a025ca1dab0ed90185
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
- branch_io setup -L key_live_xxxx -D myapp.app.link --no-validate
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
- branch_io setup -L key_live_xxxx -T key_test_yyyy -D myapp.app.link
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
- branch_io setup -D myapp.app.link,example.com,www.example.com
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
- branch_io setup --no-pod-repo-update
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
- branch_io --carthage-command "bootstrap --no-use-binaries"
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
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require "branch_io_cli"
4
+
5
+ BranchIOCLI::CLI.new.run
@@ -0,0 +1,6 @@
1
+ ____ _
2
+ | _ \ | |
3
+ | |_) |_ __ __ _ _ __ ___| |__
4
+ | _ <| '__/ _` | '_ \ / __| '_ \
5
+ | |_) | | | (_| | | | | (__| | | |
6
+ |____/|_| \__,_|_| |_|\___|_| |_|
@@ -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
@@ -11,3 +11,4 @@ _branch_io_complete() {
11
11
  }
12
12
 
13
13
  compctl -K _branch_io_complete branch_io
14
+ compctl -K _branch_io_complete br
@@ -2,6 +2,7 @@
2
2
 
3
3
  ```bash
4
4
  branch_io <%= @command.command_name %> [OPTIONS]
5
+ br <%= @command.command_name %> [OPTIONS]
5
6
  ```
6
7
 
7
8
  <%= render "#{@command.command_name}_description" %>
@@ -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
@@ -11,3 +11,4 @@ _branch_io_complete() {
11
11
  }
12
12
 
13
13
  compctl -K _branch_io_complete branch_io
14
+ compctl -K _branch_io_complete br
@@ -1,3 +1,4 @@
1
+ require "branch_io_cli/ascii_art"
1
2
  require "branch_io_cli/cli"
2
3
  require "branch_io_cli/command"
3
4
  require "branch_io_cli/configuration"
@@ -0,0 +1,5 @@
1
+ module BranchIOCLI
2
+ # Courtesy of artii https://github.com/miketierney/artii
3
+ # artii Branch
4
+ ASCII_ART = File.read(File.expand_path(File.join("..", "..", "assets", "artwork", "branch_ascii_art.txt"), __FILE__))
5
+ end
@@ -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
- all_xcodeproj_paths = Dir[File.expand_path(File.join(".", "**/*.xcodeproj"))]
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
- begin
166
- @xcodeproj = Xcodeproj::Project.open path
167
- @xcodeproj_path = File.expand_path path
168
- return
169
- rescue StandardError => e
170
- say e.message
171
- path = nil
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
- # rubocop: disable Metrics/PerceivedComplexity
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
- # 1. What was passed in?
78
- begin
79
- if options.workspace
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
- all_workspace_paths = Dir[File.expand_path(File.join(".", "**/*.xcworkspace"))]
102
- .reject { |w| w =~ %r{/project.xcworkspace$} }
103
- .select do |p|
104
- valid = true
105
- Pathname.new(p).each_filename do |f|
106
- valid = false && break if f == "Carthage" || f == "Pods"
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
- if all_workspace_paths.count == 1
112
- path = all_workspace_paths.first
113
- elsif all_workspace_paths.count == 0
114
- all_xcodeproj_paths = Dir[File.expand_path(File.join(".", "**/*.xcodeproj"))]
115
- xcodeproj_paths = all_xcodeproj_paths.select do |p|
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
- path = xcodeproj_paths.first if xcodeproj_paths.count == 1
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
- loop do
128
- path = ask "Please enter a path to your Xcode project or workspace: " if path.nil?
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)" => "branch_io setup -L key_live_xxxx -D myapp.app.link --no-validate",
12
- "Use both live and test keys" => "branch_io setup -L key_live_xxxx -T key_test_yyyy -D myapp.app.link",
13
- "Use custom or non-Branch domains" => "branch_io setup -D myapp.app.link,example.com,www.example.com",
14
- "Avoid pod repo update" => "branch_io setup --no-pod-repo-update",
15
- "Install using carthage bootstrap" => "branch_io --carthage-command \"bootstrap --no-use-binaries\""
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)
@@ -1,3 +1,3 @@
1
1
  module BranchIOCLI
2
- VERSION = "0.12.3"
2
+ VERSION = "0.12.4"
3
3
  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.3
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-08 00:00:00.000000000 Z
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