Permalink
Browse files

Move #whisper to the new monkey_patch.rb. Let's make these explicit

  • Loading branch information...
1 parent e79b6e4 commit 34791168ca313f9870218a22a085df1617ab7cd2 @webmat webmat committed Dec 16, 2008
Showing with 15 additions and 8 deletions.
  1. +1 −1 bin/grb
  2. +2 −7 lib/git_remote_branch.rb
  3. +12 −0 lib/monkey_patches.rb
View
@@ -27,7 +27,7 @@ rescue InvalidBranchError => ex
crap_out ex.message
end
-$SILENT = p[:silent]
+$WHISPER = p[:silent]
whisper get_welcome
View
@@ -20,6 +20,7 @@ def red; self; end
require 'capture_fu'
$LOAD_PATH.unshift( grb_app_root + '/lib' )
+require 'monkey_patches'
require 'constants'
require 'string_ext'
require 'state'
@@ -150,7 +151,7 @@ def explain_action(action, branch_name, origin, current_branch)
end
def execute_cmds(*cmds)
- silencer = $SILENT ? ' 2>&1' : ''
+ silencer = $WHISPER ? ' 2>&1' : ''
cmds.flatten.each do |c|
puts_cmd c
`#{c}#{silencer}`
@@ -163,10 +164,4 @@ def puts_cmd(*cmds)
whisper "#{c}".red
end
end
-
- def whisper(*msgs)
- unless $SILENT
- msgs.flatten ? msgs.flatten.each{|m| puts m} : puts
- end
- end
end
View
@@ -0,0 +1,12 @@
+# One nice thing about command-line tools is that nobody cares how
+# much you monkey-patch :-)
+
+module Kernel
+ def whisper(*msgs)
+ unless $WHISPER
+ # msgs.flatten ? msgs.flatten.each{|m| puts m} : puts
+ puts *msgs
+ end
+ end
+end
+

0 comments on commit 3479116

Please sign in to comment.