Skip to content

Commit

Permalink
Rebuild only when all the patches are succesfully applied
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef Stribny committed Jul 7, 2014
1 parent 7aaf83e commit 0b452b0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/rubygems/patcher.rb
Expand Up @@ -42,7 +42,8 @@ def patch_with(patches, options)
@std << apply_patch(patch, options)
end
remove(options[:remove], @target_dir) if options[:remove]
build_patched_gem
# Rebuild only if there weren't any problems
build_patched_gem unless failed?

options[:outfile] ||= File.join(@output_dir, @package.spec.file_name)
FileUtils.mv((File.join @target_dir, @package.spec.file_name), options[:outfile]) unless options[:dry_run]
Expand Down Expand Up @@ -115,6 +116,13 @@ def std
@std
end

##
# Return false if any of the pathes failed

def failed?
@std.join(' ') =~ /.*Hunk #[0-9]+ (ignored|failed).*/
end

private

def extract_gem
Expand Down

0 comments on commit 0b452b0

Please sign in to comment.