From owner-svn-ports-all@FreeBSD.ORG Fri Aug 22 13:28:16 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 289B3F88; Fri, 22 Aug 2014 13:28:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 080CB3041; Fri, 22 Aug 2014 13:28:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7MDSF70043270; Fri, 22 Aug 2014 13:28:15 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7MDSFVZ043268; Fri, 22 Aug 2014 13:28:15 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201408221328.s7MDSFVZ043268@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Fri, 22 Aug 2014 13:28:15 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r365651 - in head/devel/rubygem-clamp: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Aug 2014 13:28:16 -0000 Author: swills Date: Fri Aug 22 13:28:15 2014 New Revision: 365651 URL: http://svnweb.freebsd.org/changeset/ports/365651 QAT: https://qat.redports.org/buildarchive/r365651/ Log: devel/rubygem-clamp: patch for i18n, assign maintainer to submitter PR: 192635 Submitted by: Michael Moll Obtained from: https://github.com/mdub/clamp/pull/43 Added: head/devel/rubygem-clamp/files/ head/devel/rubygem-clamp/files/patch-i18n (contents, props changed) Modified: head/devel/rubygem-clamp/Makefile Modified: head/devel/rubygem-clamp/Makefile ============================================================================== --- head/devel/rubygem-clamp/Makefile Fri Aug 22 13:22:22 2014 (r365650) +++ head/devel/rubygem-clamp/Makefile Fri Aug 22 13:28:15 2014 (r365651) @@ -3,10 +3,11 @@ PORTNAME= clamp PORTVERSION= 0.6.3 +PORTREVISION= 1 CATEGORIES= devel ruby MASTER_SITES= RG -MAINTAINER= ruby@FreeBSD.org +MAINTAINER= kvedulv@kvedulv.de COMMENT= Command-line utility framework for Ruby LICENSE= MIT Added: head/devel/rubygem-clamp/files/patch-i18n ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/rubygem-clamp/files/patch-i18n Fri Aug 22 13:28:15 2014 (r365651) @@ -0,0 +1,191 @@ +diff --git a/clamp-0.6.3.gemspec b/clamp-0.6.3.gemspec +index 8f51cc3..acab485 100644 +--- clamp-0.6.3.gemspec ++++ clamp-0.6.3.gemspec +@@ -43,6 +43,7 @@ + - lib/clamp/command.rb + - lib/clamp/errors.rb + - lib/clamp/help.rb ++- lib/clamp/messages.rb + - lib/clamp/option/declaration.rb + - lib/clamp/option/definition.rb + - lib/clamp/option/parsing.rb + +diff --git a/lib/clamp/attribute/instance.rb b/lib/clamp/attribute/instance.rb +index 8f51cc3..acab485 100644 +--- lib/clamp/attribute/instance.rb ++++ lib/clamp/attribute/instance.rb +@@ -72,7 +72,7 @@ def default_from_environment + begin + take(value) + rescue ArgumentError => e +- command.send(:signal_usage_error, "$#{attribute.environment_variable}: #{e.message}") ++ command.send(:signal_usage_error, Clamp.message(:env_argument_error, :env => attribute.environment_variable, :message => e.message)) + end + end + +diff --git a/lib/clamp/command.rb b/lib/clamp/command.rb +index c6c50f4..52187ab 100644 +--- lib/clamp/command.rb ++++ lib/clamp/command.rb +@@ -1,3 +1,4 @@ ++require 'clamp/messages' + require 'clamp/errors' + require 'clamp/help' + require 'clamp/option/declaration' +@@ -91,7 +92,7 @@ def help + + def handle_remaining_arguments + unless remaining_arguments.empty? +- signal_usage_error "too many arguments" ++ signal_usage_error Clamp.message(:too_many_arguments) + end + end + +diff --git a/lib/clamp/help.rb b/lib/clamp/help.rb +index e09731a..1e57530 100644 +--- lib/clamp/help.rb ++++ lib/clamp/help.rb +@@ -61,7 +61,7 @@ def string + end + + def add_usage(invocation_path, usage_descriptions) +- puts "Usage:" ++ puts usage_heading + usage_descriptions.each do |usage| + puts " #{invocation_path} #{usage}".rstrip + end +@@ -87,6 +87,12 @@ def add_list(heading, items) + end + end + ++ protected ++ ++ def usage_heading ++ "Usage:" ++ end ++ + private + + def puts(*args) +diff --git a/lib/clamp/messages.rb b/lib/clamp/messages.rb +new file mode 100644 +index 0000000..61cce94 +--- /dev/null ++++ lib/clamp/messages.rb +@@ -0,0 +1,39 @@ ++module Clamp ++ ++ def self.messages=(messages) ++ @user_defined_messages = messages ++ end ++ ++ def self.message(key, options={}) ++ @user_defined_messages ||= {} ++ msg = @user_defined_messages[key] || messages[key] ++ format_string(msg, options) ++ end ++ ++ def self.messages ++ { ++ :too_many_arguments => "too many arguments", ++ :option_required => "option '%