cocoapods-timeconsuming-details 0.0.1 → 0.0.2

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: e2ddde2cc4085177a0280a84686f466f3203a1a6
4
- data.tar.gz: f0f10fd59e98f1ca551ef4bc3a0bbd632de12127
3
+ metadata.gz: f2efcc851e74d54340d20bbbb42101223827fc2b
4
+ data.tar.gz: cbf77404153b73294bae1a28c8096c553ec75c76
5
5
  SHA512:
6
- metadata.gz: 01e6a1e721c7f07d0924fb61ba0a9a9b3c0e1782628f1461ee1c5a0fec0572a24f6e2cfc450abac1ae3cb7dba5b9c538eecf81434ceda48390600a3bdfd4516e
7
- data.tar.gz: 093421da1373acbbd06e1b34af9ed84f33b265f133f61f5ca64d2741147ef0d71388b9f425a284785c04dd977607d576e5ea9bda5c497cbb0aa276beaf87785f
6
+ metadata.gz: aeddadd113df522b1b7a0c23c715710df99aa4cf17d579e3f60a4b489a82f557a9e6359b842a50cad97300dead1a3a62b23d4f5307a48bbaf4088bae51d5539f
7
+ data.tar.gz: e95aa32bf39b0dd59b53561c8637db45b3f0efe14691cafabd0a9db33e973a8a5abdb96d3ec634eb755ca2768f3ccc851efaf20ecba4939f319265dc5d23e83a
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTimeconsumingDetails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -3,7 +3,7 @@ require "cocoapods-timeconsuming-details/version"
3
3
  module Pod
4
4
  class Installer
5
5
 
6
- def timing (method, *argv) #method(:method_name)
6
+ def timing (title, method, *argv) #method(:method_name)
7
7
 
8
8
  start_time = Time.new
9
9
 
@@ -15,7 +15,8 @@ class Installer
15
15
 
16
16
  cost_time = (Time.new.to_f - start_time.to_f)*1000
17
17
 
18
- return cost_time.to_i.to_s
18
+ # return cost_time.to_i.to_s
19
+ puts title + " cost : #{cost_time.to_i} ms";
19
20
  end
20
21
 
21
22
  #-------------------------------------------------------------------------#
@@ -37,12 +38,12 @@ class Installer
37
38
  def install!
38
39
  start_time = Time.new
39
40
 
40
- puts "=> prepare cost : " + timing(method(:prepare)) + " ms";
41
- puts "=> resolve_dependencies cost : " + timing(method(:resolve_dependencies)) + " ms";
42
- puts "=> download_dependencies cost : " + timing(method(:download_dependencies)) + " ms";
43
- puts "=> generate_pods_project cost : " + timing(method(:generate_pods_project)) + " ms";
44
- puts "=> integrate_user_project cost : " + timing(method(:integrate_user_project)) + " ms" if config.integrate_targets?
45
- puts "=> perform_post_install_actions cost : " + timing(method(:perform_post_install_actions)) + " ms";
41
+ timing("=> prepare", method(:prepare));
42
+ timing("=> resolve_dependencies", method(:resolve_dependencies));
43
+ timing("=> download_dependencies", method(:download_dependencies));
44
+ timing("=> generate_pods_project", method(:generate_pods_project));
45
+ timing("=> integrate_user_project", method(:integrate_user_project)) if config.integrate_targets?
46
+ timing("=> perform_post_install_actions", method(:perform_post_install_actions));
46
47
 
47
48
  cost_time = (Time.new.to_f - start_time.to_f)*1000;
48
49
  puts "\e[32m Total cost : #{cost_time.to_i.to_s} ms \e[0m" ;
@@ -50,31 +51,31 @@ class Installer
50
51
 
51
52
  def resolve_dependencies
52
53
  UI.section 'Analyzing dependencies' do
53
- puts "===> analyze cost : " + timing(method(:analyze)) +" ms";
54
- puts "===> validate_build_configurations cost : " + timing(method(:validate_build_configurations)) +" ms";
55
- puts "===> prepare_for_legacy_compatibility cost : " + timing(method(:prepare_for_legacy_compatibility)) +" ms";
56
- puts "===> clean_sandbox cost : " + timing(method(:clean_sandbox)) +" ms";
54
+ timing("===> analyze", method(:analyze));
55
+ timing("===> validate_build_configurations", method(:validate_build_configurations));
56
+ timing("===> prepare_for_legacy_compatibility", method(:prepare_for_legacy_compatibility));
57
+ timing("===> clean_sandbox", method(:clean_sandbox));
57
58
  end
58
59
  end
59
60
 
60
61
  def download_dependencies
61
62
  UI.section 'Downloading dependencies' do
62
- puts "===> create_file_accessors cost : " + timing(method(:create_file_accessors)) +" ms";
63
- puts "===> install_pod_sources cost : " + timing(method(:install_pod_sources)) +" ms";
64
- puts "===> run_pre_install_hooks cost : " + timing(method(:run_pre_install_hooks)) +" ms";
65
- puts "===> clean_pod_sources cost : " + timing(method(:clean_pod_sources)) +" ms";
63
+ timing("===> create_file_accessors", method(:create_file_accessors));
64
+ timing("===> install_pod_sources", method(:install_pod_sources));
65
+ timing("===> run_pre_install_hooks", method(:run_pre_install_hooks));
66
+ timing("===> clean_pod_sources", method(:clean_pod_sources));
66
67
  end
67
68
  end
68
69
 
69
70
  def generate_pods_project
70
71
  UI.section 'Generating Pods project' do
71
- puts "===> prepare_pods_project cost : " + timing(method(:prepare_pods_project)) + " ms";
72
- puts "===> install_file_references cost : " + timing(method(:install_file_references)) + " ms";
73
- puts "===> install_libraries cost : " + timing(method(:install_libraries)) + " ms";
74
- puts "===> set_target_dependencies cost : " + timing(method(:set_target_dependencies)) + " ms";
75
- puts "===> run_podfile_post_install_hooks cost : " + timing(method(:run_podfile_post_install_hooks)) + " ms";
76
- puts "===> write_pod_project cost : " + timing(method(:write_pod_project)) + " ms";
77
- puts "===> write_lockfiles cost : " + timing(method(:write_lockfiles)) + " ms";
72
+ timing("===> prepare_pods_project", method(:prepare_pods_project));
73
+ timing("===> install_file_references", method(:install_file_references));
74
+ timing("===> install_libraries", method(:install_libraries));
75
+ timing("===> set_target_dependencies", method(:set_target_dependencies));
76
+ timing("===> run_podfile_post_install_hooks", method(:run_podfile_post_install_hooks));
77
+ timing("===> write_pod_project", method(:write_pod_project));
78
+ timing("===> write_lockfiles", method(:write_lockfiles));
78
79
  end
79
80
  end
80
81
 
@@ -83,31 +84,54 @@ class Installer
83
84
 
84
85
  private
85
86
 
86
- # Downloads, installs the documentation and cleans the sources of the Pods
87
- # which need to be installed.
87
+ # # Downloads, installs the documentation and cleans the sources of the Pods
88
+ # # which need to be installed.
89
+ # #
90
+ # # @return [void]
91
+ # #
92
+ # def install_pod_sources
93
+ # @installed_specs = []
94
+ # pods_to_install = sandbox_state.added | sandbox_state.changed
95
+ # title_options = { :verbose_prefix => '-> '.green }
96
+ # root_specs.sort_by(&:name).each do |spec|
97
+ # if pods_to_install.include?(spec.name)
98
+ # if sandbox_state.changed.include?(spec.name) && sandbox.manifest
99
+ # previous = sandbox.manifest.version(spec.name)
100
+ # title = "Installing #{spec.name} #{spec.version} (was #{previous})"
101
+ # else
102
+ # title = "Installing #{spec}"
103
+ # end
104
+ # UI.titled_section(title.green, title_options) do
105
+ # # install_source_of_pod(spec.name)
106
+ # puts "=====> Installing #{spec.name} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
107
+ # end
108
+ # else
109
+ # UI.titled_section("Using #{spec}", title_options)
110
+ # end
111
+ # end
112
+ # end
113
+
114
+ # Install the Pods. If the resolver indicated that a Pod should be
115
+ # installed and it exits, it is removed an then reinstalled. In any case if
116
+ # the Pod doesn't exits it is installed.
88
117
  #
89
118
  # @return [void]
90
119
  #
91
- def install_pod_sources
92
- @installed_specs = []
93
- pods_to_install = sandbox_state.added | sandbox_state.changed
94
- title_options = { :verbose_prefix => '-> '.green }
95
- root_specs.sort_by(&:name).each do |spec|
96
- if pods_to_install.include?(spec.name)
97
- if sandbox_state.changed.include?(spec.name) && sandbox.manifest
98
- previous = sandbox.manifest.version(spec.name)
99
- title = "Installing #{spec.name} #{spec.version} (was #{previous})"
100
- else
101
- title = "Installing #{spec}"
102
- end
103
- UI.titled_section(title.green, title_options) do
104
- # install_source_of_pod(spec.name)
105
- puts "=====> Installing #{spec.name} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
106
- end
107
- else
108
- UI.titled_section("Using #{spec}", title_options)
120
+ def install_source_of_pod(pod_name)
121
+ specs_by_platform = {}
122
+ pod_targets.each do |pod_target|
123
+ if pod_target.root_spec.name == pod_name
124
+ specs_by_platform[pod_target.platform] ||= []
125
+ specs_by_platform[pod_target.platform].concat(pod_target.specs)
109
126
  end
110
127
  end
128
+
129
+ @pod_installers ||= []
130
+ pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform)
131
+ timing("=====> install #{pod_name}", pod_installer.method(:install!));
132
+ # pod_installer.install!
133
+ @pod_installers << pod_installer
134
+ @installed_specs.concat(specs_by_platform.values.flatten.uniq)
111
135
  end
112
136
 
113
137
  # Installs the aggregate targets of the Pods projects and generates their
@@ -121,14 +145,14 @@ class Installer
121
145
  next if pod_target.target_definition.dependencies.empty?
122
146
  target_installer = PodTargetInstaller.new(sandbox, pod_target)
123
147
  # target_installer.install!
124
- puts "=====> install pod target #{pod_target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
148
+ timing("=====> install pod target #{pod_target.name}", target_installer.method(:install!));
125
149
  end
126
150
 
127
151
  aggregate_targets.sort_by(&:name).each do |target|
128
152
  next if target.target_definition.dependencies.empty?
129
153
  target_installer = AggregateTargetInstaller.new(sandbox, target)
130
- puts "=====> install aggregate target #{target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
131
154
  # target_installer.install!
155
+ timing("=====> install pod target #{target.name}", target_installer.method(:install!));
132
156
  end
133
157
 
134
158
  # TODO
@@ -2,20 +2,21 @@
2
2
  module Pod
3
3
  class Installer
4
4
 
5
- def timing (method, *argv) #method(:method_name)
5
+ def timing (title, method, *argv) #method(:method_name)
6
6
 
7
7
  start_time = Time.new
8
8
 
9
9
  if argv and (argv.length != 0)
10
- method.call(*argv)
10
+ method.call(*argv)
11
11
  else
12
- method.call
12
+ method.call
13
13
  end
14
-
14
+
15
15
  cost_time = (Time.new.to_f - start_time.to_f)*1000
16
16
 
17
- return cost_time.to_i.to_s
18
- end
17
+ # return cost_time.to_i.to_s
18
+ puts title + " cost : #{cost_time.to_i} ms";
19
+ end
19
20
 
20
21
  #-------------------------------------------------------------------------#
21
22
 
@@ -35,17 +36,18 @@ module Pod
35
36
  #
36
37
  def install!
37
38
  start_time = Time.new
38
- puts '=> prepare cost : ' + timing(method(:prepare)) + ' ms';
39
- puts '=> resolve_dependencies cost : ' + timing(method(:resolve_dependencies)) + ' ms';
40
- puts '=> download_dependencies cost : ' + timing(method(:download_dependencies)) + ' ms';
41
- puts '=> determine_dependency_product_types cost : ' + timing(method(:determine_dependency_product_types)) + ' ms';
42
- puts '=> verify_no_duplicate_framework_names cost : ' + timing(method(:verify_no_duplicate_framework_names)) + ' ms';
43
- puts '=> verify_no_static_framework_transitive_dependencies cost : ' + timing(method(:verify_no_static_framework_transitive_dependencies)) + ' ms';
44
- puts '=> verify_framework_usage cost : ' + timing(method(:verify_framework_usage)) + ' ms';
45
- puts '=> generate_pods_project cost : ' + timing(method(:generate_pods_project)) + ' ms';
46
- puts '=> integrate_user_project cost : ' + timing(method(:integrate_user_project)) + ' ms' if config.integrate_targets?
47
- puts '=> perform_post_install_actions cost : ' + timing(method(:perform_post_install_actions)) + ' ms';
48
-
39
+
40
+ timing("=> prepare", method(:prepare));
41
+ timing("=> resolve_dependencies", method(:resolve_dependencies));
42
+ timing("=> download_dependencies", method(:download_dependencies));
43
+ timing("=> determine_dependency_product_types", method(:determine_dependency_product_types));
44
+ timing("=> verify_no_duplicate_framework_names", method(:verify_no_duplicate_framework_names));
45
+ timing("=> verify_no_static_framework_transitive_dependencies", method(:verify_no_static_framework_transitive_dependencies));
46
+ timing("=> verify_framework_usage", method(:verify_framework_usage));
47
+ timing("=> generate_pods_project", method(:generate_pods_project));
48
+ timing("=> integrate_user_project", method(:integrate_user_project)) if config.integrate_targets?
49
+ timing("=> perform_post_install_actions", method(:perform_post_install_actions));
50
+
49
51
  cost_time = (Time.new.to_f - start_time.to_f)*1000
50
52
  puts "\e[32m Total cost : #{cost_time.to_i.to_s} ms\e[0m"
51
53
  end
@@ -57,69 +59,82 @@ module Pod
57
59
  analyzer.sources.insert(0, *plugin_sources)
58
60
 
59
61
  UI.section 'Updating local specs repositories' do
60
- puts "===> analyzer.update_repositories cost : " + timing(analyzer.method(:update_repositories)) + " ms";
62
+ timing("===> analyzer.update_repositories", analyzer.method(:update_repositories));
61
63
  end unless config.skip_repo_update?
62
64
 
63
65
  UI.section 'Analyzing dependencies' do
64
- puts '===> analyze(analyzer) cost : ' + timing(method(:analyze), analyzer) + ' ms';
65
- puts '===> validate_build_configurations cost : ' + timing(method(:validate_build_configurations)) + ' ms';
66
- puts '===> prepare_for_legacy_compatibility cost : ' + timing(method(:prepare_for_legacy_compatibility)) + ' ms';
67
- puts '===> clean_sandbox cost : ' + timing(method(:clean_sandbox)) + ' ms';
66
+ timing("===> analyze(analyzer)", method(:analyze), analyzer);
67
+ timing("===> validate_build_configurations", method(:validate_build_configurations));
68
+ timing("===> prepare_for_legacy_compatibility", method(:prepare_for_legacy_compatibility));
69
+ timing("===> clean_sandbox", method(:clean_sandbox));
68
70
  end
69
71
  end
70
72
 
71
73
  def download_dependencies
72
74
  UI.section 'Downloading dependencies' do
73
- puts '===> create_file_accessors cost : ' + timing(method(:create_file_accessors)) + ' ms';
74
- puts '===> install_pod_sources cost : ' + timing(method(:install_pod_sources)) + ' ms';
75
- puts '===> run_podfile_pre_install_hooks cost : ' + timing(method(:run_podfile_pre_install_hooks)) + ' ms';
76
- puts '===> clean_pod_sources cost : ' + timing(method(:clean_pod_sources)) + ' ms';
75
+ timing("===> create_file_accessors", method(:create_file_accessors));
76
+ timing("===> install_pod_sources", method(:install_pod_sources));
77
+ timing("===> run_podfile_pre_install_hooks", method(:run_podfile_pre_install_hooks));
78
+ timing("===> clean_pod_sources", method(:clean_pod_sources));
77
79
  end
78
80
  end
79
81
 
80
82
  def generate_pods_project
81
83
  UI.section 'Generating Pods project' do
82
- puts '===> prepare_pods_project cost : ' + timing(method(:prepare_pods_project)) + ' ms';
83
- puts '===> install_file_references cost : ' + timing(method(:install_file_references)) + ' ms';
84
- puts '===> install_libraries cost : ' + timing(method(:install_libraries)) + ' ms';
85
- puts '===> set_target_dependencies cost : ' + timing(method(:set_target_dependencies)) + ' ms';
86
- puts '===> run_podfile_post_install_hooks cost : ' + timing(method(:run_podfile_post_install_hooks)) + ' ms';
87
- puts '===> write_pod_project cost : ' + timing(method(:write_pod_project)) + ' ms';
88
- puts '===> share_development_pod_schemes cost : ' + timing(method(:share_development_pod_schemes)) + ' ms';
89
- puts '===> write_lockfiles cost : ' + timing(method(:write_lockfiles)) + ' ms';
84
+ timing("===> prepare_pods_project", method(:prepare_pods_project));
85
+ timing("===> install_file_references", method(:install_file_references));
86
+ timing("===> install_libraries", method(:install_libraries));
87
+ timing("===> set_target_dependencies", method(:set_target_dependencies));
88
+ timing("===> run_podfile_post_install_hooks", method(:run_podfile_post_install_hooks));
89
+ timing("===> write_pod_project", method(:write_pod_project));
90
+ timing("===> share_development_pod_schemes", method(:share_development_pod_schemes));
91
+ timing("===> write_lockfiles", method(:write_lockfiles));
90
92
  end
91
93
  end
92
94
 
93
95
  #-------------------------------------------------------------------------#
94
96
 
95
- # Downloads, installs the documentation and cleans the sources of the Pods
96
- # which need to be installed.
97
+ # # Downloads, installs the documentation and cleans the sources of the Pods
98
+ # # which need to be installed.
99
+ # #
100
+ # # @return [void]
101
+ # #
102
+ # def install_pod_sources
103
+ # @installed_specs = []
104
+ # pods_to_install = sandbox_state.added | sandbox_state.changed
105
+ # title_options = { :verbose_prefix => '-> '.green }
106
+ # root_specs.sort_by(&:name).each do |spec|
107
+ # if pods_to_install.include?(spec.name)
108
+ # if sandbox_state.changed.include?(spec.name) && sandbox.manifest
109
+ # previous = sandbox.manifest.version(spec.name)
110
+ # title = "Installing #{spec.name} #{spec.version} (was #{previous})"
111
+ # else
112
+ # title = "Installing #{spec}"
113
+ # end
114
+ # UI.titled_section(title.green, title_options) do
115
+ # puts "=====> Install #{spec} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
116
+ # # install_source_of_pod(spec.name)
117
+ # end
118
+ # else
119
+ # UI.titled_section("Using #{spec}", title_options) do
120
+ # puts "=====> Using #{spec} cost : " + timing(method(:create_pod_installer), spec.name) + " ms";
121
+ # # create_pod_installer(spec.name)
122
+ # end
123
+ # end
124
+ # end
125
+ # end
126
+
127
+ # Install the Pods. If the resolver indicated that a Pod should be
128
+ # installed and it exits, it is removed an then reinstalled. In any case if
129
+ # the Pod doesn't exits it is installed.
97
130
  #
98
131
  # @return [void]
99
132
  #
100
- def install_pod_sources
101
- @installed_specs = []
102
- pods_to_install = sandbox_state.added | sandbox_state.changed
103
- title_options = { :verbose_prefix => '-> '.green }
104
- root_specs.sort_by(&:name).each do |spec|
105
- if pods_to_install.include?(spec.name)
106
- if sandbox_state.changed.include?(spec.name) && sandbox.manifest
107
- previous = sandbox.manifest.version(spec.name)
108
- title = "Installing #{spec.name} #{spec.version} (was #{previous})"
109
- else
110
- title = "Installing #{spec}"
111
- end
112
- UI.titled_section(title.green, title_options) do
113
- puts "=====> Install #{spec} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
114
- # install_source_of_pod(spec.name)
115
- end
116
- else
117
- UI.titled_section("Using #{spec}", title_options) do
118
- puts "=====> Using #{spec} cost : " + timing(method(:create_pod_installer), spec.name) + " ms";
119
- # create_pod_installer(spec.name)
120
- end
121
- end
122
- end
133
+ def install_source_of_pod(pod_name)
134
+ pod_installer = create_pod_installer(pod_name)
135
+ # pod_installer.install!
136
+ timing("=====> install #{pod_name}", pod_installer.method(:install!));
137
+ @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)
123
138
  end
124
139
 
125
140
  # Installs the aggregate targets of the Pods projects and generates their
@@ -132,13 +147,15 @@ module Pod
132
147
  pod_targets.sort_by(&:name).each do |pod_target|
133
148
  next if pod_target.target_definitions.flat_map(&:dependencies).empty?
134
149
  target_installer = PodTargetInstaller.new(sandbox, pod_target)
135
- puts "=====> install pod target #{pod_target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
150
+ # target_installer.install!
151
+ timing("=====> install pod target #{pod_target.name}", target_installer.method(:install!));
136
152
  end
137
153
 
138
154
  aggregate_targets.sort_by(&:name).each do |target|
139
155
  next if target.target_definition.dependencies.empty?
140
156
  target_installer = AggregateTargetInstaller.new(sandbox, target)
141
- puts "=====> install aggregate target #{target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
157
+ # target_installer.install!
158
+ timing("=====> install aggregate target #{target.name}", target_installer.method(:install!));
142
159
  end
143
160
 
144
161
  # TODO: Move and add specs
@@ -1,157 +1,170 @@
1
1
 
2
2
  module Pod
3
- class Installer
4
- def timing (method, *argv) #method(:method_name)
5
-
6
- start_time = Time.new
7
-
8
- if argv and (argv.length != 0)
9
- method.call(*argv)
10
- else
11
- method.call
12
- end
13
-
14
- cost_time = (Time.new.to_f - start_time.to_f)*1000
15
-
16
- return cost_time.to_i.to_s
17
- end
18
-
19
- #-------------------------------------------------------------------------#
20
-
21
- # Installs the Pods.
22
- #
23
- # The installation process is mostly linear with a few minor complications
24
- # to keep in mind:
25
- #
26
- # - The stored podspecs need to be cleaned before the resolution step
27
- # otherwise the sandbox might return an old podspec and not download
28
- # the new one from an external source.
29
- # - The resolver might trigger the download of Pods from external sources
30
- # necessary to retrieve their podspec (unless it is instructed not to
31
- # do it).
32
- #
33
- # @return [void]
34
- #
35
- def install!
36
-
37
- start_time = Time.new
38
-
39
- puts '=> prepare cost : ' + timing(method(:prepare)) + ' ms';
40
- puts '=> resolve_dependencies cost : ' + timing(method(:resolve_dependencies)) + ' ms';
41
- puts '=> download_dependencies cost : ' + timing(method(:download_dependencies)) + ' ms';
42
- puts '=> verify_no_duplicate_framework_names cost : ' + timing(method(:verify_no_duplicate_framework_names)) + ' ms';
43
- puts '=> verify_no_static_framework_transitive_dependencies cost : ' + timing(method(:verify_no_static_framework_transitive_dependencies)) + ' ms';
44
- puts '=> verify_framework_usage cost : ' + timing(method(:verify_framework_usage)) + ' ms';
45
- puts '=> generate_pods_project cost : ' + timing(method(:generate_pods_project)) + ' ms';
46
- puts '=> integrate_user_project cost : ' + timing(method(:integrate_user_project)) + ' ms' if installation_options.integrate_targets?
47
- puts '=> perform_post_install_actions cost : ' + timing(method(:perform_post_install_actions)) + ' ms';
48
-
49
- cost_time = (Time.new.to_f - start_time.to_f)*1000
50
- puts "\e[32m Total cost : #{cost_time.to_i.to_s} ms\e[0m"
51
- end
3
+ class Installer
4
+ def timing (title, method, *argv) #method(:method_name)
5
+
6
+ start_time = Time.new
7
+
8
+ if argv and (argv.length != 0)
9
+ method.call(*argv)
10
+ else
11
+ method.call
12
+ end
13
+
14
+ cost_time = (Time.new.to_f - start_time.to_f)*1000
15
+
16
+ # return cost_time.to_i.to_s
17
+ puts title + " cost : #{cost_time.to_i} ms";
18
+ end
52
19
 
53
- def resolve_dependencies
54
- analyzer = create_analyzer
20
+ #-------------------------------------------------------------------------#
21
+
22
+ # Installs the Pods.
23
+ #
24
+ # The installation process is mostly linear with a few minor complications
25
+ # to keep in mind:
26
+ #
27
+ # - The stored podspecs need to be cleaned before the resolution step
28
+ # otherwise the sandbox might return an old podspec and not download
29
+ # the new one from an external source.
30
+ # - The resolver might trigger the download of Pods from external sources
31
+ # necessary to retrieve their podspec (unless it is instructed not to
32
+ # do it).
33
+ #
34
+ # @return [void]
35
+ #
36
+ def install!
37
+
38
+ start_time = Time.new
39
+
40
+ timing("=> prepare", method(:prepare));
41
+ timing("=> resolve_dependencies", method(:resolve_dependencies));
42
+ timing("=> download_dependencies", method(:download_dependencies));
43
+ timing("=> verify_no_duplicate_framework_names", method(:verify_no_duplicate_framework_names));
44
+ timing("=> verify_no_static_framework_transitive_dependencies", method(:verify_no_static_framework_transitive_dependencies));
45
+ timing("=> verify_framework_usage", method(:verify_framework_usage));
46
+ timing("=> generate_pods_project", method(:generate_pods_project));
47
+ timing("=> integrate_user_project", method(:integrate_user_project)) if installation_options.integrate_targets?
48
+ timing("=> perform_post_install_actions", method(:perform_post_install_actions));
49
+
50
+ cost_time = (Time.new.to_f - start_time.to_f)*1000
51
+ puts "\e[32m Total cost : #{cost_time.to_i.to_s} ms\e[0m"
52
+ end
55
53
 
56
- plugin_sources = run_source_provider_hooks
57
- analyzer.sources.insert(0, *plugin_sources)
54
+ def resolve_dependencies
55
+ analyzer = create_analyzer
58
56
 
59
- UI.section 'Updating local specs repositories' do
60
- puts "===> analyzer.update_repositories cost : " + timing(analyzer.method(:update_repositories)) + " ms";
61
- end if repo_update?
57
+ plugin_sources = run_source_provider_hooks
58
+ analyzer.sources.insert(0, *plugin_sources)
62
59
 
63
- UI.section 'Analyzing dependencies' do
64
- puts "===> analyze(analyzer) cost : " + timing(method(:analyze), analyzer) + " ms";
65
- puts "===> validate_build_configurations cost : " + timing(method(:validate_build_configurations)) + " ms";
66
- puts "===> clean_sandbox cost : " + timing(method(:clean_sandbox)) + " ms";
67
- end
68
- end
60
+ UI.section 'Updating local specs repositories' do
61
+ timing("===> analyzer.update_repositories", analyzer.method(:update_repositories));
62
+ end if repo_update?
69
63
 
70
- def download_dependencies
71
- UI.section 'Downloading dependencies' do
72
- puts "===> create_file_accessors cost : " + timing(method(:create_file_accessors)) + " ms";
73
- puts "===> install_pod_sources cost : " + timing(method(:install_pod_sources)) + " ms";
74
- puts "===> run_podfile_pre_install_hooks cost : " + timing(method(:run_podfile_pre_install_hooks)) + " ms";
75
- puts "===> clean_pod_sources cost : " + timing(method(:clean_pod_sources)) + " ms";
76
- end
77
- end
64
+ UI.section 'Analyzing dependencies' do
65
+ timing("===> analyze(analyzer)", method(:analyze), analyzer);
66
+ timing("===> validate_build_configurations", method(:validate_build_configurations));
67
+ timing("===> clean_sandbox", method(:clean_sandbox));
68
+ end
69
+ end
78
70
 
79
- def generate_pods_project
80
- UI.section 'Generating Pods project' do
81
- puts "===> prepare_pods_project cost : " + timing(method(:prepare_pods_project)) + " ms";
82
- puts "===> install_file_references cost : " + timing(method(:install_file_references)) + " ms";
83
- puts "===> install_libraries cost : " + timing(method(:install_libraries)) + " ms";
84
- puts "===> set_target_dependencies cost : " + timing(method(:set_target_dependencies)) + " ms";
85
- puts "===> run_podfile_post_install_hooks cost : " + timing(method(:run_podfile_post_install_hooks)) + " ms";
86
- puts "===> write_pod_project cost : " + timing(method(:write_pod_project)) + " ms";
87
- puts "===> share_development_pod_schemes cost : " + timing(method(:share_development_pod_schemes)) + " ms";
88
- puts "===> write_lockfiles cost : " + timing(method(:write_lockfiles)) + " ms";
89
- end
90
- end
71
+ def download_dependencies
72
+ UI.section 'Downloading dependencies' do
73
+ timing("===> create_file_accessors", method(:create_file_accessors));
74
+ timing("===> install_pod_sources", method(:install_pod_sources));
75
+ timing("===> run_podfile_pre_install_hooks", method(:run_podfile_pre_install_hooks));
76
+ timing("===> clean_pod_sources", method(:clean_pod_sources));
77
+ end
78
+ end
91
79
 
92
- #-------------------------------------------------------------------------#
93
- # Downloads, installs the documentation and cleans the sources of the Pods
94
- # which need to be installed.
95
- #
96
- # @return [void]
97
- #
98
- def install_pod_sources
99
- @installed_specs = []
100
- pods_to_install = sandbox_state.added | sandbox_state.changed
101
- title_options = { :verbose_prefix => '-> '.green }
102
- root_specs.sort_by(&:name).each do |spec|
103
- if pods_to_install.include?(spec.name)
104
- if sandbox_state.changed.include?(spec.name) && sandbox.manifest
105
- previous = sandbox.manifest.version(spec.name)
106
- title = "Installing #{spec.name} #{spec.version} (was #{previous})"
107
- else
108
- title = "Installing #{spec}"
109
- end
110
- UI.titled_section(title.green, title_options) do
111
- puts "=====> Install #{spec} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
112
- # install_source_of_pod(spec.name)
113
- end
114
- else
115
- UI.titled_section("Using #{spec}", title_options) do
116
- puts "=====> USing #{spec} cost : " + timing(method(:create_pod_installer), spec.name) + " ms";
117
- # create_pod_installer(spec.name)
118
- end
119
- end
120
- end
121
- end
80
+ def generate_pods_project
81
+ UI.section 'Generating Pods project' do
82
+ timing("===> prepare_pods_project", method(:prepare_pods_project));
83
+ timing("===> install_file_references", method(:install_file_references));
84
+ timing("===> install_libraries", method(:install_libraries));
85
+ timing("===> set_target_dependencies", method(:set_target_dependencies));
86
+ timing("===> run_podfile_post_install_hooks", method(:run_podfile_post_install_hooks));
87
+ timing("===> write_pod_project", method(:write_pod_project));
88
+ timing("===> share_development_pod_schemes", method(:share_development_pod_schemes));
89
+ timing("===> write_lockfiles", method(:write_lockfiles));
90
+ end
91
+ end
122
92
 
123
- # Installs the aggregate targets of the Pods projects and generates their
124
- # support files.
125
- #
126
- # @return [void]
127
- #
128
- def install_libraries
129
- UI.message '- Installing targets' do
130
- pod_targets.sort_by(&:name).each do |pod_target|
131
- target_installer = PodTargetInstaller.new(sandbox, pod_target)
132
- puts "=====> install pod target #{pod_target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
133
- # target_installer.install!
134
- end
93
+ #-------------------------------------------------------------------------#
94
+ # Downloads, installs the documentation and cleans the sources of the Pods
95
+ # which need to be installed.
96
+ #
97
+ # @return [void]
98
+ #
99
+ # def install_pod_sources
100
+ # @installed_specs = []
101
+ # pods_to_install = sandbox_state.added | sandbox_state.changed
102
+ # title_options = { :verbose_prefix => '-> '.green }
103
+ # root_specs.sort_by(&:name).each do |spec|
104
+ # if pods_to_install.include?(spec.name)
105
+ # if sandbox_state.changed.include?(spec.name) && sandbox.manifest
106
+ # previous = sandbox.manifest.version(spec.name)
107
+ # title = "Installing #{spec.name} #{spec.version} (was #{previous})"
108
+ # else
109
+ # title = "Installing #{spec}"
110
+ # end
111
+ # UI.titled_section(title.green, title_options) do
112
+ # puts "=====> Install #{spec} cost : " + timing(method(:install_source_of_pod), spec.name) + " ms";
113
+ # # install_source_of_pod(spec.name)
114
+ # end
115
+ # else
116
+ # UI.titled_section("Using #{spec}", title_options) do
117
+ # puts "=====> USing #{spec} cost : " + timing(method(:create_pod_installer), spec.name) + " ms";
118
+ # # create_pod_installer(spec.name)
119
+ # end
120
+ # end
121
+ # end
122
+ # end
123
+
124
+ # Install the Pods. If the resolver indicated that a Pod should be
125
+ # installed and it exits, it is removed an then reinstalled. In any case if
126
+ # the Pod doesn't exits it is installed.
127
+ #
128
+ # @return [void]
129
+ #
130
+ def install_source_of_pod(pod_name)
131
+ pod_installer = create_pod_installer(pod_name)
132
+ # pod_installer.install!
133
+ timing("=====> install #{pod_name}", pod_installer.method(:install!));
134
+ @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)
135
+ end
136
+ # Installs the aggregate targets of the Pods projects and generates their
137
+ # support files.
138
+ #
139
+ # @return [void]
140
+ #
141
+ def install_libraries
142
+ UI.message '- Installing targets' do
143
+ pod_targets.sort_by(&:name).each do |pod_target|
144
+ target_installer = PodTargetInstaller.new(sandbox, pod_target)
145
+ # target_installer.install!
146
+ timing("install pod target #{pod_target.name}", target_installer.method(:install!));
147
+ end
135
148
 
136
- aggregate_targets.sort_by(&:name).each do |target|
137
- target_installer = AggregateTargetInstaller.new(sandbox, target)
138
- puts "=====> install aggregate target #{target.name} cost : " + timing(target_installer.method(:install!)) + " ms";
139
- # target_installer.install!
140
- end
149
+ aggregate_targets.sort_by(&:name).each do |target|
150
+ target_installer = AggregateTargetInstaller.new(sandbox, target)
151
+ # target_installer.install!
152
+ timing("install aggregate target #{target.name}", target_installer.method(:install!));
153
+ end
141
154
 
142
- # TODO: Move and add specs
143
- pod_targets.sort_by(&:name).each do |pod_target|
144
- pod_target.file_accessors.each do |file_accessor|
145
- file_accessor.spec_consumer.frameworks.each do |framework|
146
- if pod_target.should_build?
147
- pod_target.native_target.add_system_framework(framework)
148
- end
149
- end
155
+ # TODO: Move and add specs
156
+ pod_targets.sort_by(&:name).each do |pod_target|
157
+ pod_target.file_accessors.each do |file_accessor|
158
+ file_accessor.spec_consumer.frameworks.each do |framework|
159
+ if pod_target.should_build?
160
+ pod_target.native_target.add_system_framework(framework)
150
161
  end
151
162
  end
152
-
153
163
  end
154
164
  end
155
- #-------------------------------------------------------------------------#
165
+
166
+ end
156
167
  end
168
+ #-------------------------------------------------------------------------#
169
+ end
157
170
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-timeconsuming-details
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 圆寸
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler