branch_io_cli 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d162acf761ea219b350dd56f71eeced3220beea
|
4
|
+
data.tar.gz: e1417382cbc30b4d92d94268a7e5eb789492f9b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70795421103af48548a3181849b1cc7dc399ed19034522582adcb46442a3654f7931cfeda9a804ace14d5f9aad285f3d10526b65ef1ad8c973022939b316801b
|
7
|
+
data.tar.gz: b53517cf8c3841cd5e6d7ce2531902beed7679dc1426ea4d46697de7c9415ea435c6bbd72192d0b6272ce3310dfe34b3e96b4debe39adf875c611fc78f7a9bc1
|
@@ -42,8 +42,7 @@ module BranchIOCLI
|
|
42
42
|
|
43
43
|
return unless options.commit
|
44
44
|
|
45
|
-
|
46
|
-
changes = helper.changes.to_a.map { |c| Pathname.new(File.expand_path(c)).relative_path_from(current_pathname).to_s }
|
45
|
+
changes = helper.changes.to_a.map { |c| Pathname.new(File.expand_path(c)).relative_path_from(Pathname.pwd).to_s }
|
47
46
|
|
48
47
|
`git commit #{changes.join(" ")} -m '[branch_io_cli] Branch SDK integration'`
|
49
48
|
end
|
@@ -115,8 +114,7 @@ module BranchIOCLI
|
|
115
114
|
helper.add_change "#{podfile_path}.lock"
|
116
115
|
|
117
116
|
# 4. Check if Pods folder is under SCM
|
118
|
-
|
119
|
-
pods_folder_path = Pathname.new(File.expand_path("../Pods", podfile_path)).relative_path_from current_pathname
|
117
|
+
pods_folder_path = Pathname.new(File.expand_path("../Pods", podfile_path)).relative_path_from Pathname.pwd
|
120
118
|
`git ls-files #{pods_folder_path} --error-unmatch > /dev/null 2>&1`
|
121
119
|
return true unless $?.exitstatus == 0
|
122
120
|
|
@@ -143,10 +141,10 @@ module BranchIOCLI
|
|
143
141
|
helper.add_change cartfile_path
|
144
142
|
helper.add_change "#{cartfile_path}.resolved"
|
145
143
|
|
146
|
-
# 4. Add to target
|
144
|
+
# 4. Add to target dependencies
|
147
145
|
frameworks_group = project.frameworks_group
|
148
146
|
branch_framework = frameworks_group.new_file "Carthage/Build/iOS/Branch.framework"
|
149
|
-
target = ConfigurationHelper.target
|
147
|
+
target = Helper::ConfigurationHelper.target
|
150
148
|
target.frameworks_build_phase.add_file_reference branch_framework
|
151
149
|
|
152
150
|
# 5. Add to copy-frameworks build phase
|
@@ -160,8 +158,7 @@ module BranchIOCLI
|
|
160
158
|
end
|
161
159
|
|
162
160
|
# 6. Check if Carthage folder is under SCM
|
163
|
-
|
164
|
-
carthage_folder_path = Pathname.new(File.expand_path("../Carthage", cartfile_path)).relative_path_from current_pathname
|
161
|
+
carthage_folder_path = Pathname.new(File.expand_path("../Carthage", cartfile_path)).relative_path_from Pathname.pwd
|
165
162
|
`git ls-files #{carthage_folder_path} --error-unmatch > /dev/null 2>&1`
|
166
163
|
return true unless $?.exitstatus == 0
|
167
164
|
|
@@ -78,7 +78,7 @@ EOF
|
|
78
78
|
|
79
79
|
<%= color('Xcode project:', BOLD) %> #{@xcodeproj_path}
|
80
80
|
<%= color('Target:', BOLD) %> #{@target.name}
|
81
|
-
<%= color('Domains:', BOLD) %> #{@all_domains}
|
81
|
+
<%= color('Domains:', BOLD) %> #{@all_domains || '(none)'}
|
82
82
|
EOF
|
83
83
|
end
|
84
84
|
|
@@ -335,10 +335,9 @@ EOF
|
|
335
335
|
BranchHelper.add_change "#{@podfile_path}.lock"
|
336
336
|
|
337
337
|
# For now, add Pods folder to SCM.
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
podfile_pathname = Pathname.new(@podfile_path).relative_path_from current_pathname
|
338
|
+
pods_folder_path = Pathname.new(File.expand_path("../Pods", podfile_path)).relative_path_from Pathname.pwd
|
339
|
+
workspace_path = Pathname.new(File.expand_path(@xcodeproj_path.sub(/.xcodeproj$/, ".xcworkspace"))).relative_path_from Pathname.pwd
|
340
|
+
podfile_pathname = Pathname.new(@podfile_path).relative_path_from Pathname.pwd
|
342
341
|
BranchHelper.add_change pods_folder_path
|
343
342
|
BranchHelper.add_change workspace_path
|
344
343
|
`git add #{podfile_pathname} #{podfile_pathname}.lock #{pods_folder_path} #{workspace_path}` if options.commit
|
@@ -364,7 +363,7 @@ EOF
|
|
364
363
|
BranchHelper.add_change cartfile_path
|
365
364
|
BranchHelper.add_change "#{cartfile_path}.resolved"
|
366
365
|
|
367
|
-
# 4. Add to target
|
366
|
+
# 4. Add to target dependencies
|
368
367
|
frameworks_group = @xcodeproj.frameworks_group
|
369
368
|
branch_framework = frameworks_group.new_file "Carthage/Build/iOS/Branch.framework"
|
370
369
|
target = BranchHelper.target_from_project @xcodeproj, options.target
|
@@ -382,9 +381,8 @@ EOF
|
|
382
381
|
# For now, add Carthage folder to SCM
|
383
382
|
|
384
383
|
# 6. Add the Carthage folder to the commit (in case :commit param specified)
|
385
|
-
|
386
|
-
|
387
|
-
cartfile_pathname = Pathname.new(@cartfile_path).relative_path_from current_pathname
|
384
|
+
carthage_folder_path = Pathname.new(File.expand_path("../Carthage", cartfile_path)).relative_path_from(Pathname.pwd)
|
385
|
+
cartfile_pathname = Pathname.new(@cartfile_path).relative_path_from Pathname.pwd
|
388
386
|
BranchHelper.add_change carthage_folder_path
|
389
387
|
`git add #{cartfile_pathname} #{cartfile_pathname}.resolved #{carthage_folder_path}` if options.commit
|
390
388
|
end
|
@@ -407,9 +405,7 @@ EOF
|
|
407
405
|
say "Downloading Branch.framework v. #{current_release['tag_name']} (#{framework_asset['size']} bytes zipped)..."
|
408
406
|
|
409
407
|
# Download the framework zip
|
410
|
-
|
411
|
-
file.write fetch framework_url
|
412
|
-
end
|
408
|
+
download framework_url, "Branch.framework.zip"
|
413
409
|
|
414
410
|
say "Unzipping Branch.framework..."
|
415
411
|
|
@@ -458,10 +454,35 @@ EOF
|
|
458
454
|
response = Net::HTTP.get_response URI(url)
|
459
455
|
|
460
456
|
case response
|
457
|
+
when Net::HTTPSuccess
|
458
|
+
response.body
|
461
459
|
when Net::HTTPRedirection
|
462
460
|
fetch response['location']
|
463
461
|
else
|
464
|
-
response.
|
462
|
+
raise "Error fetching #{url}: #{response.code} #{response.message}"
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
def download(url, dest)
|
467
|
+
uri = URI(url)
|
468
|
+
|
469
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
470
|
+
request = Net::HTTP::Get.new uri
|
471
|
+
|
472
|
+
http.request request do |response|
|
473
|
+
case response
|
474
|
+
when Net::HTTPSuccess
|
475
|
+
File.open dest, 'w' do |io|
|
476
|
+
response.read_body do |chunk|
|
477
|
+
io.write chunk
|
478
|
+
end
|
479
|
+
end
|
480
|
+
when Net::HTTPRedirection
|
481
|
+
download response['location'], dest
|
482
|
+
else
|
483
|
+
raise "Error downloading #{url}: #{response.code} #{response.message}"
|
484
|
+
end
|
485
|
+
end
|
465
486
|
end
|
466
487
|
end
|
467
488
|
|
@@ -382,7 +382,7 @@ module BranchIOCLI
|
|
382
382
|
|
383
383
|
app_delegate_swift_path = app_delegate_swift.real_path.to_s
|
384
384
|
|
385
|
-
app_delegate = File.
|
385
|
+
app_delegate = File.read app_delegate_swift_path
|
386
386
|
return false if app_delegate =~ /import\s+Branch/
|
387
387
|
|
388
388
|
say "Patching #{app_delegate_swift_path}"
|
@@ -462,7 +462,7 @@ EOF
|
|
462
462
|
|
463
463
|
app_delegate_objc_path = app_delegate_objc.real_path.to_s
|
464
464
|
|
465
|
-
app_delegate = File.
|
465
|
+
app_delegate = File.read app_delegate_objc_path
|
466
466
|
return false if app_delegate =~ %r{^\s+#import\s+<Branch/Branch.h>|^\s+@import\s+Branch;}
|
467
467
|
|
468
468
|
say "Patching #{app_delegate_objc_path}"
|
@@ -536,7 +536,7 @@ EOF
|
|
536
536
|
end
|
537
537
|
|
538
538
|
def patch_open_url_method_swift(app_delegate_swift_path)
|
539
|
-
app_delegate_swift = File.
|
539
|
+
app_delegate_swift = File.read app_delegate_swift_path
|
540
540
|
if app_delegate_swift =~ /application.*open\s+url.*options/
|
541
541
|
# Has application:openURL:options:
|
542
542
|
open_url_text = <<-EOF
|
@@ -590,7 +590,7 @@ EOF
|
|
590
590
|
end
|
591
591
|
|
592
592
|
def patch_open_url_method_objc(app_delegate_objc_path)
|
593
|
-
app_delegate_objc = File.
|
593
|
+
app_delegate_objc = File.read app_delegate_objc_path
|
594
594
|
if app_delegate_objc =~ /application:.*openURL:.*options/
|
595
595
|
# Has application:openURL:options:
|
596
596
|
open_url_text = <<-EOF
|
@@ -644,7 +644,7 @@ EOF
|
|
644
644
|
end
|
645
645
|
|
646
646
|
def patch_podfile(podfile_path)
|
647
|
-
podfile = File.
|
647
|
+
podfile = File.read podfile_path
|
648
648
|
|
649
649
|
# Podfile already contains the Branch pod
|
650
650
|
return false if podfile =~ /pod\s+('Branch'|"Branch")/
|
@@ -663,7 +663,7 @@ EOF
|
|
663
663
|
end
|
664
664
|
|
665
665
|
def patch_cartfile(cartfile_path)
|
666
|
-
cartfile = File.
|
666
|
+
cartfile = File.read cartfile_path
|
667
667
|
|
668
668
|
# Cartfile already contains the Branch framework
|
669
669
|
return false if cartfile =~ /git.+Branch/
|
@@ -673,7 +673,7 @@ EOF
|
|
673
673
|
apply_patch(
|
674
674
|
files: cartfile_path,
|
675
675
|
regexp: /\z/,
|
676
|
-
text: "
|
676
|
+
text: "github \"BranchMetrics/ios-branch-deep-linking\"\n",
|
677
677
|
mode: :append
|
678
678
|
)
|
679
679
|
|
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.
|
4
|
+
version: 0.4.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-10-
|
12
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|