Skip to content

Commit

Permalink
add man page to DATA portion of standalone script
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Dec 9, 2009
1 parent 69d4987 commit e6576e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/hub/standalone.rb
Expand Up @@ -16,7 +16,8 @@ module Standalone
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)
Expand All @@ -43,6 +44,7 @@ def build
end

standalone << POSTAMBLE
standalone << MANPAGE
standalone
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/standalone_test.rb
Expand Up @@ -25,11 +25,12 @@ def test_standalone
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
Expand Down

0 comments on commit e6576e0

Please sign in to comment.