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 @@ ...@@ -4,6 +4,8 @@
###### Bug fixes ###### 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. - Pre install hooks are called before the Pods are cleaned.
- Fixed and issue which prevent the inclusion of OTHER_CFLAGS and - Fixed and issue which prevent the inclusion of OTHER_CFLAGS and
OTHER_CPLUSPLUSFLAGS in the release builds of the Pods project. OTHER_CPLUSPLUSFLAGS in the release builds of the Pods project.
......
...@@ -72,13 +72,19 @@ module Pod ...@@ -72,13 +72,19 @@ module Pod
# @return [Nil] If not license text could be found. # @return [Nil] If not license text could be found.
# #
def license_text(spec) def license_text(spec)
if spec.license return nil unless spec.license
if text = spec.license[:text] text = spec.license[:text]
text unless text
elsif license_file = file_accessor(spec).license if license_file = file_accessor(spec).license
if license_file.exist?
text = IO.read(license_file) text = IO.read(license_file)
else
UI.warn "Unable to read the license file `#{license_file }` " \
"for the spec `#{spec}`"
end
end end
end end
text
end end
protected protected
......
...@@ -44,6 +44,12 @@ module Pod ...@@ -44,6 +44,12 @@ module Pod
text_from_spec.should == "post v1.0\n" text_from_spec.should == "post v1.0\n"
end 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 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