From 0949a6955ab2a872fc1d0514cef0b59847c5cb48 Mon Sep 17 00:00:00 2001
From: Xu Cheng <xucheng@me.com>
Date: Tue, 19 Apr 2016 19:43:32 +0800
Subject: [PATCH] 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>
---
 Library/Homebrew/cmd/man.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb
index 164eca9b12..eb6679743a 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)
-- 
GitLab