cocoapods-multithread-installpod 0.0.2 → 0.0.4
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 +4 -4
- data/lib/cocoapods-multithread-installpod.rb +116 -38
- data/lib/cocoapods-multithread-installpod/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6001a9022306eafedac367ed981dc514ed5e8e92
|
4
|
+
data.tar.gz: bc6937c40ecad7ea1430ea5e7ac76dc4d2e5d50a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a310bbdb2485ce016e56424d092961366387b3468da3a24c26127ba6b21b80231f21e39e21192caf212b5f240ed9565308d4dc934b4d79e37455364e0cfd1bf6
|
7
|
+
data.tar.gz: 3e48be4c22d98ac89883f2945dc352850378d7b1bd98c692490d52a32cccdd7f5f58d63c037012c9320a74bcc2c6279378565a3bd8caf663b3fb96063bca3363
|
@@ -1,57 +1,135 @@
|
|
1
1
|
require "cocoapods-multithread-installpod/version"
|
2
|
+
require 'thread'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
4
|
+
if Pod::VERSION=='0.39.0'
|
5
|
+
module Pod
|
6
|
+
class Installer
|
7
|
+
def install_pod_sources
|
8
|
+
@installed_specs = []
|
9
|
+
pods_to_install = sandbox_state.added | sandbox_state.changed
|
10
|
+
title_options = { :verbose_prefix => '-> '.green }
|
11
|
+
|
12
|
+
work_q = Queue.new
|
13
|
+
root_specs.sort_by(&:name).each{|spec| work_q.push spec }
|
14
|
+
workers = (0...20).map do
|
15
|
+
Thread.new do
|
16
|
+
begin
|
17
|
+
while spec = work_q.pop(true)
|
18
|
+
if pods_to_install.include?(spec.name)
|
19
|
+
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
|
20
|
+
previous = sandbox.manifest.version(spec.name)
|
21
|
+
title = "Installing #{spec.name} #{spec.version} (was #{previous})"
|
22
|
+
else
|
23
|
+
title = "Installing #{spec}"
|
24
|
+
end
|
25
|
+
UI.titled_section(title.green, title_options) do
|
26
|
+
install_source_of_pod(spec.name)
|
27
|
+
#UI.titled_section("Installed #{spec}", title_options)
|
28
|
+
end
|
23
29
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
UI.titled_section("Using #{spec}", title_options) do
|
31
|
+
create_pod_installer(spec.name)
|
32
|
+
#UI.titled_section("Installed #{spec}", title_options)
|
33
|
+
end
|
28
34
|
end
|
29
|
-
else
|
30
|
-
UI.titled_section("Using #{spec}", title_options)
|
31
35
|
end
|
36
|
+
rescue ThreadError
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
35
|
-
|
40
|
+
workers.map(&:join)
|
41
|
+
|
36
42
|
end
|
37
|
-
threads.each{|t| t.join}
|
38
43
|
end
|
39
|
-
end
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
|
46
|
+
module Downloader
|
47
|
+
# The class responsible for managing Pod downloads, transparently caching
|
48
|
+
# them in a cache directory.
|
49
|
+
#
|
50
|
+
class Cache
|
51
|
+
@@mutex=Mutex.new
|
52
|
+
def ensure_matching_version
|
53
|
+
@@mutex.lock
|
54
|
+
version_file = root + 'VERSION'
|
55
|
+
version = version_file.read.strip if version_file.file?
|
56
|
+
|
57
|
+
root.rmtree if version != Pod::VERSION && root.exist?
|
58
|
+
root.mkpath
|
59
|
+
version_file.open('w') { |f| f << Pod::VERSION }
|
60
|
+
@@mutex.unlock
|
50
61
|
end
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
54
65
|
|
66
|
+
elsif Pod::VERSION=='0.35.0'
|
67
|
+
module Pod
|
68
|
+
class Installer
|
69
|
+
def install_pod_sources
|
70
|
+
@installed_specs = []
|
71
|
+
pods_to_install = sandbox_state.added | sandbox_state.changed
|
72
|
+
title_options = { :verbose_prefix => '-> '.green }
|
73
|
+
sorted_root_specs = root_specs.sort_by(&:name)
|
74
|
+
threads=[]
|
75
|
+
max_thread_count = 20.0
|
76
|
+
per_thead_task_count =(sorted_root_specs.count/max_thread_count).ceil
|
77
|
+
i = 0
|
78
|
+
while i < max_thread_count
|
79
|
+
sub_sorted_root_specs = sorted_root_specs[i*per_thead_task_count, per_thead_task_count]
|
80
|
+
if sub_sorted_root_specs != nil
|
81
|
+
threads << Thread.new(sub_sorted_root_specs) do |specs|
|
82
|
+
specs.each do |spec|
|
83
|
+
if pods_to_install.include?(spec.name)
|
84
|
+
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
|
85
|
+
previous = sandbox.manifest.version(spec.name)
|
86
|
+
title = "Installing #{spec.name} #{spec.version} (was #{previous})"
|
87
|
+
else
|
88
|
+
title = "Installing #{spec}"
|
89
|
+
end
|
90
|
+
UI.titled_section(title.green, title_options) do
|
91
|
+
install_source_of_pod(spec.name)
|
92
|
+
end
|
93
|
+
else
|
94
|
+
UI.titled_section("Using #{spec}", title_options)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
i+=1
|
100
|
+
end
|
101
|
+
threads.each{|t| t.join}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
module UserInterface
|
106
|
+
class << self
|
107
|
+
def wrap_string(string, indent = 0)
|
108
|
+
if disable_wrap
|
109
|
+
string
|
110
|
+
else
|
111
|
+
first_space = ' ' * indent
|
112
|
+
# indented = CLAide::Helper.wrap_with_indent(string, indent, 9999)
|
113
|
+
# first_space + indented
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
55
119
|
end
|
56
120
|
|
57
121
|
|
122
|
+
# module UserInterface
|
123
|
+
# class << self
|
124
|
+
# def wrap_string(string, indent = 0)
|
125
|
+
# if disable_wrap
|
126
|
+
# string
|
127
|
+
# else
|
128
|
+
# first_space = ' ' * indent
|
129
|
+
# # indented = CLAide::Helper.wrap_with_indent(string, indent, 9999)
|
130
|
+
# # first_space + indented
|
131
|
+
# end
|
132
|
+
# end
|
133
|
+
# end
|
134
|
+
# end
|
135
|
+
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-multithread-installpod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 晨燕
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cocoapods
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: 将cocoapods installer过程中download_dependencies改为20个线程并发,提高pod update的效率
|
@@ -71,12 +71,12 @@ require_paths:
|
|
71
71
|
- lib
|
72
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|