Commit e515bb4d authored by Fabio Pelosin's avatar Fabio Pelosin

[Acknowledgements] Don't crash if the license file doesn't exists.

Closes #828
parent 57ec4645
......@@ -4,6 +4,8 @@
###### Bug fixes
- CocoaPods will not crash anymore if the license file indicated on the spec
doesn't exits.
- Pre install hooks are called before the Pods are cleaned.
- Fixed and issue which prevent the inclusion of OTHER_CFLAGS and
OTHER_CPLUSPLUSFLAGS in the release builds of the Pods project.
......
......@@ -72,13 +72,19 @@ module Pod
# @return [Nil] If not license text could be found.
#
def license_text(spec)
if spec.license
if text = spec.license[:text]
text
elsif license_file = file_accessor(spec).license
text = IO.read(license_file)
return nil unless spec.license
text = spec.license[:text]
unless text
if license_file = file_accessor(spec).license
if license_file.exist?
text = IO.read(license_file)
else
UI.warn "Unable to read the license file `#{license_file }` " \
"for the spec `#{spec}`"
end
end
end
text
end
protected
......
......@@ -44,6 +44,12 @@ module Pod
text_from_spec.should == "post v1.0\n"
end
it "warns the user if the file specified in the license doesn't exists" do
@spec.stubs(:license).returns({ :type => 'MIT', :file => 'MISSING'})
text_from_spec = @generator.send(:license_text, @spec)
UI.warnings.should.include "Unable to read the license file"
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