cocoapods 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +329 -0
- data/lib/cocoapods/command/init.rb +6 -6
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -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/ipc.rb +18 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +111 -0
- data/lib/cocoapods/command/lib.rb +3 -207
- data/lib/cocoapods/command/repo/push.rb +44 -20
- data/lib/cocoapods/command/setup.rb +2 -1
- data/lib/cocoapods/command/spec/lint.rb +4 -0
- data/lib/cocoapods/command.rb +2 -1
- data/lib/cocoapods/config.rb +4 -1
- data/lib/cocoapods/downloader/cache.rb +1 -0
- data/lib/cocoapods/downloader.rb +20 -0
- data/lib/cocoapods/executable.rb +1 -1
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/plist.rb +4 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +4 -10
- data/lib/cocoapods/generator/header.rb +2 -1
- data/lib/cocoapods/generator/prefix_header.rb +0 -12
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +38 -5
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +5 -1
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -1
- data/lib/cocoapods/installer/analyzer.rb +161 -1
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +29 -9
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +204 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +401 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
- data/lib/cocoapods/installer/xcode.rb +7 -0
- data/lib/cocoapods/installer.rb +50 -214
- data/lib/cocoapods/resolver.rb +15 -9
- data/lib/cocoapods/sandbox/headers_store.rb +4 -10
- data/lib/cocoapods/sandbox/path_list.rb +20 -9
- data/lib/cocoapods/sources_manager.rb +7 -10
- data/lib/cocoapods/target/aggregate_target.rb +20 -0
- data/lib/cocoapods/target/pod_target.rb +37 -7
- data/lib/cocoapods/user_interface/error_report.rb +7 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/user_interface.rb +7 -5
- data/lib/cocoapods/validator.rb +59 -11
- metadata +112 -83
- data/lib/cocoapods/command/inter_process_communication.rb +0 -177
- data/lib/cocoapods/installer/file_references_installer.rb +0 -310
- data/lib/cocoapods/installer/migrator.rb +0 -86
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -368
- data/lib/cocoapods/installer/target_installer.rb +0 -210
@@ -0,0 +1,105 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Lib < Command
|
4
|
+
class Create < Lib
|
5
|
+
self.summary = 'Creates a new Pod'
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
Creates a scaffold for the development of a new Pod named `NAME`
|
9
|
+
according to the CocoaPods best practices.
|
10
|
+
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible
|
11
|
+
template, is specified, it will be used in place of the default one.
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('NAME', true),
|
16
|
+
]
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--template-url=URL', 'The URL of the git repo containing a ' \
|
21
|
+
'compatible template'],
|
22
|
+
].concat(super)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@name = argv.shift_argument
|
27
|
+
@template_url = argv.option('template-url', TEMPLATE_REPO)
|
28
|
+
super
|
29
|
+
@additional_args = argv.remainder!
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate!
|
33
|
+
super
|
34
|
+
help! 'A name for the Pod is required.' unless @name
|
35
|
+
help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
|
36
|
+
help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
|
37
|
+
help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
clone_template
|
42
|
+
configure_template
|
43
|
+
print_info
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
#----------------------------------------#
|
49
|
+
|
50
|
+
# !@group Private helpers
|
51
|
+
|
52
|
+
extend Executable
|
53
|
+
executable :git
|
54
|
+
|
55
|
+
TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'.freeze
|
56
|
+
TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'.freeze
|
57
|
+
CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'.freeze
|
58
|
+
|
59
|
+
# Clones the template from the remote in the working directory using
|
60
|
+
# the name of the Pod.
|
61
|
+
#
|
62
|
+
# @return [void]
|
63
|
+
#
|
64
|
+
def clone_template
|
65
|
+
UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
|
66
|
+
git! ['clone', template_repo_url, @name]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Runs the template configuration utilities.
|
71
|
+
#
|
72
|
+
# @return [void]
|
73
|
+
#
|
74
|
+
def configure_template
|
75
|
+
UI.section("Configuring #{@name} template.") do
|
76
|
+
Dir.chdir(@name) do
|
77
|
+
if File.exist?('configure')
|
78
|
+
system({ 'COCOAPODS_VERSION' => Pod::VERSION }, './configure', @name, *@additional_args)
|
79
|
+
else
|
80
|
+
UI.warn 'Template does not have a configure file.'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Runs the template configuration utilities.
|
87
|
+
#
|
88
|
+
# @return [void]
|
89
|
+
#
|
90
|
+
def print_info
|
91
|
+
UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
|
92
|
+
UI.puts "To learn more about creating a new pod, see `#{CREATE_NEW_POD_INFO_URL}`."
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
|
96
|
+
#
|
97
|
+
# @return String
|
98
|
+
#
|
99
|
+
def template_repo_url
|
100
|
+
@template_url || TEMPLATE_REPO
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Lib < Command
|
4
|
+
class Lint < Lib
|
5
|
+
self.summary = 'Validates a Pod'
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
Validates the Pod using the files in the working directory.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
['--quick', 'Lint skips checks that would require to download and build the spec'],
|
14
|
+
['--allow-warnings', 'Lint validates even if warnings are present'],
|
15
|
+
['--subspec=NAME', 'Lint validates only the given subspec'],
|
16
|
+
['--no-subspecs', 'Lint skips validation of subspecs'],
|
17
|
+
['--no-clean', 'Lint leaves the build directory intact for inspection'],
|
18
|
+
['--fail-fast', 'Lint stops on the first failing platform or subspec'],
|
19
|
+
['--use-libraries', 'Lint uses static libraries to install the spec'],
|
20
|
+
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
21
|
+
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
22
|
+
'Multiple sources must be comma-delimited.'],
|
23
|
+
['--private', 'Lint skips checks that apply only to public specs'],
|
24
|
+
['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
|
25
|
+
'This takes precedence over a .swift-version file.'],
|
26
|
+
].concat(super)
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(argv)
|
30
|
+
@quick = argv.flag?('quick')
|
31
|
+
@allow_warnings = argv.flag?('allow-warnings')
|
32
|
+
@clean = argv.flag?('clean', true)
|
33
|
+
@fail_fast = argv.flag?('fail-fast', false)
|
34
|
+
@subspecs = argv.flag?('subspecs', true)
|
35
|
+
@only_subspec = argv.option('subspec')
|
36
|
+
@use_frameworks = !argv.flag?('use-libraries')
|
37
|
+
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
38
|
+
@private = argv.flag?('private', false)
|
39
|
+
@swift_version = argv.option('swift-version', nil)
|
40
|
+
@podspecs_paths = argv.arguments!
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate!
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
def run
|
49
|
+
UI.puts
|
50
|
+
podspecs_to_lint.each do |podspec|
|
51
|
+
validator = Validator.new(podspec, @source_urls)
|
52
|
+
validator.local = true
|
53
|
+
validator.quick = @quick
|
54
|
+
validator.no_clean = !@clean
|
55
|
+
validator.fail_fast = @fail_fast
|
56
|
+
validator.allow_warnings = @allow_warnings
|
57
|
+
validator.no_subspecs = !@subspecs || @only_subspec
|
58
|
+
validator.only_subspec = @only_subspec
|
59
|
+
validator.use_frameworks = @use_frameworks
|
60
|
+
validator.ignore_public_only_results = @private
|
61
|
+
validator.swift_version = @swift_version
|
62
|
+
validator.validate
|
63
|
+
|
64
|
+
unless @clean
|
65
|
+
UI.puts "Pods workspace available at `#{validator.validation_dir}/App.xcworkspace` for inspection."
|
66
|
+
UI.puts
|
67
|
+
end
|
68
|
+
if validator.validated?
|
69
|
+
UI.puts "#{validator.spec.name} passed validation.".green
|
70
|
+
else
|
71
|
+
spec_name = podspec
|
72
|
+
spec_name = validator.spec.name if validator.spec
|
73
|
+
message = "#{spec_name} did not pass validation, due to #{validator.failure_reason}."
|
74
|
+
|
75
|
+
if @clean
|
76
|
+
message << "\nYou can use the `--no-clean` option to inspect " \
|
77
|
+
'any issue.'
|
78
|
+
end
|
79
|
+
raise Informative, message
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
#----------------------------------------#
|
87
|
+
|
88
|
+
# !@group Private helpers
|
89
|
+
|
90
|
+
# @return [Pathname] The path of the podspec found in the current
|
91
|
+
# working directory.
|
92
|
+
#
|
93
|
+
# @raise If no podspec is found.
|
94
|
+
# @raise If multiple podspecs are found.
|
95
|
+
#
|
96
|
+
def podspecs_to_lint
|
97
|
+
if !@podspecs_paths.empty?
|
98
|
+
Array(@podspecs_paths)
|
99
|
+
else
|
100
|
+
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}')
|
101
|
+
if podspecs.count.zero?
|
102
|
+
raise Informative, 'Unable to find a podspec in the working ' \
|
103
|
+
'directory'
|
104
|
+
end
|
105
|
+
podspecs
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -1,215 +1,11 @@
|
|
1
|
+
require 'cocoapods/command/lib/create'
|
2
|
+
require 'cocoapods/command/lib/lint'
|
3
|
+
|
1
4
|
module Pod
|
2
5
|
class Command
|
3
6
|
class Lib < Command
|
4
7
|
self.abstract_command = true
|
5
8
|
self.summary = 'Develop pods'
|
6
|
-
|
7
|
-
#-----------------------------------------------------------------------#
|
8
|
-
|
9
|
-
class Create < Lib
|
10
|
-
self.summary = 'Creates a new Pod'
|
11
|
-
|
12
|
-
self.description = <<-DESC
|
13
|
-
Creates a scaffold for the development of a new Pod named `NAME`
|
14
|
-
according to the CocoaPods best practices.
|
15
|
-
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible
|
16
|
-
template, is specified, it will be used in place of the default one.
|
17
|
-
DESC
|
18
|
-
|
19
|
-
self.arguments = [
|
20
|
-
CLAide::Argument.new('NAME', true),
|
21
|
-
]
|
22
|
-
|
23
|
-
def self.options
|
24
|
-
[
|
25
|
-
['--template-url=URL', 'The URL of the git repo containing a ' \
|
26
|
-
'compatible template'],
|
27
|
-
].concat(super)
|
28
|
-
end
|
29
|
-
|
30
|
-
def initialize(argv)
|
31
|
-
@name = argv.shift_argument
|
32
|
-
@template_url = argv.option('template-url', TEMPLATE_REPO)
|
33
|
-
super
|
34
|
-
@additional_args = argv.remainder!
|
35
|
-
end
|
36
|
-
|
37
|
-
def validate!
|
38
|
-
super
|
39
|
-
help! 'A name for the Pod is required.' unless @name
|
40
|
-
help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
|
41
|
-
help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
|
42
|
-
end
|
43
|
-
|
44
|
-
def run
|
45
|
-
clone_template
|
46
|
-
configure_template
|
47
|
-
print_info
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
#----------------------------------------#
|
53
|
-
|
54
|
-
# !@group Private helpers
|
55
|
-
|
56
|
-
extend Executable
|
57
|
-
executable :git
|
58
|
-
|
59
|
-
TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'
|
60
|
-
TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'
|
61
|
-
CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'
|
62
|
-
|
63
|
-
# Clones the template from the remote in the working directory using
|
64
|
-
# the name of the Pod.
|
65
|
-
#
|
66
|
-
# @return [void]
|
67
|
-
#
|
68
|
-
def clone_template
|
69
|
-
UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
|
70
|
-
git! ['clone', template_repo_url, @name]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Runs the template configuration utilities.
|
75
|
-
#
|
76
|
-
# @return [void]
|
77
|
-
#
|
78
|
-
def configure_template
|
79
|
-
UI.section("Configuring #{@name} template.") do
|
80
|
-
Dir.chdir(@name) do
|
81
|
-
if File.exist?('configure')
|
82
|
-
system('./configure', @name, *@additional_args)
|
83
|
-
else
|
84
|
-
UI.warn 'Template does not have a configure file.'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# Runs the template configuration utilities.
|
91
|
-
#
|
92
|
-
# @return [void]
|
93
|
-
#
|
94
|
-
def print_info
|
95
|
-
UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
|
96
|
-
UI.puts "To learn more about creating a new pod, see `#{CREATE_NEW_POD_INFO_URL}`."
|
97
|
-
end
|
98
|
-
|
99
|
-
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
|
100
|
-
#
|
101
|
-
# @return String
|
102
|
-
#
|
103
|
-
def template_repo_url
|
104
|
-
@template_url || TEMPLATE_REPO
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
#-----------------------------------------------------------------------#
|
109
|
-
|
110
|
-
class Lint < Lib
|
111
|
-
self.summary = 'Validates a Pod'
|
112
|
-
|
113
|
-
self.description = <<-DESC
|
114
|
-
Validates the Pod using the files in the working directory.
|
115
|
-
DESC
|
116
|
-
|
117
|
-
def self.options
|
118
|
-
[
|
119
|
-
['--quick', 'Lint skips checks that would require to download and build the spec'],
|
120
|
-
['--allow-warnings', 'Lint validates even if warnings are present'],
|
121
|
-
['--subspec=NAME', 'Lint validates only the given subspec'],
|
122
|
-
['--no-subspecs', 'Lint skips validation of subspecs'],
|
123
|
-
['--no-clean', 'Lint leaves the build directory intact for inspection'],
|
124
|
-
['--fail-fast', 'Lint stops on the first failing platform or subspec'],
|
125
|
-
['--use-libraries', 'Lint uses static libraries to install the spec'],
|
126
|
-
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
127
|
-
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
128
|
-
'Multiple sources must be comma-delimited.'],
|
129
|
-
['--private', 'Lint skips checks that apply only to public specs'],
|
130
|
-
].concat(super)
|
131
|
-
end
|
132
|
-
|
133
|
-
def initialize(argv)
|
134
|
-
@quick = argv.flag?('quick')
|
135
|
-
@allow_warnings = argv.flag?('allow-warnings')
|
136
|
-
@clean = argv.flag?('clean', true)
|
137
|
-
@fail_fast = argv.flag?('fail-fast', false)
|
138
|
-
@subspecs = argv.flag?('subspecs', true)
|
139
|
-
@only_subspec = argv.option('subspec')
|
140
|
-
@use_frameworks = !argv.flag?('use-libraries')
|
141
|
-
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
142
|
-
@private = argv.flag?('private', false)
|
143
|
-
@podspecs_paths = argv.arguments!
|
144
|
-
super
|
145
|
-
end
|
146
|
-
|
147
|
-
def validate!
|
148
|
-
super
|
149
|
-
end
|
150
|
-
|
151
|
-
def run
|
152
|
-
UI.puts
|
153
|
-
podspecs_to_lint.each do |podspec|
|
154
|
-
validator = Validator.new(podspec, @source_urls)
|
155
|
-
validator.local = true
|
156
|
-
validator.quick = @quick
|
157
|
-
validator.no_clean = !@clean
|
158
|
-
validator.fail_fast = @fail_fast
|
159
|
-
validator.allow_warnings = @allow_warnings
|
160
|
-
validator.no_subspecs = !@subspecs || @only_subspec
|
161
|
-
validator.only_subspec = @only_subspec
|
162
|
-
validator.use_frameworks = @use_frameworks
|
163
|
-
validator.ignore_public_only_results = @private
|
164
|
-
validator.validate
|
165
|
-
|
166
|
-
unless @clean
|
167
|
-
UI.puts "Pods workspace available at `#{validator.validation_dir}/App.xcworkspace` for inspection."
|
168
|
-
UI.puts
|
169
|
-
end
|
170
|
-
if validator.validated?
|
171
|
-
UI.puts "#{validator.spec.name} passed validation.".green
|
172
|
-
else
|
173
|
-
spec_name = podspec
|
174
|
-
spec_name = validator.spec.name if validator.spec
|
175
|
-
message = "#{spec_name} did not pass validation, due to #{validator.failure_reason}."
|
176
|
-
|
177
|
-
if @clean
|
178
|
-
message << "\nYou can use the `--no-clean` option to inspect " \
|
179
|
-
'any issue.'
|
180
|
-
end
|
181
|
-
raise Informative, message
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
private
|
187
|
-
|
188
|
-
#----------------------------------------#
|
189
|
-
|
190
|
-
# !@group Private helpers
|
191
|
-
|
192
|
-
# @return [Pathname] The path of the podspec found in the current
|
193
|
-
# working directory.
|
194
|
-
#
|
195
|
-
# @raise If no podspec is found.
|
196
|
-
# @raise If multiple podspecs are found.
|
197
|
-
#
|
198
|
-
def podspecs_to_lint
|
199
|
-
if !@podspecs_paths.empty?
|
200
|
-
Array(@podspecs_paths)
|
201
|
-
else
|
202
|
-
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}')
|
203
|
-
if podspecs.count.zero?
|
204
|
-
raise Informative, 'Unable to find a podspec in the working ' \
|
205
|
-
'directory'
|
206
|
-
end
|
207
|
-
podspecs
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
#-----------------------------------------------------------------------#
|
213
9
|
end
|
214
10
|
end
|
215
11
|
end
|
@@ -31,6 +31,7 @@ module Pod
|
|
31
31
|
['--no-private', 'Lint includes checks that apply only to public repos'],
|
32
32
|
['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \
|
33
33
|
'Opens default editor if no commit message is specified.'],
|
34
|
+
['--use-json', 'Push JSON spec to repo'],
|
34
35
|
].concat(super)
|
35
36
|
end
|
36
37
|
|
@@ -38,25 +39,25 @@ module Pod
|
|
38
39
|
@allow_warnings = argv.flag?('allow-warnings')
|
39
40
|
@local_only = argv.flag?('local-only')
|
40
41
|
@repo = argv.shift_argument
|
41
|
-
@source =
|
42
|
+
@source = source_for_repo
|
42
43
|
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
|
43
44
|
@podspec = argv.shift_argument
|
44
45
|
@use_frameworks = !argv.flag?('use-libraries')
|
45
46
|
@private = argv.flag?('private', true)
|
46
47
|
@message = argv.option('commit-message')
|
47
48
|
@commit_message = argv.flag?('commit-message', false)
|
49
|
+
@use_json = argv.flag?('use-json')
|
48
50
|
super
|
49
51
|
end
|
50
52
|
|
51
53
|
def validate!
|
52
|
-
|
53
|
-
unless @
|
54
|
+
super
|
55
|
+
help! 'A spec-repo name or url is required.' unless @repo
|
56
|
+
unless @source && @source.repo.directory?
|
54
57
|
raise Informative,
|
55
58
|
"Unable to find the `#{@repo}` repo. " \
|
56
59
|
'If it has not yet been cloned, add it via `pod repo add`.'
|
57
60
|
end
|
58
|
-
|
59
|
-
super
|
60
61
|
end
|
61
62
|
|
62
63
|
def run
|
@@ -95,7 +96,7 @@ module Pod
|
|
95
96
|
# specs to the master repo.
|
96
97
|
#
|
97
98
|
def check_if_master_repo
|
98
|
-
remotes =
|
99
|
+
remotes = `git -C "#{repo_dir}" remote -v 2>&1`
|
99
100
|
master_repo_urls = [
|
100
101
|
'git@github.com:CocoaPods/Specs.git',
|
101
102
|
'https://github.com/CocoaPods/Specs.git',
|
@@ -144,7 +145,7 @@ module Pod
|
|
144
145
|
# @return [void]
|
145
146
|
#
|
146
147
|
def check_repo_status
|
147
|
-
clean =
|
148
|
+
clean = `git -C "#{repo_dir}" status --porcelain 2>&1` == ''
|
148
149
|
raise Informative, "The repo `#{@repo}` at #{UI.path repo_dir} is not clean" unless clean
|
149
150
|
end
|
150
151
|
|
@@ -154,7 +155,7 @@ module Pod
|
|
154
155
|
#
|
155
156
|
def update_repo
|
156
157
|
UI.puts "Updating the `#{@repo}' repo\n".yellow
|
157
|
-
|
158
|
+
UI.puts `git -C "#{repo_dir}" pull 2>&1`
|
158
159
|
end
|
159
160
|
|
160
161
|
# Commits the podspecs to the source, which should be a git repo.
|
@@ -178,18 +179,23 @@ module Pod
|
|
178
179
|
else
|
179
180
|
message = "[Add] #{spec}"
|
180
181
|
end
|
181
|
-
|
182
182
|
FileUtils.mkdir_p(output_path)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
183
|
+
|
184
|
+
if @use_json
|
185
|
+
json_file_name = "#{spec.name}.podspec.json"
|
186
|
+
json_file = File.join(output_path, json_file_name)
|
187
|
+
File.open(json_file, 'w') { |file| file.write(spec.to_pretty_json) }
|
188
|
+
else
|
189
|
+
FileUtils.cp(spec_file, output_path)
|
190
|
+
end
|
191
|
+
|
192
|
+
# only commit if modified
|
193
|
+
if repo_git('status', '--porcelain').include?(spec.name)
|
194
|
+
UI.puts " - #{message}"
|
195
|
+
repo_git('add', spec.name)
|
196
|
+
repo_git('commit', '--no-verify', '-m', message)
|
197
|
+
else
|
198
|
+
UI.puts " - [No change] #{spec}"
|
193
199
|
end
|
194
200
|
end
|
195
201
|
end
|
@@ -200,7 +206,7 @@ module Pod
|
|
200
206
|
#
|
201
207
|
def push_repo
|
202
208
|
UI.puts "\nPushing the `#{@repo}' repo\n".yellow
|
203
|
-
|
209
|
+
UI.puts `git -C "#{repo_dir}" push origin master 2>&1`
|
204
210
|
end
|
205
211
|
|
206
212
|
#---------------------------------------------------------------------#
|
@@ -209,6 +215,12 @@ module Pod
|
|
209
215
|
|
210
216
|
# @!group Private helpers
|
211
217
|
|
218
|
+
# @return result of calling the git! with args in repo_dir
|
219
|
+
#
|
220
|
+
def repo_git(*args)
|
221
|
+
git!(['-C', repo_dir] + args)
|
222
|
+
end
|
223
|
+
|
212
224
|
# @return [Pathname] The directory of the repository.
|
213
225
|
#
|
214
226
|
def repo_dir
|
@@ -235,6 +247,18 @@ module Pod
|
|
235
247
|
podspec_files.count
|
236
248
|
end
|
237
249
|
|
250
|
+
# Returns source for @repo
|
251
|
+
#
|
252
|
+
# @note If URL is invalid or repo doesn't exist, validate! will throw the error
|
253
|
+
#
|
254
|
+
# @return [Source]
|
255
|
+
#
|
256
|
+
def source_for_repo
|
257
|
+
config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
|
258
|
+
rescue
|
259
|
+
nil
|
260
|
+
end
|
261
|
+
|
238
262
|
#---------------------------------------------------------------------#
|
239
263
|
end
|
240
264
|
end
|
@@ -27,6 +27,8 @@ module Pod
|
|
27
27
|
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
28
28
|
'Multiple sources must be comma-delimited.'],
|
29
29
|
['--private', 'Lint skips checks that apply only to public specs'],
|
30
|
+
['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
|
31
|
+
'This takes precedence over a .swift-version file.'],
|
30
32
|
].concat(super)
|
31
33
|
end
|
32
34
|
|
@@ -40,6 +42,7 @@ module Pod
|
|
40
42
|
@use_frameworks = !argv.flag?('use-libraries')
|
41
43
|
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
42
44
|
@private = argv.flag?('private', false)
|
45
|
+
@swift_version = argv.option('swift-version', nil)
|
43
46
|
@podspecs_paths = argv.arguments!
|
44
47
|
super
|
45
48
|
end
|
@@ -57,6 +60,7 @@ module Pod
|
|
57
60
|
validator.only_subspec = @only_subspec
|
58
61
|
validator.use_frameworks = @use_frameworks
|
59
62
|
validator.ignore_public_only_results = @private
|
63
|
+
validator.swift_version = @swift_version
|
60
64
|
validator.validate
|
61
65
|
failure_reasons << validator.failure_reason
|
62
66
|
|
data/lib/cocoapods/command.rb
CHANGED
@@ -22,7 +22,7 @@ module Pod
|
|
22
22
|
require 'cocoapods/command/env'
|
23
23
|
require 'cocoapods/command/init'
|
24
24
|
require 'cocoapods/command/install'
|
25
|
-
require 'cocoapods/command/
|
25
|
+
require 'cocoapods/command/ipc'
|
26
26
|
require 'cocoapods/command/lib'
|
27
27
|
require 'cocoapods/command/list'
|
28
28
|
require 'cocoapods/command/outdated'
|
@@ -62,6 +62,7 @@ module Pod
|
|
62
62
|
else
|
63
63
|
if ENV['COCOA_PODS_ENV'] != 'development'
|
64
64
|
puts UI::ErrorReport.report(exception)
|
65
|
+
UI::ErrorReport.search_for_exceptions(exception)
|
65
66
|
exit 1
|
66
67
|
else
|
67
68
|
raise exception
|
data/lib/cocoapods/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/multibyte/unicode'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
# Stores the global configuration of CocoaPods.
|
3
5
|
#
|
@@ -145,7 +147,8 @@ module Pod
|
|
145
147
|
# Podfile is located.
|
146
148
|
#
|
147
149
|
def installation_root
|
148
|
-
|
150
|
+
current_dir = ActiveSupport::Multibyte::Unicode.normalize(Dir.pwd)
|
151
|
+
current_path = Pathname.new(current_dir)
|
149
152
|
unless @installation_root
|
150
153
|
until current_path.root?
|
151
154
|
if podfile_path_in_dir(current_path)
|