Browse files

* Fix #278 Don't require additional args when --inputs is specified

* --inputs only valid with -s dir
* Strip lines when reading from file from --inputs
  • Loading branch information...
1 parent 4c05d2a commit a2e86c3f4413cb4d88b7009eb31e5803e187c6a5 @r4um r4um committed Nov 27, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/fpm/command.rb
View
8 lib/fpm/command.rb
@@ -325,7 +325,7 @@ def execute
# Read each line as a path
File.new(inputs, "r").each_line do |line|
# Handle each line as if it were an argument
- input.input(line)
+ input.input(line.strip)
end
end
@@ -483,14 +483,18 @@ def validate
end
end
+ if @command.inputs
+ mandatory(@command.input_type == "dir", "--inputs is only valid with -s dir")
+ end
+
mandatory(@command.args.any?,
"No parameters given. You need to pass additional command " \
"arguments so that I know what you want to build packages " \
"from. For example, for '-s dir' you would pass a list of " \
"files and directories. For '-s gem' you would pass a one" \
" or more gems to package from. As a full example, this " \
"will make an rpm of the 'json' rubygem: " \
- "`fpm -s gem -t rpm json`")
+ "`fpm -s gem -t rpm json`") unless @command.input_type == "dir" and @command.inputs
end # def validate
def mandatory(value, message)

0 comments on commit a2e86c3

Please sign in to comment.