xcocoapods 1.5.3
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 +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,93 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Repo < Command
|
|
4
|
+
class List < Repo
|
|
5
|
+
self.summary = 'List repos'
|
|
6
|
+
|
|
7
|
+
self.description = <<-DESC
|
|
8
|
+
List the repos from the local spec-repos directory at `#{Config.instance.repos_dir}`.
|
|
9
|
+
DESC
|
|
10
|
+
|
|
11
|
+
def self.options
|
|
12
|
+
[['--count-only', 'Show the total number of repos']].concat(super)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(argv)
|
|
16
|
+
@count_only = argv.flag?('count-only')
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @output Examples:
|
|
21
|
+
#
|
|
22
|
+
# master
|
|
23
|
+
# - type: git (master)
|
|
24
|
+
# - URL: https://github.com/CocoaPods/Specs.git
|
|
25
|
+
# - path: /Users/lascorbe/.cocoapods/repos/master
|
|
26
|
+
#
|
|
27
|
+
# test
|
|
28
|
+
# - type: local copy
|
|
29
|
+
# - URL: file:///Users/lascorbe/.cocoapods/repos/test
|
|
30
|
+
# - path: /Users/lascorbe/.cocoapods/repos/test
|
|
31
|
+
#
|
|
32
|
+
def run
|
|
33
|
+
sources = config.sources_manager.all
|
|
34
|
+
print_sources(sources) unless @count_only
|
|
35
|
+
print_count_of_sources(sources)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
# Pretty-prints the source at the given path.
|
|
41
|
+
#
|
|
42
|
+
# @param [Source] source
|
|
43
|
+
# The source repository to be printed.
|
|
44
|
+
#
|
|
45
|
+
# @return [void]
|
|
46
|
+
#
|
|
47
|
+
def print_source(source)
|
|
48
|
+
if source.git?
|
|
49
|
+
Dir.chdir(source.repo) do
|
|
50
|
+
branch_name = `git name-rev --name-only HEAD 2>/dev/null`.strip
|
|
51
|
+
branch_name = 'unknown' if branch_name.empty?
|
|
52
|
+
UI.puts "- Type: git (#{branch_name})"
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
UI.puts '- Type: local'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
UI.puts "- URL: #{source.url}"
|
|
59
|
+
UI.puts "- Path: #{source.repo}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Pretty-prints the given sources.
|
|
63
|
+
#
|
|
64
|
+
# @param [Array<Source>] sources
|
|
65
|
+
# The sources that should be printed.
|
|
66
|
+
#
|
|
67
|
+
# @return [void]
|
|
68
|
+
#
|
|
69
|
+
def print_sources(sources)
|
|
70
|
+
sources.each do |source|
|
|
71
|
+
UI.title source.name do
|
|
72
|
+
print_source(source)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
UI.puts "\n"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Pretty-prints the number of sources.
|
|
79
|
+
#
|
|
80
|
+
# @param [Array<Source>] sources
|
|
81
|
+
# The sources whose count should be printed.
|
|
82
|
+
#
|
|
83
|
+
# @return [void]
|
|
84
|
+
#
|
|
85
|
+
def print_count_of_sources(sources)
|
|
86
|
+
number_of_repos = sources.length
|
|
87
|
+
repo_string = number_of_repos != 1 ? 'repos' : 'repo'
|
|
88
|
+
UI.puts "#{number_of_repos} #{repo_string}".green
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
require 'tempfile'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
|
4
|
+
|
|
5
|
+
module Pod
|
|
6
|
+
class Command
|
|
7
|
+
class Repo < Command
|
|
8
|
+
class Push < Repo
|
|
9
|
+
self.summary = 'Push new specifications to a spec-repo'
|
|
10
|
+
|
|
11
|
+
self.description = <<-DESC
|
|
12
|
+
Validates `NAME.podspec` or `*.podspec` in the current working dir,
|
|
13
|
+
creates a directory and version folder for the pod in the local copy of
|
|
14
|
+
`REPO` (#{Config.instance.repos_dir}/[REPO]), copies the podspec file into the
|
|
15
|
+
version directory, and finally it pushes `REPO` to its remote.
|
|
16
|
+
DESC
|
|
17
|
+
|
|
18
|
+
self.arguments = [
|
|
19
|
+
CLAide::Argument.new('REPO', true),
|
|
20
|
+
CLAide::Argument.new('NAME.podspec', false),
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
def self.options
|
|
24
|
+
[
|
|
25
|
+
['--allow-warnings', 'Allows pushing even if there are warnings'],
|
|
26
|
+
['--use-libraries', 'Linter uses static libraries to install the spec'],
|
|
27
|
+
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
|
28
|
+
'(defaults to all available repos). ' \
|
|
29
|
+
'Multiple sources must be comma-delimited.'],
|
|
30
|
+
['--local-only', 'Does not perform the step of pushing REPO to its remote'],
|
|
31
|
+
['--no-private', 'Lint includes checks that apply only to public repos'],
|
|
32
|
+
['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
|
|
33
|
+
['--skip-tests', 'Lint skips building and running tests during validation'],
|
|
34
|
+
['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \
|
|
35
|
+
'Opens default editor if no commit message is specified.'],
|
|
36
|
+
['--use-json', 'Push JSON spec to repo'],
|
|
37
|
+
['--swift-version=VERSION', 'The SWIFT_VERSION that should be used when linting the spec. ' \
|
|
38
|
+
'This takes precedence over a .swift-version file.'],
|
|
39
|
+
['--no-overwrite', 'Disallow pushing that would overwrite an existing spec.'],
|
|
40
|
+
].concat(super)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def initialize(argv)
|
|
44
|
+
@allow_warnings = argv.flag?('allow-warnings')
|
|
45
|
+
@local_only = argv.flag?('local-only')
|
|
46
|
+
@repo = argv.shift_argument
|
|
47
|
+
@source = source_for_repo
|
|
48
|
+
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
|
|
49
|
+
@podspec = argv.shift_argument
|
|
50
|
+
@use_frameworks = !argv.flag?('use-libraries')
|
|
51
|
+
@private = argv.flag?('private', true)
|
|
52
|
+
@message = argv.option('commit-message')
|
|
53
|
+
@commit_message = argv.flag?('commit-message', false)
|
|
54
|
+
@use_json = argv.flag?('use-json')
|
|
55
|
+
@swift_version = argv.option('swift-version', nil)
|
|
56
|
+
@skip_import_validation = argv.flag?('skip-import-validation', false)
|
|
57
|
+
@skip_tests = argv.flag?('skip-tests', false)
|
|
58
|
+
@allow_overwrite = argv.flag?('overwrite', true)
|
|
59
|
+
super
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def validate!
|
|
63
|
+
super
|
|
64
|
+
help! 'A spec-repo name or url is required.' unless @repo
|
|
65
|
+
unless @source && @source.repo.directory?
|
|
66
|
+
raise Informative,
|
|
67
|
+
"Unable to find the `#{@repo}` repo. " \
|
|
68
|
+
'If it has not yet been cloned, add it via `pod repo add`.'
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def run
|
|
73
|
+
open_editor if @commit_message && @message.nil?
|
|
74
|
+
check_if_master_repo
|
|
75
|
+
validate_podspec_files
|
|
76
|
+
check_repo_status
|
|
77
|
+
update_repo
|
|
78
|
+
add_specs_to_repo
|
|
79
|
+
push_repo unless @local_only
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
#---------------------------------------------------------------------#
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
# @!group Push sub-steps
|
|
87
|
+
|
|
88
|
+
extend Executable
|
|
89
|
+
executable :git
|
|
90
|
+
|
|
91
|
+
# Open default editor to allow users to enter commit message
|
|
92
|
+
#
|
|
93
|
+
def open_editor
|
|
94
|
+
return if ENV['EDITOR'].nil?
|
|
95
|
+
|
|
96
|
+
file = Tempfile.new('cocoapods')
|
|
97
|
+
File.chmod(0777, file.path)
|
|
98
|
+
file.close
|
|
99
|
+
|
|
100
|
+
system("#{ENV['EDITOR']} #{file.path}")
|
|
101
|
+
@message = File.read file.path
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Temporary check to ensure that users do not push accidentally private
|
|
105
|
+
# specs to the master repo.
|
|
106
|
+
#
|
|
107
|
+
def check_if_master_repo
|
|
108
|
+
remotes = `git -C "#{repo_dir}" remote -v 2>&1`
|
|
109
|
+
master_repo_urls = [
|
|
110
|
+
'git@github.com:CocoaPods/Specs.git',
|
|
111
|
+
'https://github.com/CocoaPods/Specs.git',
|
|
112
|
+
]
|
|
113
|
+
is_master_repo = master_repo_urls.any? do |url|
|
|
114
|
+
remotes.include?(url)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if is_master_repo
|
|
118
|
+
raise Informative, 'To push to the CocoaPods master repo use ' \
|
|
119
|
+
"the `pod trunk push` command.\n\nIf you are using a fork of " \
|
|
120
|
+
'the master repo for private purposes we recommend to migrate ' \
|
|
121
|
+
'to a clean private repo. To disable this check remove the ' \
|
|
122
|
+
'remote pointing to the CocoaPods master repo.'
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Performs a full lint against the podspecs.
|
|
127
|
+
#
|
|
128
|
+
def validate_podspec_files
|
|
129
|
+
UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow
|
|
130
|
+
podspec_files.each do |podspec|
|
|
131
|
+
validator = Validator.new(podspec, @source_urls)
|
|
132
|
+
validator.allow_warnings = @allow_warnings
|
|
133
|
+
validator.use_frameworks = @use_frameworks
|
|
134
|
+
validator.ignore_public_only_results = @private
|
|
135
|
+
validator.swift_version = @swift_version
|
|
136
|
+
validator.skip_import_validation = @skip_import_validation
|
|
137
|
+
validator.skip_tests = @skip_tests
|
|
138
|
+
begin
|
|
139
|
+
validator.validate
|
|
140
|
+
rescue => e
|
|
141
|
+
raise Informative, "The `#{podspec}` specification does not validate." \
|
|
142
|
+
"\n\n#{e.message}"
|
|
143
|
+
end
|
|
144
|
+
raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Checks that the repo is clean.
|
|
149
|
+
#
|
|
150
|
+
# @raise If the repo is not clean.
|
|
151
|
+
#
|
|
152
|
+
# @todo Add specs for staged and unstaged files.
|
|
153
|
+
#
|
|
154
|
+
# @todo Gracefully handle the case where source is not under git
|
|
155
|
+
# source control.
|
|
156
|
+
#
|
|
157
|
+
# @return [void]
|
|
158
|
+
#
|
|
159
|
+
def check_repo_status
|
|
160
|
+
clean = `git -C "#{repo_dir}" status --porcelain 2>&1` == ''
|
|
161
|
+
raise Informative, "The repo `#{@repo}` at #{UI.path repo_dir} is not clean" unless clean
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Updates the git repo against the remote.
|
|
165
|
+
#
|
|
166
|
+
# @return [void]
|
|
167
|
+
#
|
|
168
|
+
def update_repo
|
|
169
|
+
UI.puts "Updating the `#{@repo}' repo\n".yellow
|
|
170
|
+
UI.puts `git -C "#{repo_dir}" pull 2>&1`
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Commits the podspecs to the source, which should be a git repo.
|
|
174
|
+
#
|
|
175
|
+
# @note The pre commit hook of the repo is skipped as the podspecs have
|
|
176
|
+
# already been linted.
|
|
177
|
+
#
|
|
178
|
+
# @return [void]
|
|
179
|
+
#
|
|
180
|
+
def add_specs_to_repo
|
|
181
|
+
UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow
|
|
182
|
+
podspec_files.each do |spec_file|
|
|
183
|
+
spec = Pod::Specification.from_file(spec_file)
|
|
184
|
+
output_path = @source.pod_path(spec.name) + spec.version.to_s
|
|
185
|
+
if @message && !@message.empty?
|
|
186
|
+
message = @message
|
|
187
|
+
elsif output_path.exist?
|
|
188
|
+
unless @allow_overwrite
|
|
189
|
+
raise Informative, "#{spec} already exists and overwriting has been disabled."
|
|
190
|
+
end
|
|
191
|
+
message = "[Fix] #{spec}"
|
|
192
|
+
elsif output_path.dirname.directory?
|
|
193
|
+
message = "[Update] #{spec}"
|
|
194
|
+
else
|
|
195
|
+
message = "[Add] #{spec}"
|
|
196
|
+
end
|
|
197
|
+
FileUtils.mkdir_p(output_path)
|
|
198
|
+
|
|
199
|
+
if @use_json
|
|
200
|
+
json_file_name = "#{spec.name}.podspec.json"
|
|
201
|
+
json_file = File.join(output_path, json_file_name)
|
|
202
|
+
File.open(json_file, 'w') { |file| file.write(spec.to_pretty_json) }
|
|
203
|
+
else
|
|
204
|
+
FileUtils.cp(spec_file, output_path)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# only commit if modified
|
|
208
|
+
if repo_git('status', '--porcelain').include?(spec.name)
|
|
209
|
+
UI.puts " - #{message}"
|
|
210
|
+
repo_git('add', spec.name)
|
|
211
|
+
repo_git('commit', '--no-verify', '-m', message)
|
|
212
|
+
else
|
|
213
|
+
UI.puts " - [No change] #{spec}"
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Pushes the git repo against the remote.
|
|
219
|
+
#
|
|
220
|
+
# @return [void]
|
|
221
|
+
#
|
|
222
|
+
def push_repo
|
|
223
|
+
UI.puts "\nPushing the `#{@repo}' repo\n".yellow
|
|
224
|
+
repo_git('-C', repo_dir, 'push', 'origin', 'HEAD:refs/for/master')
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
#---------------------------------------------------------------------#
|
|
228
|
+
|
|
229
|
+
private
|
|
230
|
+
|
|
231
|
+
# @!group Private helpers
|
|
232
|
+
|
|
233
|
+
# @return result of calling the git! with args in repo_dir
|
|
234
|
+
#
|
|
235
|
+
def repo_git(*args)
|
|
236
|
+
git!(['-C', repo_dir] + args)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# @return [Pathname] The directory of the repository.
|
|
240
|
+
#
|
|
241
|
+
def repo_dir
|
|
242
|
+
@source.specs_dir
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# @return [Array<Pathname>] The path of the specifications to push.
|
|
246
|
+
#
|
|
247
|
+
def podspec_files
|
|
248
|
+
if @podspec
|
|
249
|
+
path = Pathname(@podspec)
|
|
250
|
+
raise Informative, "Couldn't find #{@podspec}" unless path.exist?
|
|
251
|
+
[path]
|
|
252
|
+
else
|
|
253
|
+
files = Pathname.glob('*.podspec{,.json}')
|
|
254
|
+
raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
|
|
255
|
+
files
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# @return [Integer] The number of the podspec files to push.
|
|
260
|
+
#
|
|
261
|
+
def count
|
|
262
|
+
podspec_files.count
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Returns source for @repo
|
|
266
|
+
#
|
|
267
|
+
# @note If URL is invalid or repo doesn't exist, validate! will throw the error
|
|
268
|
+
#
|
|
269
|
+
# @return [Source]
|
|
270
|
+
#
|
|
271
|
+
def source_for_repo
|
|
272
|
+
config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
|
|
273
|
+
rescue
|
|
274
|
+
nil
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
#---------------------------------------------------------------------#
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Repo < Command
|
|
4
|
+
class Remove < Repo
|
|
5
|
+
self.summary = 'Remove a spec repo'
|
|
6
|
+
|
|
7
|
+
self.description = <<-DESC
|
|
8
|
+
Deletes the remote named `NAME` from the local spec-repos directory at `#{Config.instance.repos_dir}`.
|
|
9
|
+
DESC
|
|
10
|
+
|
|
11
|
+
self.arguments = [
|
|
12
|
+
CLAide::Argument.new('NAME', true),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
def initialize(argv)
|
|
16
|
+
@name = argv.shift_argument
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def validate!
|
|
21
|
+
super
|
|
22
|
+
help! 'Deleting a repo needs a `NAME`.' unless @name
|
|
23
|
+
help! "repo #{@name} does not exist" unless File.directory?(dir)
|
|
24
|
+
help! "You do not have permission to delete the #{@name} repository." \
|
|
25
|
+
'Perhaps try prefixing this command with sudo.' unless File.writable?(dir)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def run
|
|
29
|
+
UI.section("Removing spec repo `#{@name}`") do
|
|
30
|
+
FileUtils.rm_rf(dir)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Repo < Command
|
|
4
|
+
class Update < Repo
|
|
5
|
+
self.summary = 'Update a spec repo'
|
|
6
|
+
|
|
7
|
+
self.description = <<-DESC
|
|
8
|
+
Updates the local clone of the spec-repo `NAME`. If `NAME` is omitted
|
|
9
|
+
this will update all spec-repos in `#{Config.instance.repos_dir}`.
|
|
10
|
+
DESC
|
|
11
|
+
|
|
12
|
+
self.arguments = [
|
|
13
|
+
CLAide::Argument.new('NAME', false),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
def initialize(argv)
|
|
17
|
+
@name = argv.shift_argument
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
show_output = !config.silent?
|
|
23
|
+
config.sources_manager.update(@name, show_output)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
module Pod
|
|
4
|
+
class Command
|
|
5
|
+
class Setup < Command
|
|
6
|
+
self.summary = 'Setup the CocoaPods environment'
|
|
7
|
+
|
|
8
|
+
self.description = <<-DESC
|
|
9
|
+
Creates a directory at `#{Config.instance.repos_dir}` which will hold your spec-repos.
|
|
10
|
+
This is where it will create a clone of the public `master` spec-repo from:
|
|
11
|
+
|
|
12
|
+
https://github.com/CocoaPods/Specs
|
|
13
|
+
|
|
14
|
+
If the clone already exists, it will ensure that it is up-to-date.
|
|
15
|
+
DESC
|
|
16
|
+
|
|
17
|
+
extend Executable
|
|
18
|
+
executable :git
|
|
19
|
+
|
|
20
|
+
def run
|
|
21
|
+
UI.section 'Setting up CocoaPods master repo' do
|
|
22
|
+
if master_repo_dir.exist?
|
|
23
|
+
set_master_repo_url
|
|
24
|
+
set_master_repo_branch
|
|
25
|
+
update_master_repo
|
|
26
|
+
else
|
|
27
|
+
add_master_repo
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
UI.puts 'Setup completed'.green
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#--------------------------------------#
|
|
35
|
+
|
|
36
|
+
# @!group Setup steps
|
|
37
|
+
|
|
38
|
+
# Sets the url of the master repo according to whether it is push.
|
|
39
|
+
#
|
|
40
|
+
# @return [void]
|
|
41
|
+
#
|
|
42
|
+
def set_master_repo_url
|
|
43
|
+
Dir.chdir(master_repo_dir) do
|
|
44
|
+
git('remote', 'set-url', 'origin', url)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Adds the master repo from the remote.
|
|
49
|
+
#
|
|
50
|
+
# @return [void]
|
|
51
|
+
#
|
|
52
|
+
def add_master_repo
|
|
53
|
+
cmd = ['master', url, 'master', '--progress']
|
|
54
|
+
Repo::Add.parse(cmd).run
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Updates the master repo against the remote.
|
|
58
|
+
#
|
|
59
|
+
# @return [void]
|
|
60
|
+
#
|
|
61
|
+
def update_master_repo
|
|
62
|
+
show_output = !config.silent?
|
|
63
|
+
config.sources_manager.update('master', show_output)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Sets the repo to the master branch.
|
|
67
|
+
#
|
|
68
|
+
# @note This is not needed anymore as it was used for CocoaPods 0.6
|
|
69
|
+
# release candidates.
|
|
70
|
+
#
|
|
71
|
+
# @return [void]
|
|
72
|
+
#
|
|
73
|
+
def set_master_repo_branch
|
|
74
|
+
Dir.chdir(master_repo_dir) do
|
|
75
|
+
git %w(checkout master)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
#--------------------------------------#
|
|
80
|
+
|
|
81
|
+
# @!group Private helpers
|
|
82
|
+
|
|
83
|
+
# @return [String] the url to use according to whether push mode should
|
|
84
|
+
# be enabled.
|
|
85
|
+
#
|
|
86
|
+
def url
|
|
87
|
+
self.class.read_only_url
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# @return [String] the read only url of the master repo.
|
|
91
|
+
#
|
|
92
|
+
def self.read_only_url
|
|
93
|
+
'https://github.com/CocoaPods/Specs.git'
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @return [Pathname] the directory of the master repo.
|
|
97
|
+
#
|
|
98
|
+
def master_repo_dir
|
|
99
|
+
config.sources_manager.master_repo_dir
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|