Skip to content

Commit

Permalink
Merge pull request jordansissel#734 from jordansissel/add-debug-works…
Browse files Browse the repository at this point in the history
…pace

Add --debug-workspace
  • Loading branch information
jordansissel committed Jul 10, 2014
2 parents 28c43ac + 51bc556 commit 360313c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions lib/fpm/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def help(*args)
option ["-n", "--name"], "NAME", "The name to give to the package"
option "--verbose", :flag, "Enable verbose output"
option "--debug", :flag, "Enable debug output"
option "--debug-workspace", :flag, "Keep any file workspaces around for " \
"debugging. This will disable automatic cleanup of package staging and " \
"build paths. It will also print which directories are available."
option ["-v", "--version"], "VERSION", "The version to give to the package",
:default => 1.0
option "--iteration", "ITERATION",
Expand Down Expand Up @@ -426,8 +429,18 @@ def execute
@logger.error("Process failed: #{e}")
return 1
ensure
input.cleanup unless input.nil?
output.cleanup unless output.nil?
if debug_workspace?
# only emit them if they have files
[input, output].each do |plugin|
[:staging_path, :build_path].each do |pathtype|
path = plugin.send(pathtype)
puts "#{plugin.type} #{pathtype}: #{path}" if Dir.open(path).to_a.size > 2
end
end
else
input.cleanup unless input.nil?
output.cleanup unless output.nil?
end
end # def execute

def run(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -519,5 +519,5 @@ def provides=(value)

# Package internal public api
public(:cleanup_staging, :cleanup_build, :staging_path, :converted_from,
:edit_file)
:edit_file, :build_path)
end # class FPM::Package

0 comments on commit 360313c

Please sign in to comment.