[DRE-commits] [gem2deb] 01/01: gem2deb: download .gem files in a temporary directory
Antonio Terceiro
terceiro at moszumanska.debian.org
Wed Jun 24 20:37:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository gem2deb.
commit 89a8ae8db8bbd8432e623ee68ce73a847fab6bb6
Author: Antonio Terceiro <terceiro at debian.org>
Date: Wed Jun 24 17:37:10 2015 -0300
gem2deb: download .gem files in a temporary directory
---
bin/gem2deb | 21 +++++++++++++++++++--
debian/changelog | 6 ++++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/bin/gem2deb b/bin/gem2deb
index e83644d..61109f5 100755
--- a/bin/gem2deb
+++ b/bin/gem2deb
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+require 'fileutils'
require 'gem2deb'
require 'gem2deb/gem2tgz'
require 'gem2deb/dh_make_ruby'
@@ -81,8 +82,24 @@ gemfile = ARGV[0]
# Download gem if not available locally
if not File::exists?(gemfile) and gemfile !~ /.gem$/
puts "#{gemfile} doesn't seem to exist. Let's try to download it with 'gem fetch #{ARGV[0]}'"
- run("gem", "fetch", gemfile)
- gemfile = Dir::glob("#{gemfile}-*.gem")[0]
+
+ tmpdir = Dir.mktmpdir
+ begin
+ Dir.chdir(tmpdir) do
+ run("gem", "fetch", gemfile)
+ gemfile = Dir.glob('*.gem').first
+ unless gemfile
+ # no .gem means that `gem fetch` failed (but still exited with 0)
+ raise RuntimeError.new("Failed to download .gem file")
+ end
+ end
+ FileUtils.mv(File.join(tmpdir, gemfile), '.')
+ rescue RuntimeError => ex
+ puts ex.message
+ exit(1)
+ ensure
+ FileUtils.rm_rf(tmpdir)
+ end
end
puts "-- Creating source tarball from #{gemfile} ..."
diff --git a/debian/changelog b/debian/changelog
index 44e1f24..7382105 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+gem2deb (0.18.4) UNRELEASED; urgency=medium
+
+ * gem2deb: download .gem files in a temporary directory
+
+ -- Antonio Terceiro <terceiro at debian.org> Wed, 24 Jun 2015 17:23:08 -0300
+
gem2deb (0.18.3) unstable; urgency=medium
* gem2deb-test-runner: add dependency on ruby-test-unit
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git
More information about the Pkg-ruby-extras-commits
mailing list