From 6195125b3afbbd103ac16fa72320a2345a765c60 Mon Sep 17 00:00:00 2001 From: makoto kuwata Date: Wed, 11 Jul 2007 20:01:24 +0000 Subject: - [bugfix] main.rb: help message was not displayed - [bugfix] main.rb: Object#hash() was returned instead of context in load_datafile() --- ChangeLog.txt | 6 +++++- lib/erubis/main.rb | 7 +++---- test/test-main.rb | 13 +++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ab7c571..a6f8fda 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,8 +2,12 @@ .?lastupdate: $Date$ .?version: $Rev$ +: Rev.87 (2007-07-12) + .- [bugfix] main.rb: help message was not displayed + .- [bugfix] main.rb: Object#hash() was returned instead of context in load_datafile() + : Rev.86 (2007-05-26) - .- [bugfix] preprocessor bug is rails_helper.rb + .- [bugfix] preprocessor bug is found in rails_helper.rb : Rev.85 (2007-05-26) .- [enhance] preprocessor support in rails_helper.rb diff --git a/lib/erubis/main.rb b/lib/erubis/main.rb index 2335d36..44b5a05 100644 --- a/lib/erubis/main.rb +++ b/lib/erubis/main.rb @@ -215,8 +215,8 @@ module Erubis return source end - def usage - command = File.basename($0) + def usage(command=nil) + command ||= File.basename($0) buf = [] buf << "erubis - embedded program converter for multi-language" buf << "Usage: #{command} [..options..] [file ...]" @@ -247,10 +247,9 @@ module Erubis # -c class : class name (XmlEruby/PercentLineEruby/...) (default Eruby) # -r library : require library # -a : action (convert/execute) - return join("\n") + return buf.join("\n") end - def collect_supported_properties(erubis_klass) list = [] erubis_klass.ancestors.each do |klass| diff --git a/test/test-main.rb b/test/test-main.rb index 86e1f5b..3270b62 100644 --- a/test/test-main.rb +++ b/test/test-main.rb @@ -24,6 +24,12 @@ class StringWriter < String end end +class Erubis::Main + public :usage + public :show_properties + public :show_enhancers +end + class MainTest < Test::Unit::TestCase @@ -162,6 +168,13 @@ END assert_text_equal(@expected, output) end + def test_help # -h + @options = '-h' + m = Erubis::Main.new + @expected = m.usage() + "\n" + m.show_properties() + m.show_enhancers() + @filename = false + _test() + end def test_version # -v @options = '-v' -- cgit v1.2.1