[DRE-commits] [gem2deb] 04/04: Gem2Deb::Metadata: use debian/gemspec as gemspec if it exists
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Jul 9 15:48:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository gem2deb.
commit 64170a64479fc05c147e9596c11d3392e6e5a0ec
Author: Antonio Terceiro <terceiro at debian.org>
Date: Sun Jul 9 12:44:55 2017 -0300
Gem2Deb::Metadata: use debian/gemspec as gemspec if it exists
Closes: #867739
---
bin/dh_ruby | 11 +++++++++++
debian/changelog | 2 ++
lib/gem2deb/metadata.rb | 4 +++-
test/unit/metadata_test.rb | 14 ++++++++++++++
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/bin/dh_ruby b/bin/dh_ruby
index bdbc0da..b4b2a1c 100755
--- a/bin/dh_ruby
+++ b/bin/dh_ruby
@@ -409,6 +409,17 @@ during the build, in the I<clean>, I<build>, and I<install> steps, like this:
If you want the upstream Rakefile to be used, just make I<debian/dh_ruby.rake> a
symlink to I<../Rakefile>.
+=item debian/I<gemspec>
+
+If this file exists, it will be used as the package gemspec, regardless of
+I<metadata.yml> and any I<*.gemspec> that exists in the upstream source. Using
+this is only advised on single-binary source packages, and the behavior of this
+feature is undefined for multi-binary source packages (see B<SOURCE PACKAGE
+LAYOUT> above).
+
+Hint: for packages with multiple gemspec, you can have debian/I<gemspec> as a
+symlink pointing to the one you want to use.
+
=back
=head1 SEE ALSO
diff --git a/debian/changelog b/debian/changelog
index 29e14a5..7e40637 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
gem2deb (0.35) UNRELEASED; urgency=medium
* dh-make-ruby: bump debian/compat template to 10 (Closes: #867741)
+ * Gem2Deb::Metadata:
+ - use debian/gemspec as gemspec if it exists (Closes: #867739)
-- Antonio Terceiro <terceiro at debian.org> Sat, 01 Jul 2017 19:46:54 -0300
diff --git a/lib/gem2deb/metadata.rb b/lib/gem2deb/metadata.rb
index 46d1fec..1fd3282 100644
--- a/lib/gem2deb/metadata.rb
+++ b/lib/gem2deb/metadata.rb
@@ -102,7 +102,9 @@ module Gem2Deb
protected
def load_gemspec
- if File.exist?('metadata.yml')
+ if File.exist?('debian/gemspec')
+ @gemspec = Gem::Specification.load('debian/gemspec')
+ elsif File.exist?('metadata.yml')
@gemspec = YAML.load_file('metadata.yml')
elsif ENV['DH_RUBY_GEMSPEC']
@gemspec = Gem::Specification.load(ENV['DH_RUBY_GEMSPEC'])
diff --git a/test/unit/metadata_test.rb b/test/unit/metadata_test.rb
index 42140c2..2eb8010 100644
--- a/test/unit/metadata_test.rb
+++ b/test/unit/metadata_test.rb
@@ -205,6 +205,20 @@ class MetaDataTest < Gem2DebTestCase
end
+ context 'with debian/gemspec' do
+ should 'use it' do
+ gemspec = Gem::Specification.new do |spec|
+ spec.name = 'mypkg'
+ spec.version = '1.2.3'
+ end
+ FileUtils.mkdir_p('test/tmp/debian')
+ File.open('test/tmp/debian/gemspec', 'w') { |f| f.write(gemspec.to_ruby) }
+ metadata = Gem2Deb::Metadata.new('test/tmp')
+ assert_equal 'mypkg-1.2.3', [metadata.gemspec.name, metadata.gemspec.version].join('-')
+ end
+
+ end
+
context 'on multi-binary source packages' do
setup do
--
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