Permalink
Browse files

- don't make assumptions about valid names of a rubygem.

  If it's not a valid rubygem, the download will fail and we report it
  anyway!

  Fixes #287
  • Loading branch information...
1 parent 4b6d3b3 commit 332b3667a5ac3afcd49df7774267f45c6a2769f8 @jordansissel committed Nov 8, 2012
Showing with 4 additions and 6 deletions.
  1. +3 −0 lib/fpm/command.rb
  2. +1 −6 lib/fpm/package/gem.rb
View
3 lib/fpm/command.rb
@@ -398,6 +398,9 @@ def execute
rescue FPM::InvalidPackageConfiguration => e
@logger.error("Invalid package configuration: #{e}")
return 1
+ rescue FPM::Package::InvalidArgument => e
+ @logger.error("Invalid package argument: #{e}")
+ return 1
ensure
input.cleanup unless input.nil?
output.cleanup unless output.nil?
View
7 lib/fpm/package/gem.rb
@@ -51,12 +51,7 @@ def input(gem)
def download_if_necessary(gem, gem_version)
path = gem
if !File.exists?(path)
- looks_like_name_re = /^[A-Za-z0-9_-]+$/
- if path =~ looks_like_name_re
- path = download(gem, gem_version)
- else
- raise FPM::Package::InvalidArgument.new("Gem '#{gem}' doesn't appear to be a valid rubygem file or name?")
- end
+ path = download(gem, gem_version)
end
@logger.info("Using gem file", :path => path)

0 comments on commit 332b366

Please sign in to comment.