summaryrefslogtreecommitdiff
path: root/lang/ruby
diff options
context:
space:
mode:
authortaca <taca@pkgsrc.org>2011-11-07 11:56:25 +0000
committertaca <taca@pkgsrc.org>2011-11-07 11:56:25 +0000
commit1e1d94d125e5b9407b658326ee9531de8b007b50 (patch)
treeca875b3638571b99d24b4532df2875d447cf9056 /lang/ruby
parent7cc7f4fe59c58f918f65ea8db27ad82349f82cae (diff)
downloadpkgsrc-1e1d94d125e5b9407b658326ee9531de8b007b50.tar.gz
Don't require 'yaml' unconditionaly but try to call Gem.load_yaml.
Avoid possible problem of ruby192-base with ruby-psych installed.
Diffstat (limited to 'lang/ruby')
-rw-r--r--lang/ruby/files/update-gemspec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lang/ruby/files/update-gemspec.rb b/lang/ruby/files/update-gemspec.rb
index 77256a9ee85..5bfa8cd4553 100644
--- a/lang/ruby/files/update-gemspec.rb
+++ b/lang/ruby/files/update-gemspec.rb
@@ -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'