[jruby] 02/03: Catch gem load errors when rdoc tools are run through CLI

Miguel Landaeta nomadium at moszumanska.debian.org
Fri May 29 02:36:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

nomadium pushed a commit to branch experimental
in repository jruby.

commit b13c5cf8773b0d77dbdb8803dd7c00414f99bfea
Author: Miguel Landaeta <nomadium at debian.org>
Date:   Thu May 28 19:27:54 2015 -0300

    Catch gem load errors when rdoc tools are run through CLI
---
 debian/changelog                                   |  2 +-
 debian/jruby.links                                 |  2 +
 .../0006-Allow-rdoc-to-run-without-gems.patch      | 72 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 4 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 418cbaf..99d35d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -47,7 +47,7 @@ jruby (1.7.19-1) UNRELEASED; urgency=medium
     minified copy. This is to avoid lintian warnings, during build time
     a link symbolic to libjs-jquery is deployed.
 
- -- Miguel Landaeta <nomadium at debian.org>  Wed, 27 May 2015 18:04:12 -0300
+ -- Miguel Landaeta <nomadium at debian.org>  Thu, 28 May 2015 19:24:22 -0300
 
 jruby (1.5.6-10) unstable; urgency=medium
 
diff --git a/debian/jruby.links b/debian/jruby.links
index bc220aa..ea45c2e 100644
--- a/debian/jruby.links
+++ b/debian/jruby.links
@@ -7,6 +7,8 @@ usr/share/java/jruby-core.jar          usr/share/java/jruby.jar
 usr/share/java/jruby-core.jar          usr/share/jruby/lib/jruby.jar
 
 usr/share/javascript/jquery/jquery.js  usr/share/jruby/lib/ruby/2.0/rdoc/generator/template/darkfish/js/jquery.js
+usr/share/jruby/lib/ruby/2.0/rdoc.rb   usr/share/jruby/lib/ruby/shared/rdoc.rb
+usr/share/jruby/lib/ruby/2.0/rdoc      usr/share/jruby/lib/ruby/shared/rdoc
 
 usr/share/jruby/bin/ast                usr/bin/ast
 usr/share/jruby/bin/jgem               usr/bin/jgem
diff --git a/debian/patches/0006-Allow-rdoc-to-run-without-gems.patch b/debian/patches/0006-Allow-rdoc-to-run-without-gems.patch
new file mode 100644
index 0000000..8cdba32
--- /dev/null
+++ b/debian/patches/0006-Allow-rdoc-to-run-without-gems.patch
@@ -0,0 +1,72 @@
+From: Miguel Landaeta <nomadium at debian.org>
+Date: Thu, 28 May 2015 20:05:48 -0300
+Subject: Allow rdoc based tools to run if there are gem load errors
+Forwarded: no
+
+diff --git a/bin/rdoc b/bin/rdoc
+index bddda40..6b3ba2c 100755
+--- a/bin/rdoc
++++ b/bin/rdoc
+@@ -19,5 +19,39 @@ if ARGV.first
+   end
+ end
+ 
+-gem 'rdoc', version
+-load Gem.bin_path('rdoc', 'rdoc', version)
++begin
++  gem 'rdoc', version
++  load Gem.bin_path('rdoc', 'rdoc', version)
++rescue NameError => e # --disable-gems
++  raise unless e.name == :gem
++rescue Gem::LoadError
++end
++
++require 'rdoc/rdoc'
++
++begin
++  r = RDoc::RDoc.new
++  r.document ARGV
++rescue Errno::ENOSPC
++  $stderr.puts 'Ran out of space creating documentation'
++  $stderr.puts
++  $stderr.puts 'Please free up some space and try again'
++rescue SystemExit
++  raise
++rescue Exception => e
++  if $DEBUG_RDOC then
++    $stderr.puts e.message
++    $stderr.puts "#{e.backtrace.join "\n\t"}"
++    $stderr.puts
++  elsif Interrupt === e then
++    $stderr.puts
++    $stderr.puts 'Interrupted'
++  else
++    $stderr.puts "uh-oh! RDoc had a problem:"
++    $stderr.puts e.message
++    $stderr.puts
++    $stderr.puts "run with --debug for full backtrace"
++  end
++
++  exit 1
++end
+diff --git a/bin/ri b/bin/ri
+index 2c0b3d5..f74c830 100755
+--- a/bin/ri
++++ b/bin/ri
+@@ -19,5 +19,14 @@ if ARGV.first
+   end
+ end
+ 
+-gem 'rdoc', version
+-load Gem.bin_path('rdoc', 'ri', version)
++begin
++  gem 'rdoc', version
++  load Gem.bin_path('rdoc', 'ri', version)
++rescue NameError => e # --disable-gems
++  raise unless e.name == :gem
++rescue Gem::LoadError
++end
++
++require 'rdoc/ri/driver'
++
++RDoc::RI::Driver.run ARGV
diff --git a/debian/patches/series b/debian/patches/series
index 8a35ff7..6ad5744 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Fix-shebang-lines.patch
 0002-Fix-warning-jruby-script.patch
 0003-Add-usr-lib-ruby-vendor-ruby-to-load-path.patch
+0006-Allow-rdoc-to-run-without-gems.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby.git



More information about the pkg-java-commits mailing list