[DRE-commits] [gem2deb] 01/02: basic tests for GemInstaller
Antonio Terceiro
terceiro at moszumanska.debian.org
Fri Nov 20 21:31:47 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 5a1b7d040393ad0ea83c3e31c07eccf0b3a85cc1
Author: Antonio Terceiro <terceiro at debian.org>
Date: Fri Nov 20 19:22:39 2015 -0200
basic tests for GemInstaller
---
lib/gem2deb/gem_installer.rb | 1 +
test/sample/install_as_gem/bin/install_as_gem | 3 +++
test/sample/install_as_gem/debian/changelog | 5 +++++
test/sample/install_as_gem/debian/compat | 1 +
test/sample/install_as_gem/debian/control | 22 ++++++++++++++++++++
test/sample/install_as_gem/debian/rules | 7 +++++++
test/sample/install_as_gem/debian/source/format | 1 +
test/sample/install_as_gem/install_as_gem.gemspec | 16 +++++++++++++++
test/sample/install_as_gem/lib/install_as_gem.rb | 2 ++
test/test_helper.rb | 8 ++++++++
test/unit/gem_installer_test.rb | 25 +++++++++++++++++++++++
11 files changed, 91 insertions(+)
diff --git a/lib/gem2deb/gem_installer.rb b/lib/gem2deb/gem_installer.rb
index b72cc30..85d63e5 100644
--- a/lib/gem2deb/gem_installer.rb
+++ b/lib/gem2deb/gem_installer.rb
@@ -13,6 +13,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 'gem2deb'
require 'gem2deb/installer'
require 'tmpdir'
diff --git a/test/sample/install_as_gem/bin/install_as_gem b/test/sample/install_as_gem/bin/install_as_gem
new file mode 100755
index 0000000..a00057d
--- /dev/null
+++ b/test/sample/install_as_gem/bin/install_as_gem
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+puts 'Hello, world!'
diff --git a/test/sample/install_as_gem/debian/changelog b/test/sample/install_as_gem/debian/changelog
new file mode 100644
index 0000000..8e5ea31
--- /dev/null
+++ b/test/sample/install_as_gem/debian/changelog
@@ -0,0 +1,5 @@
+ruby-install-as-gem (0.0.1-1) UNRELEASED; urgency=medium
+
+ * Initial release (Closes: #nnnn)
+
+ -- Antonio Terceiro <terceiro at debian.org> Fri, 20 Nov 2015 18:46:52 -0200
diff --git a/test/sample/install_as_gem/debian/compat b/test/sample/install_as_gem/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/test/sample/install_as_gem/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/test/sample/install_as_gem/debian/control b/test/sample/install_as_gem/debian/control
new file mode 100644
index 0000000..8d7d660
--- /dev/null
+++ b/test/sample/install_as_gem/debian/control
@@ -0,0 +1,22 @@
+Source: ruby-install-as-gem
+Section: ruby
+Priority: optional
+Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
+Uploaders: Antonio Terceiro <terceiro at debian.org>
+Build-Depends: debhelper (>= 9~),
+ gem2deb
+Standards-Version: 3.9.6
+Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-install-as-gem.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-install-as-gem.git
+Homepage:
+Testsuite: autopkgtest-pkg-ruby
+XS-Ruby-Versions: all
+
+Package: ruby-install-as-gem
+Architecture: all
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ruby | ruby-interpreter,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: Simple gem to test the gem2deb gem installer
+ Simple gem to test the gem2deb gem installer
diff --git a/test/sample/install_as_gem/debian/rules b/test/sample/install_as_gem/debian/rules
new file mode 100755
index 0000000..4e91465
--- /dev/null
+++ b/test/sample/install_as_gem/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+export GEM2DEB_TEST_RUNNER = --check-dependencies
+export DH_RUBY = --gem-install
+
+%:
+ dh $@ --buildsystem=ruby --with ruby
diff --git a/test/sample/install_as_gem/debian/source/format b/test/sample/install_as_gem/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/test/sample/install_as_gem/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/test/sample/install_as_gem/install_as_gem.gemspec b/test/sample/install_as_gem/install_as_gem.gemspec
new file mode 100644
index 0000000..6fa651d
--- /dev/null
+++ b/test/sample/install_as_gem/install_as_gem.gemspec
@@ -0,0 +1,16 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+
+Gem::Specification.new do |s|
+ s.name = "install_as_gem"
+ s.version = '0.0.1'
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Antonio Terceiro"]
+ s.email = ["terceiro at debian.org"]
+ s.homepage = ""
+ s.summary = %q{Simple gem to test the gem2deb gem installer}
+ s.description = %q{Simple gem to test the gem2deb gem installer}
+
+ s.files = Dir['**/*']
+ s.executables = Dir['bin/*'].map { |f| File.basename(f) }
+end
diff --git a/test/sample/install_as_gem/lib/install_as_gem.rb b/test/sample/install_as_gem/lib/install_as_gem.rb
new file mode 100644
index 0000000..072cba5
--- /dev/null
+++ b/test/sample/install_as_gem/lib/install_as_gem.rb
@@ -0,0 +1,2 @@
+module InstallAsGem
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index c1e8ade..118a1ec 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -140,6 +140,14 @@ class Gem2DebTestCase
end
end
+ def self.silently
+ silence_stream STDOUT do
+ silence_stream STDERR do
+ yield
+ end
+ end
+ end
+
# Runs a command with the current (in-development) gem2deb environment
# loaded. PATH, PERL5LIB and RUBYLIB environment variables are tweaked to
# make sure that everything that comes from gem2deb has precedence over
diff --git a/test/unit/gem_installer_test.rb b/test/unit/gem_installer_test.rb
new file mode 100644
index 0000000..8969ea0
--- /dev/null
+++ b/test/unit/gem_installer_test.rb
@@ -0,0 +1,25 @@
+require_relative '../test_helper'
+require 'gem2deb/gem_installer'
+
+class GemInstallerTest < Gem2DebTestCase
+
+ PKGDIR = 'test/sample/install_as_gem'
+ INSTALLDIR = File.join(tmpdir, 'debian/ruby-install-as-gem')
+
+ one_time_setup do
+ gem_installer = Gem2Deb::GemInstaller.new('ruby-install-as-gem', PKGDIR)
+ gem_installer.destdir_base = INSTALLDIR
+ silently { gem_installer.install_files_and_build_extensions }
+ end
+
+ should 'install files to rubygems-integration directory' do
+ assert_file_exists INSTALLDIR + '/usr/share/rubygems-integration/all/gems/install_as_gem-0.0.1/lib/install_as_gem.rb'
+ end
+
+ should 'install binaries to /usr/bin' do
+ assert_file_exists INSTALLDIR + '/usr/bin/install_as_gem'
+ end
+
+ should 'not install debian/ directory'
+
+end
--
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