forked from CocoaPods/Specs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (36 loc) · 1.01 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
GEMS_DIR = '.gems'
desc "Installs the latest versions of the CocoaPods gems in `.gems'"
task :install_gems do
unless File.exist?(GEMS_DIR)
sh "gem install cocoapods --install-dir='#{GEMS_DIR}' --no-rdoc --no-ri"
end
end
desc "Run `pod spec lint` on all specs"
task :lint do
exit if ENV['skip-lint']
if File.exist?(GEMS_DIR)
gems = Dir.glob(File.join(GEMS_DIR, 'gems', '*'))
pod = File.join(gems.find { |path| path =~ /cocoapods-[\d\.]+$/ }, 'bin/pod')
end
specs = `git diff-index --name-only HEAD | grep '.podspec$'`.strip.split("\n")
specs = FileList['**/*.podspec'] if specs.empty?
failures = []
specs.each do |spec|
begin
if gems
sh "macruby -I '#{gems.join("/lib' -I '")}/lib' '#{pod}' spec lint '#{spec}'"
else
sh "pod spec lint '#{spec}'"
end
rescue
failures << spec
end
end
unless failures.empty?
puts
puts "The following specs did not pass `spec lint`:"
puts failures.join("\n")
exit 1
end
end
task :default => :lint