Commit 331c95f9 authored by Fabio Pelosin's avatar Fabio Pelosin

[#201] Added support for CocoaPods-version.txt

parent 0be7a1e9
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.0.a'
class Informative < StandardError class Informative < StandardError
end end
......
...@@ -65,9 +65,23 @@ module Pod ...@@ -65,9 +65,23 @@ module Pod
end end
def self.run(*argv) def self.run(*argv)
bin_version = Gem::Version.new(VERSION)
last_version = bin_version
Source.all.each { |source|
file = source.repo + 'CocoaPods-version.txt'
next unless file.exist?
repo_min_version = Gem::Version.new(YAML.load_file(file)[:min])
repo_last_version = Gem::Version.new(YAML.load_file(file)[:last])
last_version = repo_last_version if repo_last_version && repo_last_version > last_version
if repo_min_version > bin_version
raise Informative, "\n[!] The repo `#{source}' requires CocoaPods version #{repo_version}\n".red +
"\nPlease, update your gem\n\n"
end
}
puts "\n-> Cocoapods #{last_version} is available \n".green.reversed if last_version > bin_version
Setup.new(ARGV.new).run_if_needed Setup.new(ARGV.new).run_if_needed
parse(*argv).run parse(*argv).run
rescue Interrupt rescue Interrupt
puts "[!] Cancelled".red puts "[!] Cancelled".red
Config.instance.verbose? ? raise : exit(1) Config.instance.verbose? ? raise : exit(1)
......
...@@ -83,5 +83,9 @@ module Pod ...@@ -83,5 +83,9 @@ module Pod
set if text.downcase.include?(query.downcase) set if text.downcase.include?(query.downcase)
end.compact end.compact
end end
def to_s
@repo.basename.to_s
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