ruby-changes:12226
From: nobu <ko1@a...>
Date: Tue, 30 Jun 2009 16:53:38 +0900 (JST)
Subject: [ruby-changes:12226] Ruby:r23912 (trunk): * tool/file2lastrev.rb: get rid of global variables.
nobu 2009-06-30 16:53:22 +0900 (Tue, 30 Jun 2009) New Revision: 23912 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23912 Log: * tool/file2lastrev.rb: get rid of global variables. Modified files: trunk/ChangeLog trunk/tool/file2lastrev.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 23911) +++ ChangeLog (revision 23912) @@ -1,5 +1,7 @@ -Tue Jun 30 16:48:49 2009 Nobuyoshi Nakada <nobu@r...> +Tue Jun 30 16:53:17 2009 Nobuyoshi Nakada <nobu@r...> + * tool/file2lastrev.rb: get rid of global variables. + * tool/compile_prelude.rb: use US-ASCII name. Tue Jun 30 16:46:40 2009 Nobuyoshi Nakada <nobu@r...> Index: tool/file2lastrev.rb =================================================================== --- tool/file2lastrev.rb (revision 23911) +++ tool/file2lastrev.rb (revision 23912) @@ -48,25 +48,27 @@ return last, changed end -def raise_if_conflict - raise "you can specify only one of --changed, --revision.h and --doxygen" if $output +@output = nil +def self.output=(output) + if @output and @output != output + raise "you can specify only one of --changed, --revision.h and --doxygen" + end + @output = output end +@suppress_not_found = false parser = OptionParser.new {|opts| opts.on("--changed", "changed rev") do - raise_if_conflict - $output = :changed + self.output = :changed end opts.on("--revision.h") do - raise_if_conflict - $output = :revision_h + self.output = :revision_h end opts.on("--doxygen") do - raise_if_conflict - $output = :doxygen + self.output = :doxygen end opts.on("-q", "--suppress_not_found") do - $suppress_not_found = true + @suppress_not_found = true end } parser.parse! @@ -75,10 +77,10 @@ begin last, changed = get_revisions(ARGV.shift) rescue VCSNotFoundError - raise unless $suppress_not_found + raise unless @suppress_not_found end -case $output +case @output when :changed, nil puts changed when :revision_h @@ -86,5 +88,5 @@ when :doxygen puts "r#{changed}/r#{last}" else - raise "unknown output format `#{$output}'" + raise "unknown output format `#{@output}'" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/