cocoapods-square-stable 0.19.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 +1296 -0
- data/LICENSE +20 -0
- data/README.md +94 -0
- data/bin/pod +16 -0
- data/bin/sandbox-pod +120 -0
- data/lib/cocoapods.rb +77 -0
- data/lib/cocoapods/command.rb +116 -0
- data/lib/cocoapods/command/help.rb +23 -0
- data/lib/cocoapods/command/inter_process_communication.rb +178 -0
- data/lib/cocoapods/command/list.rb +77 -0
- data/lib/cocoapods/command/outdated.rb +56 -0
- data/lib/cocoapods/command/podfile_info.rb +91 -0
- data/lib/cocoapods/command/project.rb +88 -0
- data/lib/cocoapods/command/push.rb +172 -0
- data/lib/cocoapods/command/repo.rb +145 -0
- data/lib/cocoapods/command/search.rb +61 -0
- data/lib/cocoapods/command/setup.rb +134 -0
- data/lib/cocoapods/command/spec.rb +590 -0
- data/lib/cocoapods/config.rb +231 -0
- data/lib/cocoapods/downloader.rb +59 -0
- data/lib/cocoapods/executable.rb +118 -0
- data/lib/cocoapods/external_sources.rb +363 -0
- data/lib/cocoapods/file_list.rb +36 -0
- data/lib/cocoapods/gem_version.rb +7 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +40 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +64 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +54 -0
- data/lib/cocoapods/generator/dummy_source.rb +22 -0
- data/lib/cocoapods/generator/prefix_header.rb +82 -0
- data/lib/cocoapods/generator/target_environment_header.rb +86 -0
- data/lib/cocoapods/generator/xcconfig.rb +185 -0
- data/lib/cocoapods/hooks/installer_representation.rb +134 -0
- data/lib/cocoapods/hooks/library_representation.rb +94 -0
- data/lib/cocoapods/hooks/pod_representation.rb +74 -0
- data/lib/cocoapods/installer.rb +571 -0
- data/lib/cocoapods/installer/analyzer.rb +559 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
- data/lib/cocoapods/installer/file_references_installer.rb +179 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +248 -0
- data/lib/cocoapods/installer/target_installer.rb +379 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +180 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +224 -0
- data/lib/cocoapods/library.rb +202 -0
- data/lib/cocoapods/open_uri.rb +24 -0
- data/lib/cocoapods/project.rb +209 -0
- data/lib/cocoapods/resolver.rb +212 -0
- data/lib/cocoapods/sandbox.rb +343 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +217 -0
- data/lib/cocoapods/sandbox/headers_store.rb +96 -0
- data/lib/cocoapods/sandbox/path_list.rb +208 -0
- data/lib/cocoapods/sources_manager.rb +276 -0
- data/lib/cocoapods/user_interface.rb +304 -0
- data/lib/cocoapods/user_interface/error_report.rb +101 -0
- data/lib/cocoapods/validator.rb +350 -0
- metadata +238 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Help < Command
|
4
|
+
self.summary = 'Show help for the given command.'
|
5
|
+
self.arguments = '[COMMAND]'
|
6
|
+
|
7
|
+
def initialize(argv)
|
8
|
+
@help_command = Pod::Command.parse(argv) unless argv.empty?
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
help_command.help!
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def help_command
|
19
|
+
@help_command || self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class IPC < Command
|
4
|
+
|
5
|
+
self.abstract_command = true
|
6
|
+
self.summary = 'Inter-process communication'
|
7
|
+
|
8
|
+
def output_pipe
|
9
|
+
STDOUT
|
10
|
+
end
|
11
|
+
|
12
|
+
#-----------------------------------------------------------------------#
|
13
|
+
|
14
|
+
class Spec < IPC
|
15
|
+
|
16
|
+
self.summary = 'Converts a podspec to YAML.'
|
17
|
+
self.description = 'Converts a podspec to YAML and prints it to STDOUT.'
|
18
|
+
self.arguments = 'PATH'
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@path = argv.shift_argument
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate!
|
26
|
+
super
|
27
|
+
help! "A specification path is required." unless @path
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
spec = Specification.from_file(@path)
|
32
|
+
output_pipe.puts spec.to_yaml
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
#-----------------------------------------------------------------------#
|
38
|
+
|
39
|
+
class Podfile < IPC
|
40
|
+
|
41
|
+
self.summary = 'Converts a Podfile to YAML.'
|
42
|
+
self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
|
43
|
+
self.arguments = 'PATH'
|
44
|
+
|
45
|
+
def initialize(argv)
|
46
|
+
@path = argv.shift_argument
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def validate!
|
51
|
+
super
|
52
|
+
help! "A Podfile path is required." unless @path
|
53
|
+
end
|
54
|
+
|
55
|
+
def run
|
56
|
+
podfile = Pod::Podfile.from_file(@path)
|
57
|
+
output_pipe.puts podfile.to_yaml
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
#-----------------------------------------------------------------------#
|
63
|
+
|
64
|
+
class List < IPC
|
65
|
+
|
66
|
+
self.summary = 'Lists the specifications know to CocoaPods.'
|
67
|
+
self.description = <<-DESC
|
68
|
+
Prints to STDOUT a YAML dictionary where the keys are the name of the
|
69
|
+
specifications and the values are a dictionary with the following
|
70
|
+
keys.
|
71
|
+
|
72
|
+
- defined_in_file
|
73
|
+
- version
|
74
|
+
- authors
|
75
|
+
- summary
|
76
|
+
- description
|
77
|
+
- platforms
|
78
|
+
DESC
|
79
|
+
|
80
|
+
def run
|
81
|
+
sets = SourcesManager.all_sets
|
82
|
+
result = {}
|
83
|
+
sets.each do |set|
|
84
|
+
begin
|
85
|
+
spec = set.specification
|
86
|
+
result[spec.name] = {
|
87
|
+
'authors' => spec.authors.keys,
|
88
|
+
'summary' => spec.summary,
|
89
|
+
'description' => spec.description,
|
90
|
+
'platforms' => spec.available_platforms.map { |p| p.name.to_s },
|
91
|
+
}
|
92
|
+
rescue DSLError
|
93
|
+
next
|
94
|
+
end
|
95
|
+
end
|
96
|
+
output_pipe.puts result.to_yaml
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
#-----------------------------------------------------------------------#
|
102
|
+
|
103
|
+
class UpdateSearchIndex < IPC
|
104
|
+
|
105
|
+
self.summary = 'Updates the search index.'
|
106
|
+
self.description = <<-DESC
|
107
|
+
Updates the search index and prints its path to standard output.
|
108
|
+
The search index is a YAML encoded dictionary where the keys
|
109
|
+
are the names of the Pods and the values are a dictionary containing
|
110
|
+
the following information:
|
111
|
+
|
112
|
+
- version
|
113
|
+
- summary
|
114
|
+
- description
|
115
|
+
- authors
|
116
|
+
DESC
|
117
|
+
|
118
|
+
def run
|
119
|
+
SourcesManager.updated_search_index
|
120
|
+
output_pipe.puts(SourcesManager.search_index_path)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
#-----------------------------------------------------------------------#
|
126
|
+
|
127
|
+
class Repl < IPC
|
128
|
+
|
129
|
+
END_OF_OUTPUT_SIGNAL = "\n\r"
|
130
|
+
|
131
|
+
self.summary = 'The repl listens to commands on standard input.'
|
132
|
+
self.description = <<-DESC
|
133
|
+
The repl listens to commands on standard input and prints their
|
134
|
+
result to standard output.
|
135
|
+
|
136
|
+
It accepts all the other ipc subcommands. The repl will signal the
|
137
|
+
end of output with the the ASCII CR+LF `\\n\\r`.
|
138
|
+
DESC
|
139
|
+
|
140
|
+
def run
|
141
|
+
print_version
|
142
|
+
signal_end_of_output
|
143
|
+
listen
|
144
|
+
end
|
145
|
+
|
146
|
+
def print_version
|
147
|
+
output_pipe.puts "version: '#{Pod::VERSION}'"
|
148
|
+
end
|
149
|
+
|
150
|
+
def signal_end_of_output
|
151
|
+
output_pipe.puts(END_OF_OUTPUT_SIGNAL)
|
152
|
+
STDOUT.flush
|
153
|
+
end
|
154
|
+
|
155
|
+
def listen
|
156
|
+
while repl_command = STDIN.gets
|
157
|
+
execute_repl_command(repl_command)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def execute_repl_command(repl_command)
|
162
|
+
if (repl_command != "\n")
|
163
|
+
repl_commands = repl_command.split
|
164
|
+
subcommand = repl_commands.shift.capitalize
|
165
|
+
arguments = repl_commands
|
166
|
+
subcommand_class = Pod::Command::IPC.const_get(subcommand)
|
167
|
+
subcommand_class.new(CLAide::ARGV.new(arguments)).run
|
168
|
+
signal_end_of_output
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
#-----------------------------------------------------------------------#
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class List < Command
|
4
|
+
self.summary = 'List pods'
|
5
|
+
self.description = 'Lists all available pods.'
|
6
|
+
|
7
|
+
def self.options
|
8
|
+
[[
|
9
|
+
"--update", "Run `pod repo update` before listing",
|
10
|
+
"--stats", "Show additional stats (like GitHub watchers and forks)"
|
11
|
+
]].concat(super)
|
12
|
+
end
|
13
|
+
|
14
|
+
extend Executable
|
15
|
+
executable :git
|
16
|
+
|
17
|
+
def initialize(argv)
|
18
|
+
@update = argv.flag?('update')
|
19
|
+
@stats = argv.flag?('stats')
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
update_if_necessary!
|
25
|
+
|
26
|
+
sets = SourcesManager.all_sets
|
27
|
+
sets.each { |set| UI.pod(set, :name) }
|
28
|
+
UI.puts "\n#{sets.count} pods were found"
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_if_necessary!
|
32
|
+
if @update && config.verbose?
|
33
|
+
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
34
|
+
Repo.new(ARGV.new(["update"])).run
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
#-----------------------------------------------------------------------#
|
40
|
+
|
41
|
+
class New < List
|
42
|
+
self.summary = 'Lists pods introduced in the master spec-repo since the last check'
|
43
|
+
|
44
|
+
def run
|
45
|
+
update_if_necessary!
|
46
|
+
|
47
|
+
days = [1,2,3,5,8]
|
48
|
+
dates, groups = {}, {}
|
49
|
+
days.each {|d| dates[d] = Time.now - 60 * 60 * 24 * d}
|
50
|
+
sets = SourcesManager.all_sets
|
51
|
+
statistics_provider = Specification::Set::Statistics.new(STATISTICS_CACHE_FILE)
|
52
|
+
creation_dates = statistics_provider.creation_dates(sets)
|
53
|
+
|
54
|
+
sets.each do |set|
|
55
|
+
set_date = creation_dates[set.name]
|
56
|
+
days.each do |d|
|
57
|
+
if set_date >= dates[d]
|
58
|
+
groups[d] = [] unless groups[d]
|
59
|
+
groups[d] << set
|
60
|
+
break
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
days.reverse.each do |d|
|
65
|
+
sets = groups[d]
|
66
|
+
next unless sets
|
67
|
+
UI.section("\nPods added in the last #{"day".pluralize(d)}".yellow) do
|
68
|
+
sorted = sets.sort_by {|s| creation_dates[s.name]}
|
69
|
+
mode = @stats ? :stats : :name
|
70
|
+
sorted.each { |set| UI.pod(set, mode, statistics_provider) }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Outdated < Command
|
4
|
+
self.summary = 'Show outdated project dependencies'
|
5
|
+
|
6
|
+
self.description = <<-DESC
|
7
|
+
Shows the outdated pods in the current Podfile.lock, but only those from
|
8
|
+
spec repos, not those from local/external sources or `:head` versions.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[["--no-repo-update", "Skip running `pod repo update` before install"]].concat(super)
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
config.skip_repo_update = argv.flag?('repo-update', config.skip_repo_update)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# @todo the command report new dependencies added to the Podfile as
|
21
|
+
# updates.
|
22
|
+
#
|
23
|
+
# @todo fix.
|
24
|
+
#
|
25
|
+
def run
|
26
|
+
verify_podfile_exists!
|
27
|
+
verify_lockfile_exists!
|
28
|
+
|
29
|
+
lockfile = config.lockfile
|
30
|
+
pods = lockfile.pod_names
|
31
|
+
updates = []
|
32
|
+
pods.each do |pod_name|
|
33
|
+
set = SourcesManager.search(Dependency.new(pod_name))
|
34
|
+
next unless set
|
35
|
+
source_version = set.versions.first
|
36
|
+
lockfile_version = lockfile.version(pod_name)
|
37
|
+
if source_version > lockfile_version
|
38
|
+
updates << [pod_name, lockfile_version, source_version]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if updates.empty?
|
43
|
+
UI.puts "No updates are available.".yellow
|
44
|
+
else
|
45
|
+
UI.section "The following updates are available:" do
|
46
|
+
updates.each do |(name, from_version, to_version)|
|
47
|
+
UI.puts "- #{name} #{from_version} -> #{to_version}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
|
4
|
+
class PodfileInfo < Command
|
5
|
+
|
6
|
+
self.summary = 'Shows information on installed Pods.'
|
7
|
+
self.description = <<-DESC
|
8
|
+
Shows information on installed Pods in current Project.
|
9
|
+
If optional `PODFILE_PATH` provided, the info will be shown for
|
10
|
+
that specific Podfile
|
11
|
+
DESC
|
12
|
+
self.arguments = '[PODFILE_PATH]'
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
["--all", "Show information about all Pods with dependencies that are used in a project"],
|
17
|
+
["--md", "Output information in Markdown format"]
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
@info_all = argv.flag?('all')
|
23
|
+
@info_in_md = argv.flag?('md')
|
24
|
+
@podfile_path = argv.shift_argument
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
use_podfile = (@podfile_path || !config.lockfile)
|
30
|
+
|
31
|
+
if !use_podfile
|
32
|
+
UI.puts "Using lockfile" if config.verbose?
|
33
|
+
verify_lockfile_exists!
|
34
|
+
lockfile = config.lockfile
|
35
|
+
pods = lockfile.pod_names
|
36
|
+
if @info_all
|
37
|
+
deps = lockfile.dependencies.map{|d| d.name}
|
38
|
+
pods = (deps + pods).uniq
|
39
|
+
end
|
40
|
+
elsif @podfile_path
|
41
|
+
podfile = Pod::Podfile.from_file(@podfile_path)
|
42
|
+
pods = pods_from_podfile(podfile)
|
43
|
+
else
|
44
|
+
verify_podfile_exists!
|
45
|
+
podfile = config.podfile
|
46
|
+
pods = pods_from_podfile(podfile)
|
47
|
+
end
|
48
|
+
|
49
|
+
UI.puts "\nPods used:\n".yellow unless @info_in_md
|
50
|
+
pods_info(pods, @info_in_md)
|
51
|
+
end
|
52
|
+
|
53
|
+
def pods_from_podfile(podfile)
|
54
|
+
pods = []
|
55
|
+
podfile.root_target_definitions.each {|e| h = e.to_hash; pods << h['dependencies'] if h['dependencies']}
|
56
|
+
pods.flatten!
|
57
|
+
pods.collect! {|pod| (pod.is_a?(Hash)) ? pod.keys.first : pod}
|
58
|
+
end
|
59
|
+
|
60
|
+
def pods_info_hash(pods, keys=[:name, :homepage, :summary])
|
61
|
+
pods_info = []
|
62
|
+
pods.each do |pod|
|
63
|
+
spec = (Pod::SourcesManager.search_by_name(pod).first rescue nil)
|
64
|
+
if spec
|
65
|
+
info = {}
|
66
|
+
keys.each { |k| info[k] = spec.specification.send(k) }
|
67
|
+
pods_info << info
|
68
|
+
else
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
pods_info
|
74
|
+
end
|
75
|
+
|
76
|
+
def pods_info(pods, in_md=false)
|
77
|
+
pods = pods_info_hash(pods, [:name, :homepage, :summary])
|
78
|
+
|
79
|
+
pods.each do |pod|
|
80
|
+
if in_md
|
81
|
+
UI.puts "* [#{pod[:name]}](#{pod[:homepage]}) - #{pod[:summary]}"
|
82
|
+
else
|
83
|
+
UI.puts "- #{pod[:name]} - #{pod[:summary]}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
|
4
|
+
# Provides support the common behaviour of the `install` and `update`
|
5
|
+
# commands.
|
6
|
+
#
|
7
|
+
module Project
|
8
|
+
module Options
|
9
|
+
def options
|
10
|
+
[
|
11
|
+
["--no-clean", "Leave SCM dirs like `.git' and `.svn' intact after downloading"],
|
12
|
+
["--no-integrate", "Skip integration of the Pods libraries in the Xcode project(s)"],
|
13
|
+
["--no-repo-update", "Skip running `pod repo update` before install"],
|
14
|
+
].concat(super)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.included(base)
|
19
|
+
base.extend Options
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
config.clean = argv.flag?('clean', config.clean)
|
24
|
+
config.integrate_targets = argv.flag?('integrate', config.integrate_targets)
|
25
|
+
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
# Runs the installer.
|
30
|
+
#
|
31
|
+
# @param [update] whether the installer should be run in update mode.
|
32
|
+
#
|
33
|
+
# @return [void]
|
34
|
+
#
|
35
|
+
def run_install_with_update(update)
|
36
|
+
installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
|
37
|
+
installer.update_mode = update
|
38
|
+
installer.install!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#-------------------------------------------------------------------------#
|
43
|
+
|
44
|
+
class Install < Command
|
45
|
+
include Project
|
46
|
+
|
47
|
+
self.summary = 'Install project dependencies'
|
48
|
+
|
49
|
+
self.description = <<-DESC
|
50
|
+
Downloads all dependencies defined in `Podfile' and creates an Xcode
|
51
|
+
Pods library project in `./Pods'.
|
52
|
+
|
53
|
+
The Xcode project file should be specified in your `Podfile` like this:
|
54
|
+
|
55
|
+
xcodeproj 'path/to/XcodeProject'
|
56
|
+
|
57
|
+
If no xcodeproj is specified, then a search for an Xcode project will
|
58
|
+
be made. If more than one Xcode project is found, the command will
|
59
|
+
raise an error.
|
60
|
+
|
61
|
+
This will configure the project to reference the Pods static library,
|
62
|
+
add a build configuration file, and add a post build script to copy
|
63
|
+
Pod resources.
|
64
|
+
DESC
|
65
|
+
|
66
|
+
def run
|
67
|
+
verify_podfile_exists!
|
68
|
+
run_install_with_update(false)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
#-------------------------------------------------------------------------#
|
73
|
+
|
74
|
+
class Update < Command
|
75
|
+
include Project
|
76
|
+
|
77
|
+
self.summary = 'Update outdated project dependencies'
|
78
|
+
|
79
|
+
def run
|
80
|
+
verify_podfile_exists!
|
81
|
+
verify_lockfile_exists!
|
82
|
+
run_install_with_update(true)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|