提交 e6576e02 编写于 作者: C Chris Wanstrath

add man page to DATA portion of standalone script

上级 69d49872
......@@ -16,7 +16,8 @@ module Hub
premable
POSTAMBLE = "Hub::Runner.execute(*ARGV)"
POSTAMBLE = "Hub::Runner.execute(*ARGV)\n"
MANPAGE = "__END__\n#{File.read('man/hub.1')}"
def save(filename, path = '.')
target = File.join(File.expand_path(path), filename)
......@@ -43,6 +44,7 @@ premable
end
standalone << POSTAMBLE
standalone << MANPAGE
standalone
end
end
......
......@@ -25,11 +25,12 @@ class StandaloneTest < Test::Unit::TestCase
assert_includes "Commands", standalone
assert_includes ".execute(*ARGV)", standalone
assert_not_includes "module Standalone", standalone
assert_equal File.read('man/hub.1'), standalone.scan(/__END__\s*(.+)/m).to_s
end
def test_standalone_save
Hub::Standalone.save("hub")
assert_equal Hub::Standalone.build + "\n", File.read('./hub')
assert_equal Hub::Standalone.build, File.read('./hub')
end
def test_standalone_save_permission_denied
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册