Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove homebrew-fork class Tty #8390

Merged
merged 1 commit into from
Dec 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions lib/cask/utils.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# coding: utf-8
# see Homebrew Library/Homebrew/utils.rb

require 'cask/utils/tty'
require 'yaml'
require 'open3'
require 'stringio'
Expand Down Expand Up @@ -32,13 +30,6 @@ def release
end
end

# monkeypatch Tty
class Tty
class << self
def magenta; color 35; end
end
end

# monkeypatch Hash
class Hash
def assert_valid_keys(*valid_keys)
Expand Down
38 changes: 38 additions & 0 deletions lib/cask/utils/tty.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# originally from Homebrew utils.rb

class Tty
class << self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def yellow; underline 33; end
def reset; escape 0; end
def em; underline 39; end
def green; bold 32; end
def gray; bold 30; end
def magenta; color 35; end

def width
`/usr/bin/tput cols`.strip.to_i
end

def truncate(str)
str.to_s[0, width - 4]
end

private

def color n
escape "0;#{n}"
end
def bold n
escape "1;#{n}"
end
def underline n
escape "4;#{n}"
end
def escape n
"\033[#{n}m" if $stdout.tty?
end
end
end
36 changes: 0 additions & 36 deletions lib/homebrew-fork/Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,6 @@
require 'utils/popen'
require 'open-uri'

class Tty
class << self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def yellow; underline 33; end
def reset; escape 0; end
def em; underline 39; end
def green; bold 32; end
def gray; bold 30; end

def width
`/usr/bin/tput cols`.strip.to_i
end

def truncate(str)
str.to_s[0, width - 4]
end

private

def color n
escape "0;#{n}"
end
def bold n
escape "1;#{n}"
end
def underline n
escape "4;#{n}"
end
def escape n
"\033[#{n}m" if $stdout.tty?
end
end
end

# :startdoc:

def ohai title, *sput
Expand Down