bootic_cli 0.2.0.pre1 → 0.2.0.pre2

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
  SHA1:
3
- metadata.gz: 912137c9b982caccf6e5c4fbe6a0cf7aff82cf5e
4
- data.tar.gz: 0a33582b05a274372b79c60b65b32d37e34097dd
3
+ metadata.gz: 795e7e632b2f62eb68ff13a89d71a6cc89bc98a0
4
+ data.tar.gz: bf3bba8b29114d3119d69ab5e8b198c9666f3175
5
5
  SHA512:
6
- metadata.gz: eb4aafc997f9bda07cf351ca67fccdc89de4e241e80d079111e4585406be075ef1af4979d1d636b4f121389b1215416d91a511a55e56fadf1f2d0a595aaee91a
7
- data.tar.gz: 9725a2def7ec18acad6e18abf2a35fffc9615acfca0ac72aa5042c5b959989beea68e471c320112755fca38d815231bfb818fd976f6ded4744e350490e4f2a5d
6
+ metadata.gz: 3596f84b3509fee62dea7bbb970dc3b38a6bd4517ad39f6af098ee5ba42710b10f81f471b6a659e3c9841ea1ce2cee887a937b385ceadb1757bb33119c7520cd
7
+ data.tar.gz: 81f1e41c3d9b100ad5788f1bfddd6d7733a7d7940781af47240d728a7fc871e8c5826fdaaf6c6212876d1ca4cf702c89601e38186307f305bfd663657b6a4cd7
@@ -1,5 +1,5 @@
1
1
  require 'time'
2
- require 'open-uri'
2
+ require 'net/http'
3
3
 
4
4
  module BooticCli
5
5
  module Themes
@@ -11,7 +11,10 @@ module BooticCli
11
11
 
12
12
  class APIAsset < ItemWithTime
13
13
  def file
14
- @file ||= open(rels[:file].href)
14
+ @file ||= (
15
+ data = Net::HTTP.get(URI.parse(rels[:file].href))
16
+ StringIO.new(data)
17
+ )
15
18
  end
16
19
  end
17
20
 
@@ -2,6 +2,7 @@ require 'listen'
2
2
  require 'thread'
3
3
  require 'bootic_cli/themes/theme_diff'
4
4
  require 'bootic_cli/themes/fs_theme'
5
+ require 'bootic_cli/worker_pool'
5
6
 
6
7
  module BooticCli
7
8
  module Themes
@@ -24,6 +25,8 @@ module BooticCli
24
25
  end
25
26
 
26
27
  class Workflows
28
+ CONCURRENCY = 10
29
+
27
30
  def initialize(prompt: NullPrompt)
28
31
  @prompt = prompt
29
32
  end
@@ -260,10 +263,16 @@ module BooticCli
260
263
  end
261
264
  end
262
265
 
266
+ pool = BooticCli::WorkerPool.new(CONCURRENCY)
267
+
263
268
  files.each do |a|
264
- to.add_asset a.file_name, a.file
265
- puts "Copied asset #{a.file_name}"
269
+ pool.schedule do
270
+ to.add_asset a.file_name, a.file
271
+ puts "Copied asset #{a.file_name}"
272
+ end
266
273
  end
274
+
275
+ pool.start
267
276
  end
268
277
 
269
278
  def upsert_file(theme, path)
@@ -1,3 +1,3 @@
1
1
  module BooticCli
2
- VERSION = "0.2.0.pre1"
2
+ VERSION = "0.2.0.pre2"
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'thread'
2
+ module BooticCli
3
+ class WorkerPool
4
+ def initialize(how_many)
5
+ @how_many = how_many
6
+ @queue = Queue.new
7
+ end
8
+
9
+ def schedule(&block)
10
+ @queue.push block
11
+ end
12
+
13
+ def start
14
+ threads = @how_many.times.map do |i|
15
+ Thread.new do
16
+ begin
17
+ while job = @queue.pop(true)
18
+ job.call
19
+ end
20
+ rescue ThreadError
21
+ end
22
+ end
23
+ end
24
+ threads.map(&:join)
25
+ end
26
+ end
27
+ end
28
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootic_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre1
4
+ version: 0.2.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -175,6 +175,7 @@ files:
175
175
  - lib/bootic_cli/themes/updated_theme.rb
176
176
  - lib/bootic_cli/themes/workflows.rb
177
177
  - lib/bootic_cli/version.rb
178
+ - lib/bootic_cli/worker_pool.rb
178
179
  homepage: http://www.bootic.net
179
180
  licenses:
180
181
  - MIT
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  version: 1.3.1
199
200
  requirements: []
200
201
  rubyforge_project:
201
- rubygems_version: 2.6.13
202
+ rubygems_version: 2.6.8
202
203
  signing_key:
203
204
  specification_version: 4
204
205
  summary: Bootic command line.