aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/man.rb
diff options
context:
space:
mode:
authorXu Cheng2016-04-19 19:43:32 +0800
committerXu Cheng2016-04-19 22:44:38 +0800
commit0949a6955ab2a872fc1d0514cef0b59847c5cb48 (patch)
tree8bd11a670ee732ef181515e12df5c06c510dcf71 /Library/Homebrew/cmd/man.rb
parent799d3aec1575509550b122cd94b71ae45a5f5b8b (diff)
downloadbrew-0949a6955ab2a872fc1d0514cef0b59847c5cb48.tar.bz2
man: fix Ruby syntax warning
Library/Homebrew/cmd/man.rb:44: warning: assigned but unused variable - commands Closes #116. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd/man.rb')
-rw-r--r--Library/Homebrew/cmd/man.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb
index 164eca9b1..eb6679743 100644
--- a/Library/Homebrew/cmd/man.rb
+++ b/Library/Homebrew/cmd/man.rb
@@ -1,5 +1,6 @@
require "formula"
require "erb"
+require "ostruct"
module Homebrew
SOURCE_PATH = HOMEBREW_LIBRARY_PATH/"manpages"
@@ -40,8 +41,9 @@ module Homebrew
def build_man_page
template = (SOURCE_PATH/"brew.1.md.erb").read
+ variables = OpenStruct.new
- commands = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}").
+ variables[:commands] = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}").
sort_by { |source_file| source_file.basename.sub(/\.(rb|sh)$/, "") }.
map { |source_file|
source_file.read.lines.
@@ -51,7 +53,7 @@ module Homebrew
}.
reject { |s| s.strip.empty? }
- ERB.new(template, nil, ">").result(binding)
+ ERB.new(template, nil, ">").result(variables.instance_eval{ binding })
end
def convert_man_page(markup, target)