branch_io_cli 0.13.0.pre.2 → 0.13.0.pre.3

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: 4bbc782e922e498b04f39138c04d0f2ca7ee5c1df7b275b0301765b4f96795dd
4
- data.tar.gz: 91eaf176be8ae4ff130714918180f1fb7e6b3cea05d10938ec22b7c6973c58a6
3
+ metadata.gz: ee99cff6322494617b1f861fc6ad11183ab9a01aa63a42ba82227d9b39a9fe3d
4
+ data.tar.gz: a839c62538cbbaac75092ccff4839690c08db40afbca601a10b8e975fd852aad
5
5
  SHA512:
6
- metadata.gz: 797fa7dc2c642e125bca2da9220ef0380310ed3a08c4bcf538c7c33474faa61379eddfbee61cae20e4c2ec1388adfe2a7f4d20089d69992ca99105a7035d49c6
7
- data.tar.gz: 7e872acd6813a7d522ffb16af73fe96eac37f6e0cf25a02ac7f5c5a257047a23e21157616ed762ce5af84ad20e4b819399396c498be0bf4ebf6af689f378945e
6
+ metadata.gz: 7c05c8fe31189de008432b4b335cb325674da560e5e0a729526b365f2cd35ef19968d35aee353c84d5c8230ebafc032dbbfaef56d3e0c0a975086d55e33bdcbc
7
+ data.tar.gz: b86d7cf8f6c0570347bf81bdf96ac58f09059d23af4def9b2395e7fc675a782384ed1f0a560ac8a1655f4f0db30689b3b7c70592ce4e00f19386a9fa5bd416e6
@@ -2,7 +2,9 @@ require "active_support/core_ext/hash"
2
2
  require_relative "android_helper"
3
3
  require_relative "ios_helper"
4
4
  require "net/http"
5
+ require "pastel"
5
6
  require "set"
7
+ require "tty/progressbar"
6
8
  require "tty/spinner"
7
9
 
8
10
  module BranchIOCLI
@@ -42,11 +44,9 @@ module BranchIOCLI
42
44
  end
43
45
  end
44
46
 
45
- def download(url, dest, spin: true)
47
+ def download(url, dest, size: nil)
46
48
  uri = URI(url)
47
49
 
48
- @spinner = TTY::Spinner.new "[:spinner] GET #{uri}.", format: :flip if spin
49
-
50
50
  Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
51
51
  request = Net::HTTP::Get.new uri
52
52
 
@@ -54,9 +54,12 @@ module BranchIOCLI
54
54
  case response
55
55
  when Net::HTTPSuccess
56
56
  bytes_downloaded = 0
57
- dots_reported = 0
58
- # spin every 100 kB
59
- per_dot = 102_400
57
+ if size
58
+ pastel = Pastel.new
59
+ green = pastel.on_green " "
60
+ yellow = pastel.on_yellow " "
61
+ progress = TTY::ProgressBar.new "[:bar] :percent (:eta)", total: 50, complete: green, incomplete: yellow
62
+ end
60
63
 
61
64
  File.open dest, 'w' do |io|
62
65
  response.read_body do |chunk|
@@ -64,19 +67,13 @@ module BranchIOCLI
64
67
 
65
68
  # print progress
66
69
  bytes_downloaded += chunk.length
67
- while (bytes_downloaded - per_dot * dots_reported) >= per_dot
68
- @spinner.spin
69
- dots_reported += 1
70
- end
70
+ progress.ratio = bytes_downloaded.to_f / size.to_f if size
71
71
  end
72
72
  end
73
- @spinner.success "#{response.code} #{response.message}" if @spinner
74
- @spinner = nil
73
+ progress.finish if size
75
74
  when Net::HTTPRedirection
76
- download response['location'], dest, spin: false
75
+ download response['location'], dest, size: size
77
76
  else
78
- @spinner.error "#{response.code} #{response.message}" if @spinner
79
- @spinner = nil
80
77
  raise "Error downloading #{url}: #{response.code} #{response.message}"
81
78
  end
82
79
  end
@@ -135,7 +135,7 @@ github "BranchMetrics/ios-branch-deep-linking"
135
135
  File.unlink zip_path if File.exist? zip_path
136
136
 
137
137
  # Download the framework zip
138
- helper.download framework_url, zip_path
138
+ helper.download framework_url, zip_path, size: framework_asset["size"]
139
139
 
140
140
  say "Unzipping Branch.framework"
141
141
 
@@ -1,3 +1,3 @@
1
1
  module BranchIOCLI
2
- VERSION = "0.13.0.pre.2"
2
+ VERSION = "0.13.0.pre.3"
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.13.0.pre.2
4
+ version: 0.13.0.pre.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Branch
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '4.4'
56
+ - !ruby/object:Gem::Dependency
57
+ name: pastel
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.7'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.7'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: pattern_patch
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +129,20 @@ dependencies:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
131
  version: '0.1'
132
+ - !ruby/object:Gem::Dependency
133
+ name: tty-progressbar
134
+ requirement: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.13'
139
+ type: :runtime
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.13'
118
146
  - !ruby/object:Gem::Dependency
119
147
  name: tty-spinner
120
148
  requirement: !ruby/object:Gem::Requirement