Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Properly make the args ordering be $HOME/.fpm, $PWD/.fpm, CLI args

This fixes #615

    % cat .fpm
    --maintainer "Hello"
    % fpm -s dir -t rpm -n fizzle ~/.zshrc
    Loading flags from rc file .fpm {:level=>:warn}
    {:args=>["--maintainer", "Hello", "-s", "dir", "-t", "rpm", "-n", "fizzle", "/home/jls/.zshrc"]}
    no value for epoch is set, defaulting to nil {:level=>:warn}
    File already exists, refusing to continue: fizzle-1.0-1.x86_64.rpm
    {:level=>:fatal}
    % rpm -qip fizzle-1.0-1.x86_64.rpm| grep Packager
    Packager    : Hello
  • Loading branch information...
commit 1f764b8dad58d657397f3bca742039fafadf1823 1 parent 9688896
@jordansissel authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/fpm/command.rb
View
10 lib/fpm/command.rb
@@ -420,14 +420,18 @@ def run(*args)
# fpm initialization files, note the order of the following array is
# important, try .fpm in users home directory first and then the current
# directory
- rc_files = [File.join(ENV['HOME'],'.fpm'), '.fpm']
+ rc_files = [ ".fpm" ]
+ rc_files << File.join(ENV["HOME"], ".fpm") if ENV["HOME"]
rc_files.each do |rc_file|
if File.readable? rc_file
@logger.warn("Loading flags from rc file #{rc_file}")
File.readlines(rc_file).each do |line|
- Shellwords.shellsplit(line).each do |e|
- ARGV << e
+ # reverse becasue 'unshift' pushes onto the left side of the array.
+ Shellwords.shellsplit(line).reverse.each do |arg|
+ # Put '.fpm'-file flags *before* the command line flags
+ # so that we the CLI can override the .fpm flags
+ ARGV.unshift(arg)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.