Skip to content
This repository
Browse code

- clean up and catch null case

  • Loading branch information...
commit 53e8e47dbe0dab717ae8b8fd6f6325ed1a2cac9c 1 parent bc9cae7
Jordan Sissel authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  lib/fpm/source/gem.rb
3  lib/fpm/source/gem.rb
@@ -86,7 +86,8 @@ def get_metadata
86 86
         end
87 87
 
88 88
         # make sure we have a description
89  
-        self[:description] = [ self[:description], self[:summary], "N/A" ].detect { |t| !t.strip == "" }
  89
+        descriptions = [ self[:description], self[:summary], "#{spec.name} - no description given" ]
  90
+        self[:description] = descriptions.detect { |d| !(d.nil? or d.strip.empty?) }
90 91
 
91 92
         self[:dependencies] = []
92 93
         spec.runtime_dependencies.map do |dep|

2 notes on commit 53e8e47

David Dollar

You could also make this:

!d.to_s.strip.empty?

Obviously not important, just a neat trick I like to use.

Jordan Sissel
Owner

Ahh, didn't know nil.to_s was "' - nice trick :)

Please sign in to comment.
Something went wrong with that request. Please try again.