lib/kpm/killbill_server_artifact.rb in kpm-0.10.1 vs lib/kpm/killbill_server_artifact.rb in kpm-0.10.2
- old
+ new
@@ -39,14 +39,19 @@
verify_sha1,
overrides,
ssl_verify)
# Extract the killbill-oss-parent version
- pom = REXML::Document.new(File.new(kb_pom_info[:file_path]))
- oss_parent_version = pom.root.elements['parent/version'].text
- kb_version = pom.root.elements['version'].text
-
+ file = File.new(kb_pom_info[:file_path])
+ begin
+ pom = REXML::Document.new(file)
+ oss_parent_version = pom.root.elements['parent/version'].text
+ kb_version = pom.root.elements['version'].text
+ ensure
+ file.close
+ FileUtils.rm_f(kb_pom_info[:file_path])
+ end
versions['killbill'] = kb_version
versions['killbill-oss-parent'] = oss_parent_version
# Retrieve the killbill-oss-parent pom
oss_pom_info = pull(logger,
@@ -59,16 +64,20 @@
sha1_file,
force_download,
verify_sha1,
overrides,
ssl_verify)
-
- pom = REXML::Document.new(File.new(oss_pom_info[:file_path]))
- properties_element = pom.root.elements['properties']
- %w[killbill-api killbill-plugin-api killbill-commons killbill-platform].each do |property|
- versions[property] = properties_element.elements["#{property}.version"].text
+ file = File.new(oss_pom_info[:file_path])
+ begin
+ pom = REXML::Document.new(file)
+ properties_element = pom.root.elements['properties']
+ %w[killbill-api killbill-plugin-api killbill-commons killbill-platform].each do |property|
+ versions[property] = properties_element.elements["#{property}.version"].text
+ end
+ ensure
+ file.close
+ FileUtils.rm_f(oss_pom_info[:file_path])
end
-
sha1_checker.cache_killbill_info(version, versions) if sha1_checker
end
versions
rescue StandardError => e
# Network down? Hopefully, we have something in the cache