Commit 6b826e54 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #214 from CocoaPods/CocoaPods-version.txt

[#201] Added support for CocoaPods-version.yml
parents 0be7a1e9 97e61199
Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION > '1.8.7' Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION > '1.8.7'
module Pod module Pod
VERSION = '0.5.1' VERSION = '0.6.0rc1'
class Informative < StandardError class Informative < StandardError
end end
......
...@@ -45,6 +45,7 @@ module Pod ...@@ -45,6 +45,7 @@ module Pod
puts "Cloning spec repo `#{@name}' from `#{@url}'" unless config.silent? puts "Cloning spec repo `#{@name}' from `#{@url}'" unless config.silent?
config.repos_dir.mkpath config.repos_dir.mkpath
Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") } Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") }
check_versions(dir)
end end
def update def update
...@@ -52,8 +53,24 @@ module Pod ...@@ -52,8 +53,24 @@ module Pod
dirs.each do |dir| dirs.each do |dir|
puts "Updating spec repo `#{dir.basename}'" unless config.silent? puts "Updating spec repo `#{dir.basename}'" unless config.silent?
Dir.chdir(dir) { git("pull") } Dir.chdir(dir) { git("pull") }
check_versions(dir)
end end
end end
def check_versions(dir)
bin_version = Gem::Version.new(VERSION)
yaml_file = dir + 'CocoaPods-version.yml'
return unless yaml_file.exist?
data = YAML.load_file(yaml_file)
min_version = Gem::Version.new(data[:min])
last_version = Gem::Version.new(data[:last])
if min_version > bin_version
raise Informative,
"\n[!] The `#{dir.basename.to_s}' repo requires CocoaPods #{min_version}\n".red +
"Update Cocoapods, or checkout the appropriate tag/commit in the repo\n\n"
end
puts "Cocoapods #{last_version} is available".green if last_version > bin_version
end
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment