xcocoapods 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6303 -0
- data/LICENSE +28 -0
- data/README.md +80 -0
- data/bin/pod +56 -0
- data/bin/sandbox-pod +168 -0
- data/lib/cocoapods.rb +73 -0
- data/lib/cocoapods/command.rb +175 -0
- data/lib/cocoapods/command/cache.rb +28 -0
- data/lib/cocoapods/command/cache/clean.rb +90 -0
- data/lib/cocoapods/command/cache/list.rb +69 -0
- data/lib/cocoapods/command/env.rb +66 -0
- data/lib/cocoapods/command/init.rb +128 -0
- data/lib/cocoapods/command/install.rb +45 -0
- data/lib/cocoapods/command/ipc.rb +19 -0
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -0
- data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
- data/lib/cocoapods/command/ipc/repl.rb +51 -0
- data/lib/cocoapods/command/ipc/spec.rb +29 -0
- data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
- data/lib/cocoapods/command/lib.rb +11 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +121 -0
- data/lib/cocoapods/command/list.rb +39 -0
- data/lib/cocoapods/command/options/project_directory.rb +36 -0
- data/lib/cocoapods/command/options/repo_update.rb +34 -0
- data/lib/cocoapods/command/outdated.rb +140 -0
- data/lib/cocoapods/command/repo.rb +29 -0
- data/lib/cocoapods/command/repo/add.rb +103 -0
- data/lib/cocoapods/command/repo/lint.rb +82 -0
- data/lib/cocoapods/command/repo/list.rb +93 -0
- data/lib/cocoapods/command/repo/push.rb +281 -0
- data/lib/cocoapods/command/repo/remove.rb +36 -0
- data/lib/cocoapods/command/repo/update.rb +28 -0
- data/lib/cocoapods/command/setup.rb +103 -0
- data/lib/cocoapods/command/spec.rb +112 -0
- data/lib/cocoapods/command/spec/cat.rb +51 -0
- data/lib/cocoapods/command/spec/create.rb +283 -0
- data/lib/cocoapods/command/spec/edit.rb +87 -0
- data/lib/cocoapods/command/spec/env_spec.rb +53 -0
- data/lib/cocoapods/command/spec/lint.rb +137 -0
- data/lib/cocoapods/command/spec/which.rb +43 -0
- data/lib/cocoapods/command/update.rb +101 -0
- data/lib/cocoapods/config.rb +347 -0
- data/lib/cocoapods/core_overrides.rb +1 -0
- data/lib/cocoapods/downloader.rb +190 -0
- data/lib/cocoapods/downloader/cache.rb +233 -0
- data/lib/cocoapods/downloader/request.rb +86 -0
- data/lib/cocoapods/downloader/response.rb +16 -0
- data/lib/cocoapods/executable.rb +222 -0
- data/lib/cocoapods/external_sources.rb +57 -0
- data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods/external_sources/path_source.rb +55 -0
- data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods/gem_version.rb +5 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods/generator/app_target_helper.rb +244 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/constant.rb +19 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
- data/lib/cocoapods/generator/dummy_source.rb +31 -0
- data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
- data/lib/cocoapods/generator/header.rb +103 -0
- data/lib/cocoapods/generator/info_plist_file.rb +116 -0
- data/lib/cocoapods/generator/module_map.rb +99 -0
- data/lib/cocoapods/generator/prefix_header.rb +60 -0
- data/lib/cocoapods/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods/hooks_manager.rb +132 -0
- data/lib/cocoapods/installer.rb +703 -0
- data/lib/cocoapods/installer/analyzer.rb +972 -0
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
- data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
- data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
- data/lib/cocoapods/installer/installation_options.rb +158 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
- data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods/installer/podfile_validator.rb +139 -0
- data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
- data/lib/cocoapods/installer/xcode.rb +8 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
- data/lib/cocoapods/open-uri.rb +33 -0
- data/lib/cocoapods/project.rb +414 -0
- data/lib/cocoapods/resolver.rb +585 -0
- data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
- data/lib/cocoapods/sandbox.rb +404 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
- data/lib/cocoapods/sandbox/headers_store.rb +146 -0
- data/lib/cocoapods/sandbox/path_list.rb +220 -0
- data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
- data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods/sources_manager.rb +157 -0
- data/lib/cocoapods/target.rb +261 -0
- data/lib/cocoapods/target/aggregate_target.rb +338 -0
- data/lib/cocoapods/target/build_settings.rb +1075 -0
- data/lib/cocoapods/target/pod_target.rb +559 -0
- data/lib/cocoapods/user_interface.rb +459 -0
- data/lib/cocoapods/user_interface/error_report.rb +187 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/validator.rb +981 -0
- metadata +533 -0
@@ -0,0 +1,459 @@
|
|
1
|
+
require 'cocoapods/user_interface/error_report'
|
2
|
+
require 'cocoapods/user_interface/inspector_reporter'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
# Provides support for UI output. It provides support for nested sections of
|
6
|
+
# information and for a verbose mode.
|
7
|
+
#
|
8
|
+
module UserInterface
|
9
|
+
require 'colored2'
|
10
|
+
|
11
|
+
@title_colors = %w( yellow green )
|
12
|
+
@title_level = 0
|
13
|
+
@indentation_level = 2
|
14
|
+
@treat_titles_as_messages = false
|
15
|
+
@warnings = []
|
16
|
+
|
17
|
+
class << self
|
18
|
+
include Config::Mixin
|
19
|
+
|
20
|
+
attr_accessor :indentation_level
|
21
|
+
attr_accessor :title_level
|
22
|
+
attr_accessor :warnings
|
23
|
+
|
24
|
+
# @return [IO] IO object to which UI output will be directed.
|
25
|
+
#
|
26
|
+
attr_accessor :output_io
|
27
|
+
|
28
|
+
# @return [Bool] Whether the wrapping of the strings to the width of the
|
29
|
+
# terminal should be disabled.
|
30
|
+
#
|
31
|
+
attr_accessor :disable_wrap
|
32
|
+
alias_method :disable_wrap?, :disable_wrap
|
33
|
+
|
34
|
+
# Prints a title taking an optional verbose prefix and
|
35
|
+
# a relative indentation valid for the UI action in the passed
|
36
|
+
# block.
|
37
|
+
#
|
38
|
+
# In verbose mode titles are printed with a color according
|
39
|
+
# to their level. In normal mode titles are printed only if
|
40
|
+
# they have nesting level smaller than 2.
|
41
|
+
#
|
42
|
+
# @todo Refactor to title (for always visible titles like search)
|
43
|
+
# and sections (titles that represent collapsible sections).
|
44
|
+
#
|
45
|
+
# @param [String] title
|
46
|
+
# The title to print
|
47
|
+
#
|
48
|
+
# @param [String] verbose_prefix
|
49
|
+
# See #message
|
50
|
+
#
|
51
|
+
# @param [FixNum] relative_indentation
|
52
|
+
# The indentation level relative to the current,
|
53
|
+
# when the message is printed.
|
54
|
+
#
|
55
|
+
def section(title, verbose_prefix = '', relative_indentation = 0)
|
56
|
+
if config.verbose?
|
57
|
+
title(title, verbose_prefix, relative_indentation)
|
58
|
+
elsif title_level < 1
|
59
|
+
puts title
|
60
|
+
end
|
61
|
+
|
62
|
+
self.indentation_level += relative_indentation
|
63
|
+
self.title_level += 1
|
64
|
+
yield if block_given?
|
65
|
+
ensure
|
66
|
+
self.indentation_level -= relative_indentation
|
67
|
+
self.title_level -= 1
|
68
|
+
end
|
69
|
+
|
70
|
+
# In verbose mode it shows the sections and the contents.
|
71
|
+
# In normal mode it just prints the title.
|
72
|
+
#
|
73
|
+
# @return [void]
|
74
|
+
#
|
75
|
+
def titled_section(title, options = {})
|
76
|
+
relative_indentation = options[:relative_indentation] || 0
|
77
|
+
verbose_prefix = options[:verbose_prefix] || ''
|
78
|
+
if config.verbose?
|
79
|
+
title(title, verbose_prefix, relative_indentation)
|
80
|
+
else
|
81
|
+
puts title
|
82
|
+
end
|
83
|
+
|
84
|
+
self.indentation_level += relative_indentation
|
85
|
+
self.title_level += 1
|
86
|
+
yield if block_given?
|
87
|
+
ensure
|
88
|
+
self.indentation_level -= relative_indentation
|
89
|
+
self.title_level -= 1
|
90
|
+
end
|
91
|
+
|
92
|
+
# A title opposed to a section is always visible
|
93
|
+
#
|
94
|
+
# @param [String] title
|
95
|
+
# The title to print
|
96
|
+
#
|
97
|
+
# @param [String] verbose_prefix
|
98
|
+
# See #message
|
99
|
+
#
|
100
|
+
# @param [FixNum] relative_indentation
|
101
|
+
# The indentation level relative to the current,
|
102
|
+
# when the message is printed.
|
103
|
+
#
|
104
|
+
def title(title, verbose_prefix = '', relative_indentation = 2)
|
105
|
+
if @treat_titles_as_messages
|
106
|
+
message(title, verbose_prefix)
|
107
|
+
else
|
108
|
+
title = verbose_prefix + title if config.verbose?
|
109
|
+
title = "\n#{title}" if @title_level < 2
|
110
|
+
if (color = @title_colors[@title_level])
|
111
|
+
title = title.send(color)
|
112
|
+
end
|
113
|
+
puts "#{title}"
|
114
|
+
end
|
115
|
+
|
116
|
+
self.indentation_level += relative_indentation
|
117
|
+
self.title_level += 1
|
118
|
+
yield if block_given?
|
119
|
+
ensure
|
120
|
+
self.indentation_level -= relative_indentation
|
121
|
+
self.title_level -= 1
|
122
|
+
end
|
123
|
+
|
124
|
+
# Prints a verbose message taking an optional verbose prefix and
|
125
|
+
# a relative indentation valid for the UI action in the passed
|
126
|
+
# block.
|
127
|
+
#
|
128
|
+
# @todo Clean interface.
|
129
|
+
#
|
130
|
+
# @param [String] message
|
131
|
+
# The message to print.
|
132
|
+
#
|
133
|
+
# @param [String] verbose_prefix
|
134
|
+
# See #message
|
135
|
+
#
|
136
|
+
# @param [FixNum] relative_indentation
|
137
|
+
# The indentation level relative to the current,
|
138
|
+
# when the message is printed.
|
139
|
+
#
|
140
|
+
def message(message, verbose_prefix = '', relative_indentation = 2)
|
141
|
+
message = verbose_prefix + message if config.verbose?
|
142
|
+
puts_indented message if config.verbose?
|
143
|
+
|
144
|
+
self.indentation_level += relative_indentation
|
145
|
+
yield if block_given?
|
146
|
+
ensure
|
147
|
+
self.indentation_level -= relative_indentation
|
148
|
+
end
|
149
|
+
|
150
|
+
# Prints an info to the user. The info is always displayed.
|
151
|
+
# It respects the current indentation level only in verbose
|
152
|
+
# mode.
|
153
|
+
#
|
154
|
+
# Any title printed in the optional block is treated as a message.
|
155
|
+
#
|
156
|
+
# @param [String] message
|
157
|
+
# The message to print.
|
158
|
+
#
|
159
|
+
def info(message)
|
160
|
+
indentation = config.verbose? ? self.indentation_level : 0
|
161
|
+
indented = wrap_string(message, indentation)
|
162
|
+
puts(indented)
|
163
|
+
|
164
|
+
self.indentation_level += 2
|
165
|
+
@treat_titles_as_messages = true
|
166
|
+
yield if block_given?
|
167
|
+
ensure
|
168
|
+
@treat_titles_as_messages = false
|
169
|
+
self.indentation_level -= 2
|
170
|
+
end
|
171
|
+
|
172
|
+
# Prints an important message to the user.
|
173
|
+
#
|
174
|
+
# @param [String] message The message to print.
|
175
|
+
#
|
176
|
+
# return [void]
|
177
|
+
#
|
178
|
+
def notice(message)
|
179
|
+
puts("\n[!] #{message}".green)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns a string containing relative location of a path from the Podfile.
|
183
|
+
# The returned path is quoted. If the argument is nil it returns the
|
184
|
+
# empty string.
|
185
|
+
#
|
186
|
+
# @param [#to_str] pathname
|
187
|
+
# The path to print.
|
188
|
+
#
|
189
|
+
def path(pathname)
|
190
|
+
if pathname
|
191
|
+
from_path = config.podfile_path.dirname if config.podfile_path
|
192
|
+
from_path ||= Pathname.pwd
|
193
|
+
path = begin
|
194
|
+
Pathname(pathname).relative_path_from(from_path)
|
195
|
+
rescue
|
196
|
+
pathname
|
197
|
+
end
|
198
|
+
"`#{path}`"
|
199
|
+
else
|
200
|
+
''
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Prints the textual representation of a given set.
|
205
|
+
#
|
206
|
+
# @param [Set] set
|
207
|
+
# the set that should be presented.
|
208
|
+
#
|
209
|
+
# @param [Symbol] mode
|
210
|
+
# the presentation mode, either `:normal` or `:name_and_version`.
|
211
|
+
#
|
212
|
+
def pod(set, mode = :normal)
|
213
|
+
if mode == :name_and_version
|
214
|
+
puts_indented "#{set.name} #{set.versions.first.version}"
|
215
|
+
else
|
216
|
+
pod = Specification::Set::Presenter.new(set)
|
217
|
+
title = "-> #{pod.name} (#{pod.version})"
|
218
|
+
if pod.spec.deprecated?
|
219
|
+
title += " #{pod.deprecation_description}"
|
220
|
+
colored_title = title.red
|
221
|
+
else
|
222
|
+
colored_title = title.green
|
223
|
+
end
|
224
|
+
|
225
|
+
title(colored_title, '', 1) do
|
226
|
+
puts_indented pod.summary if pod.summary
|
227
|
+
puts_indented "pod '#{pod.name}', '~> #{pod.version}'"
|
228
|
+
labeled('Homepage', pod.homepage)
|
229
|
+
labeled('Source', pod.source_url)
|
230
|
+
labeled('Versions', pod.versions_by_source)
|
231
|
+
if mode == :stats
|
232
|
+
labeled('Authors', pod.authors) if pod.authors =~ /,/
|
233
|
+
labeled('Author', pod.authors) if pod.authors !~ /,/
|
234
|
+
labeled('License', pod.license)
|
235
|
+
labeled('Platform', pod.platform)
|
236
|
+
labeled('Stars', pod.github_stargazers)
|
237
|
+
labeled('Forks', pod.github_forks)
|
238
|
+
end
|
239
|
+
labeled('Subspecs', pod.subspecs)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Prints a message with a label.
|
245
|
+
#
|
246
|
+
# @param [String] label
|
247
|
+
# The label to print.
|
248
|
+
#
|
249
|
+
# @param [#to_s] value
|
250
|
+
# The value to print.
|
251
|
+
#
|
252
|
+
# @param [FixNum] justification
|
253
|
+
# The justification of the label.
|
254
|
+
#
|
255
|
+
def labeled(label, value, justification = 12)
|
256
|
+
if value
|
257
|
+
title = "- #{label}:"
|
258
|
+
if value.is_a?(Array)
|
259
|
+
lines = [wrap_string(title, self.indentation_level)]
|
260
|
+
value.each do |v|
|
261
|
+
lines << wrap_string("- #{v}", self.indentation_level + 2)
|
262
|
+
end
|
263
|
+
puts lines.join("\n")
|
264
|
+
else
|
265
|
+
puts wrap_string(title.ljust(justification) + "#{value}", self.indentation_level)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Prints a message respecting the current indentation level and
|
271
|
+
# wrapping it to the terminal width if necessary.
|
272
|
+
#
|
273
|
+
# @param [String] message
|
274
|
+
# The message to print.
|
275
|
+
#
|
276
|
+
def puts_indented(message = '')
|
277
|
+
indented = wrap_string(message, self.indentation_level)
|
278
|
+
puts(indented)
|
279
|
+
end
|
280
|
+
|
281
|
+
# Prints the stored warnings. This method is intended to be called at the
|
282
|
+
# end of the execution of the binary.
|
283
|
+
#
|
284
|
+
# @return [void]
|
285
|
+
#
|
286
|
+
def print_warnings
|
287
|
+
STDOUT.flush
|
288
|
+
warnings.each do |warning|
|
289
|
+
next if warning[:verbose_only] && !config.verbose?
|
290
|
+
STDERR.puts("\n[!] #{warning[:message]}".yellow)
|
291
|
+
warning[:actions].each do |action|
|
292
|
+
string = "- #{action}"
|
293
|
+
string = wrap_string(string, 4)
|
294
|
+
puts(string)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
# Presents a choice among the elements of an array to the user.
|
300
|
+
#
|
301
|
+
# @param [Array<#to_s>] array
|
302
|
+
# The list of the elements among which the user should make his
|
303
|
+
# choice.
|
304
|
+
#
|
305
|
+
# @param [String] message
|
306
|
+
# The message to display to the user.
|
307
|
+
#
|
308
|
+
# @return [Fixnum] The index of the chosen array item.
|
309
|
+
#
|
310
|
+
def choose_from_array(array, message)
|
311
|
+
array.each_with_index do |item, index|
|
312
|
+
UI.puts "#{index + 1}: #{item}"
|
313
|
+
end
|
314
|
+
|
315
|
+
UI.puts message
|
316
|
+
|
317
|
+
index = UI.gets.chomp.to_i - 1
|
318
|
+
if index < 0 || index > array.count - 1
|
319
|
+
raise Informative, "#{index + 1} is invalid [1-#{array.count}]"
|
320
|
+
else
|
321
|
+
index
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
public
|
326
|
+
|
327
|
+
# @!group Basic methods
|
328
|
+
#-----------------------------------------------------------------------#
|
329
|
+
|
330
|
+
# prints a message followed by a new line unless config is silent.
|
331
|
+
#
|
332
|
+
# @param [String] message
|
333
|
+
# The message to print.
|
334
|
+
#
|
335
|
+
def puts(message = '')
|
336
|
+
return if config.silent?
|
337
|
+
begin
|
338
|
+
(output_io || STDOUT).puts(message)
|
339
|
+
rescue Errno::EPIPE
|
340
|
+
exit 0
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
# prints a message followed by a new line unless config is silent.
|
345
|
+
#
|
346
|
+
# @param [String] message
|
347
|
+
# The message to print.
|
348
|
+
#
|
349
|
+
def print(message)
|
350
|
+
return if config.silent?
|
351
|
+
begin
|
352
|
+
(output_io || STDOUT).print(message)
|
353
|
+
rescue Errno::EPIPE
|
354
|
+
exit 0
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# gets input from $stdin
|
359
|
+
#
|
360
|
+
def gets
|
361
|
+
$stdin.gets
|
362
|
+
end
|
363
|
+
|
364
|
+
# Stores important warning to the user optionally followed by actions
|
365
|
+
# that the user should take. To print them use {#print_warnings}.
|
366
|
+
#
|
367
|
+
# @param [String] message The message to print.
|
368
|
+
# @param [Array] actions The actions that the user should take.
|
369
|
+
# @param [Bool] verbose_only
|
370
|
+
# Restrict the appearance of the warning to verbose mode only
|
371
|
+
#
|
372
|
+
# return [void]
|
373
|
+
#
|
374
|
+
def warn(message, actions = [], verbose_only = false)
|
375
|
+
warnings << { :message => message, :actions => actions, :verbose_only => verbose_only }
|
376
|
+
end
|
377
|
+
|
378
|
+
# Pipes all output inside given block to a pager.
|
379
|
+
#
|
380
|
+
# @yield Code block in which inputs to {#puts} and {#print} methods will be printed to the piper.
|
381
|
+
#
|
382
|
+
def with_pager
|
383
|
+
prev_handler = Signal.trap('INT', 'IGNORE')
|
384
|
+
IO.popen((ENV['PAGER'] || 'less -R'), 'w') do |io|
|
385
|
+
UI.output_io = io
|
386
|
+
yield
|
387
|
+
end
|
388
|
+
ensure
|
389
|
+
Signal.trap('INT', prev_handler)
|
390
|
+
UI.output_io = nil
|
391
|
+
end
|
392
|
+
|
393
|
+
private
|
394
|
+
|
395
|
+
# @!group Helpers
|
396
|
+
#-----------------------------------------------------------------------#
|
397
|
+
|
398
|
+
# @return [String] Wraps a string taking into account the width of the
|
399
|
+
# terminal and an option indent. Adapted from
|
400
|
+
# http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
|
401
|
+
#
|
402
|
+
# @param [String] txt The string to wrap
|
403
|
+
#
|
404
|
+
# @param [String] indent The string to use to indent the result.
|
405
|
+
#
|
406
|
+
# @return [String] The formatted string.
|
407
|
+
#
|
408
|
+
# @note If CocoaPods is not being run in a terminal or the width of the
|
409
|
+
# terminal is too small a width of 80 is assumed.
|
410
|
+
#
|
411
|
+
def wrap_string(string, indent = 0)
|
412
|
+
if disable_wrap
|
413
|
+
(' ' * indent) + string
|
414
|
+
else
|
415
|
+
first_space = ' ' * indent
|
416
|
+
indented = CLAide::Command::Banner::TextWrapper.wrap_with_indent(string, indent, 9999)
|
417
|
+
first_space + indented
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
UI = UserInterface
|
423
|
+
|
424
|
+
#---------------------------------------------------------------------------#
|
425
|
+
|
426
|
+
# Redirects cocoapods-core UI.
|
427
|
+
#
|
428
|
+
module CoreUI
|
429
|
+
class << self
|
430
|
+
def puts(message)
|
431
|
+
UI.puts message
|
432
|
+
end
|
433
|
+
|
434
|
+
def print(message)
|
435
|
+
UI.print(message)
|
436
|
+
end
|
437
|
+
|
438
|
+
def warn(message)
|
439
|
+
UI.warn message
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
#---------------------------------------------------------------------------#
|
446
|
+
|
447
|
+
module Xcodeproj
|
448
|
+
# Redirects xcodeproj UI.
|
449
|
+
#
|
450
|
+
module UserInterface
|
451
|
+
def self.puts(message)
|
452
|
+
::Pod::UI.puts message
|
453
|
+
end
|
454
|
+
|
455
|
+
def self.warn(message)
|
456
|
+
::Pod::UI.warn message
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|