branch_io_cli 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -0
- data/lib/assets/completions/completion.bash +2 -1
- data/lib/branch_io_cli/cli.rb +5 -2
- data/lib/branch_io_cli/commands/report_command.rb +58 -1
- data/lib/branch_io_cli/commands/setup_command.rb +41 -0
- data/lib/branch_io_cli/helper/configuration_helper.rb +3 -1
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 989a943d54479ffb6d3267bdf57872a68597f9d77675add48c258a2ab915baf1
|
4
|
+
data.tar.gz: 4f3eb86d6364cba95221dbd6f29e84ba725ab1c04034abd49ee452930a88ba99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc1488e06f6518d460b7095f01bd5ec28f27c53a1f3799acccab60e2924addb0f6679d4956332384794e7dedca39e1505bce0f5576085d8d418604d64d6b478
|
7
|
+
data.tar.gz: 686b31264af06559b23f2d2e39713aac5df2f50802c82de3f459157722afa14c816feac24b2b148dc60160ca4bd59c1a36ab9747a7745a32b0214972c480dcb9
|
data/README.md
CHANGED
@@ -233,6 +233,7 @@ report with additional diagnostic information suitable for opening a support tic
|
|
233
233
|
|--sdk iphonesimulator|Name of an SDK to use with xcodebuild (default: iphonesimulator)|
|
234
234
|
|--[no-]clean|Clean before building (default: yes)|
|
235
235
|
|--[no-]header-only|Show a diagnostic header and exit without cleaning or building (default: no)|
|
236
|
+
|--[no-]pod-repo-update|Update the local podspec repo before installing (default: yes)|
|
236
237
|
|--podfile /path/to/Podfile|Path to the Podfile for the project|
|
237
238
|
|--cartfile /path/to/Cartfile|Path to the Cartfile for the project|
|
238
239
|
|--out ./report.txt|Path to use for the generated report (default: ./report.txt)|
|
@@ -18,7 +18,8 @@ _branch_io_complete()
|
|
18
18
|
|
19
19
|
validate_opts="$global_opts -D --domains --xcodeproj --target"
|
20
20
|
|
21
|
-
report_opts="$global_opts --xcodeproj --workspace --header-only --no-clean --scheme --target --configuration --out"
|
21
|
+
report_opts="$global_opts --xcodeproj --workspace --header-only --no-clean --scheme --target --configuration --sdk --out"
|
22
|
+
report_opts="$global_opts --podfile --cartfile --no-pod-repo-update"
|
22
23
|
|
23
24
|
if [[ ${cur} == -* ]] ; then
|
24
25
|
case "${cmd}" in
|
data/lib/branch_io_cli/cli.rb
CHANGED
@@ -168,14 +168,17 @@ EOF
|
|
168
168
|
c.option "--cartfile /path/to/Cartfile", String, "Path to the Cartfile for the project"
|
169
169
|
c.option "--[no-]clean", "Clean before attempting to build (default: yes)"
|
170
170
|
c.option "--[no-]header-only", "Write a report header to standard output and exit"
|
171
|
-
c.option "--
|
171
|
+
c.option "--[no-]pod-repo-update", "Update the local podspec repo before installing (default: yes)"
|
172
|
+
c.option "--out ./report.txt", String, "Report output path (default: ./report.txt)"
|
172
173
|
|
173
174
|
c.action do |args, options|
|
174
175
|
options.default(
|
175
176
|
clean: true,
|
176
177
|
header_only: false,
|
177
178
|
configuration: "Release",
|
178
|
-
sdk: "iphonesimulator"
|
179
|
+
sdk: "iphonesimulator",
|
180
|
+
out: "./report.txt",
|
181
|
+
pod_repo_update: true
|
179
182
|
)
|
180
183
|
Commands::ReportCommand.new(options).run!
|
181
184
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "cocoapods-core"
|
2
|
+
require "branch_io_cli/helper/methods"
|
2
3
|
|
3
4
|
module BranchIOCLI
|
4
5
|
module Commands
|
@@ -16,6 +17,32 @@ module BranchIOCLI
|
|
16
17
|
exit 0
|
17
18
|
end
|
18
19
|
|
20
|
+
# Only if a Podfile is detected/supplied at the command line.
|
21
|
+
if pod_install_required?
|
22
|
+
say "pod install required in order to build."
|
23
|
+
install = ask %{Run "pod install" now (Y/n)? }
|
24
|
+
if install.downcase =~ /^n/
|
25
|
+
say %{Please run "pod install" or "pod update" first in order to continue.}
|
26
|
+
exit(-1)
|
27
|
+
end
|
28
|
+
|
29
|
+
helper.verify_cocoapods
|
30
|
+
|
31
|
+
install_command = "pod install"
|
32
|
+
|
33
|
+
if config_helper.pod_repo_update
|
34
|
+
install_command += " --repo-update"
|
35
|
+
else
|
36
|
+
say <<EOF
|
37
|
+
You have disabled "pod repo update". This can cause "pod install" to fail in
|
38
|
+
some cases. If that happens, please rerun without --no-pod-repo-update or run
|
39
|
+
"pod install --repo-update" manually.
|
40
|
+
EOF
|
41
|
+
end
|
42
|
+
|
43
|
+
sh install_command
|
44
|
+
end
|
45
|
+
|
19
46
|
File.open config_helper.report_path, "w" do |report|
|
20
47
|
report.write "Branch.io Xcode build report v #{VERSION} #{DateTime.now}\n\n"
|
21
48
|
report.write "#{report_configuration}\n"
|
@@ -153,13 +180,42 @@ Configuration: #{config_helper.configuration || '(none)'}
|
|
153
180
|
SDK: #{config_helper.sdk}
|
154
181
|
Podfile: #{config_helper.podfile_path || '(none)'}
|
155
182
|
Cartfile: #{config_helper.cartfile_path || '(none)'}
|
183
|
+
Pod repo update: #{config_helper.pod_repo_update.inspect}
|
156
184
|
Clean: #{config_helper.clean.inspect}
|
157
185
|
EOF
|
158
186
|
end
|
159
187
|
|
188
|
+
def pod_install_required?
|
189
|
+
# If this is set, its existence has been verified.
|
190
|
+
return false unless config_helper.podfile_path
|
191
|
+
|
192
|
+
lockfile_path = "#{config_helper.podfile_path}.lock"
|
193
|
+
manifest_path = File.expand_path "../Pods/Manifest.lock", config_helper.podfile_path
|
194
|
+
|
195
|
+
return true unless File.exist?(lockfile_path) && File.exist?(manifest_path)
|
196
|
+
|
197
|
+
podfile = Pod::Podfile.from_file Pathname.new config_helper.podfile_path
|
198
|
+
lockfile = Pod::Lockfile.from_file Pathname.new lockfile_path
|
199
|
+
manifest = Pod::Lockfile.from_file Pathname.new manifest_path
|
200
|
+
|
201
|
+
# diff the contents of Podfile.lock and Pods/Manifest.lock
|
202
|
+
# This is just what is done in the "[CP] Check Pods Manifest.lock" script build phase
|
203
|
+
# in a project using CocoaPods.
|
204
|
+
return true unless lockfile == manifest
|
205
|
+
|
206
|
+
# compare checksum of Podfile with checksum in Podfile.lock
|
207
|
+
# This is a good sanity check, but perhaps unnecessary. It means pod install
|
208
|
+
# has not been run since the Podfile was modified, which is probably an oversight.
|
209
|
+
return true unless lockfile.to_hash["PODFILE CHECKSUM"] == podfile.checksum
|
210
|
+
|
211
|
+
false
|
212
|
+
end
|
213
|
+
|
160
214
|
# rubocop: disable Metrics/PerceivedComplexity
|
161
215
|
def report_header
|
162
|
-
header =
|
216
|
+
header = "cocoapods-core: #{Pod::CORE_VERSION}\n"
|
217
|
+
|
218
|
+
header += `xcodebuild -version`
|
163
219
|
|
164
220
|
header += "\nTarget #{config_helper.target.name} deploy target: #{config_helper.target.deployment_target}\n"
|
165
221
|
|
@@ -202,6 +258,7 @@ EOF
|
|
202
258
|
header += "Target #{config_helper.target.name.inspect} not found in Podfile.\n"
|
203
259
|
end
|
204
260
|
|
261
|
+
header += "\npod install #{pod_install_required? ? '' : 'not '}required.\n"
|
205
262
|
end
|
206
263
|
|
207
264
|
if config_helper.cartfile_path
|
@@ -12,6 +12,9 @@ module BranchIOCLI
|
|
12
12
|
|
13
13
|
# rubocop: disable Metrics/PerceivedComplexity
|
14
14
|
def run!
|
15
|
+
# Make sure the user stashes or commits before continuing.
|
16
|
+
check_repo_status
|
17
|
+
|
15
18
|
xcodeproj = config_helper.xcodeproj
|
16
19
|
|
17
20
|
case config_helper.sdk_integration_mode
|
@@ -63,6 +66,44 @@ module BranchIOCLI
|
|
63
66
|
sh "git commit -qm '[branch_io_cli] Branch SDK integration' #{changes.join(' ')}"
|
64
67
|
end
|
65
68
|
# rubocop: enable Metrics/PerceivedComplexity
|
69
|
+
|
70
|
+
def check_repo_status
|
71
|
+
# If the git command is not installed, there's not much we can do.
|
72
|
+
# Don't want to use verify_git here, which will insist on installing
|
73
|
+
# the command. The logic of that method could change.
|
74
|
+
return if `which git`.empty?
|
75
|
+
|
76
|
+
unless Dir.exist? ".git"
|
77
|
+
`git rev-parse --git-dir > /dev/null 2>&1`
|
78
|
+
# Not a git repo
|
79
|
+
return unless $?.success?
|
80
|
+
end
|
81
|
+
|
82
|
+
`git diff-index --quiet HEAD --`
|
83
|
+
return if $?.success?
|
84
|
+
|
85
|
+
# Show the user
|
86
|
+
sh "git status"
|
87
|
+
|
88
|
+
choice = choose do |menu|
|
89
|
+
menu.header = "There are uncommitted changes in this repo. It's best to stash or commit them before continuing."
|
90
|
+
menu.choice "Stash"
|
91
|
+
menu.choice "Commit (you will be prompted for a commit message)"
|
92
|
+
menu.choice "Quit"
|
93
|
+
menu.prompt = "Please enter one of the options above: "
|
94
|
+
end
|
95
|
+
|
96
|
+
case choice
|
97
|
+
when /^Stash/
|
98
|
+
sh "git stash -q"
|
99
|
+
when /^Commit/
|
100
|
+
message = ask "Please enter a commit message: "
|
101
|
+
sh "git commit -aqm'#{message}'"
|
102
|
+
else
|
103
|
+
say "Please stash or commit your changes before continuing."
|
104
|
+
exit(-1)
|
105
|
+
end
|
106
|
+
end
|
66
107
|
end
|
67
108
|
end
|
68
109
|
end
|
@@ -100,8 +100,9 @@ module BranchIOCLI
|
|
100
100
|
@scheme = options.scheme
|
101
101
|
@target = options.target
|
102
102
|
@configuration = options.configuration
|
103
|
-
@report_path = options.out
|
103
|
+
@report_path = options.out
|
104
104
|
@sdk = options.sdk
|
105
|
+
@pod_repo_update = options.pod_repo_update
|
105
106
|
|
106
107
|
validate_xcodeproj_and_workspace options
|
107
108
|
validate_target options
|
@@ -174,6 +175,7 @@ EOF
|
|
174
175
|
<%= color('SDK:', BOLD) %> #{@sdk}
|
175
176
|
<%= color('Podfile:', BOLD) %> #{@podfile_path || '(none)'}
|
176
177
|
<%= color('Cartfile:', BOLD) %> #{@cartfile_path || '(none)'}
|
178
|
+
<%= color('Pod repo update:', BOLD) %> #{@pod_repo_update.inspect}
|
177
179
|
<%= color('Clean:', BOLD) %> #{@clean.inspect}
|
178
180
|
<%= color('Report path:', BOLD) %> #{@report_path}
|
179
181
|
EOF
|
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Branch
|
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
288
|
rubyforge_project:
|
289
|
-
rubygems_version: 2.
|
289
|
+
rubygems_version: 2.7.0
|
290
290
|
signing_key:
|
291
291
|
specification_version: 4
|
292
292
|
summary: Branch.io command-line interface for mobile app integration
|