Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --debug-workspace #734

Merged
merged 1 commit into from Jul 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/fpm/command.rb
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
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