pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/ruby/files Don't require 'yaml' unconditionaly bu...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/15ee7d1c39d1
branches:  trunk
changeset: 594804:15ee7d1c39d1
user:      taca <taca%pkgsrc.org@localhost>
date:      Mon Nov 07 11:56:25 2011 +0000

description:
Don't require 'yaml' unconditionaly but try to call Gem.load_yaml.
Avoid possible problem of ruby192-base with ruby-psych installed.

diffstat:

 lang/ruby/files/update-gemspec.rb |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r af6d3acf9e64 -r 15ee7d1c39d1 lang/ruby/files/update-gemspec.rb
--- a/lang/ruby/files/update-gemspec.rb Mon Nov 07 11:28:39 2011 +0000
+++ b/lang/ruby/files/update-gemspec.rb Mon Nov 07 11:56:25 2011 +0000
@@ -1,7 +1,7 @@
 #!/usr/pkg/bin/ruby
 # -*- coding: utf-8 -*-
 #
-# $NetBSD: update-gemspec.rb,v 1.2 2011/09/13 03:18:29 taca Exp $
+# $NetBSD: update-gemspec.rb,v 1.3 2011/11/07 11:56:25 taca Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,10 +36,16 @@
 # This is a quick and dirty tool which updates gemspec file:
 #
 require 'rubygems'
-require 'yaml'
 require 'fileutils'
 require 'optparse'
 
+begin
+  # Since newer rubygems load psych instead of syck, don't load yaml directly.
+  Gem.load_yaml
+rescue NoMethodError
+  # Older rubygems don't have load_yaml() and don't know about psych.
+end
+
 class GemSpecUpdater
   OrigSuffix = '.orig_gemspec'
 



Home | Main Index | Thread Index | Old Index