diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000000000000000000000000000000000..fab1350bff6754d263849b3b5c02ce1892289c07 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,12 @@ +GEM + remote: http://rubygems.org/ + specs: + rake (10.3.2) + test-unit (2.4.3) + +PLATFORMS + ruby + +DEPENDENCIES + rake + test-unit (= 2.4.3) diff --git a/auto/colour_prompt.rb b/auto/colour_prompt.rb index 81003dd59d64a8cac094833db96ea17703d272ae..d7e39b54605e25ec5654d3eec025c59fa4468c9d 100644 --- a/auto/colour_prompt.rb +++ b/auto/colour_prompt.rb @@ -2,7 +2,7 @@ # Unity Project - A Test Framework for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] -# ========================================== +# ========================================== if RUBY_PLATFORM =~/(win|w)32$/ begin @@ -21,14 +21,14 @@ end class ColourCommandLine def initialize - if RUBY_PLATFORM =~/(win|w)32$/ + if RUBY_PLATFORM =~/(win|w)32$/ get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') @set_console_txt_attrb = Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') @hout = get_std_handle.call(-11) end end - + def change_to(new_colour) if RUBY_PLATFORM =~/(win|w)32$/ @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) @@ -36,10 +36,10 @@ class ColourCommandLine "\033[30;#{posix_colour(new_colour)};22m" end end - + def win32_colour(colour) case colour - when :black then 0 + when :black then 0 when :dark_blue then 1 when :dark_green then 2 when :dark_cyan then 3 @@ -59,22 +59,43 @@ class ColourCommandLine 0 end end - + def posix_colour(colour) + # ANSI Escape Codes - Foreground colors + # | Code | Color | + # | 39 | Default foreground color | + # | 30 | Black | + # | 31 | Red | + # | 32 | Green | + # | 33 | Yellow | + # | 34 | Blue | + # | 35 | Magenta | + # | 36 | Cyan | + # | 37 | Light gray | + # | 90 | Dark gray | + # | 91 | Light red | + # | 92 | Light green | + # | 93 | Light yellow | + # | 94 | Light blue | + # | 95 | Light magenta | + # | 96 | Light cyan | + # | 97 | White | + case colour - when :black then 30 + when :black then 30 when :red, :failure then 31 when :green, :success then 32 when :yellow then 33 when :blue, :narrative then 34 when :purple, :magenta then 35 when :cyan, :output then 36 - when :white, :default_white, :default then 37 + when :white, :default_white then 37 + when :default then 39 else - 30 + 39 end end - + def out_c(mode, colour, str) case RUBY_PLATFORM when /(win|w)32$/ @@ -85,7 +106,7 @@ class ColourCommandLine else $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print - end + end end end # ColourCommandLine