Commit fd8ac57e authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Warn if the Lockfile was generated with a higher version of CP

Closes #874
parent b81c03c4
...@@ -151,7 +151,17 @@ module Pod ...@@ -151,7 +151,17 @@ module Pod
# @return [void] # @return [void]
# #
# @note The warning about the version of the Lockfile doesn't uses the
# `UI.warn` method because it prints the output only at the end
# of the installation. At that time CocoaPods could have crashed.
#
def analyze def analyze
if lockfile && lockfile.cocoapods_version > Version.new(VERSION)
STDERR.puts '[!] The version of CocoaPods used to generate the lockfile is '\
'higher that the one of the current executable. Incompatibility' \
'issues might arise.'.yellow
end
analyzer = Analyzer.new(sandbox, podfile, lockfile) analyzer = Analyzer.new(sandbox, podfile, lockfile)
analyzer.update_mode = update_mode analyzer.update_mode = update_mode
@analysis_result = analyzer.analyze @analysis_result = analyzer.analyze
......
...@@ -93,6 +93,12 @@ module Pod ...@@ -93,6 +93,12 @@ module Pod
describe "#analyze" do describe "#analyze" do
it "prints a warning if the version of the Lockfile is higher than the one of the executable" do
Lockfile.any_instance.stubs(:cocoapods_version).returns(Version.new('999'))
STDERR.expects(:puts)
@installer.send(:analyze)
end
it "analyzes the Podfile, the Lockfile and the Sandbox" do it "analyzes the Podfile, the Lockfile and the Sandbox" do
@installer.send(:analyze) @installer.send(:analyze)
@installer.analysis_result.sandbox_state.added.should == ["JSONKit"] @installer.analysis_result.sandbox_state.added.should == ["JSONKit"]
......
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