leftright 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Jordi Bunster <jordi@bunster.org>
1
+ Copyright (c) 2009, 2010 Jordi Bunster <jordi@bunster.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -15,18 +15,8 @@ using the Ruby 1.9 + Rails 3 combo day to day.
15
15
 
16
16
  == Installation instructions
17
17
 
18
- From Rubyforge's gem server (might not be there):
19
-
20
18
  gem install leftright
21
19
 
22
- From Gemcutter:
23
-
24
- gem install leftright --source http://gemcutter.org
25
-
26
- Both are the same, and are loaded the same way:
27
-
28
- require 'leftright'
29
-
30
20
  If you're on JRuby, you'll need to install ffi-ncurses to format properly:
31
21
 
32
22
  jruby -S gem install ffi-ncurses
@@ -46,4 +36,4 @@ your own tests, specially if they fail. :)
46
36
 
47
37
  == Legal
48
38
 
49
- Copyright (c) 2009 Jordi Bunster, released under the MIT license
39
+ Copyright (c) 2009, 2010 Jordi Bunster, released under the MIT license
data/WHATSNEW CHANGED
@@ -1,4 +1,7 @@
1
- * 0.0.?
1
+ * 0.0.5 (2010-07-31):
2
+ - Fixed a ginormous bug when running under non-REE CRUBY. Yipes.
3
+
4
+ * 0.0.4 (2010-07-31):
2
5
  - Ignoring certain testcases (like ActionController::IntegrationTest) when
3
6
  calculating the left margin. Does not break if Rails is not present.
4
7
  - Added support for JRuby (using ffi-ncurses instead of stty (Zach Holman))
@@ -81,7 +81,7 @@ module LeftRight
81
81
  # Tries to get the terminal width in columns.
82
82
  #
83
83
  def self.terminal_width
84
- @terminal_width ||= if RUBY_ENGINE.match 'jruby'
84
+ @terminal_width ||= if defined?(RUBY_ENGINE) && RUBY_ENGINE.match('jruby')
85
85
  ncurses_terminal_width
86
86
  else
87
87
  stty_terminal_width
@@ -4,25 +4,33 @@
4
4
 
5
5
  module LeftRight
6
6
  module C
7
- if ::LeftRight::tty?
8
- def self.color(args)
9
- name, code = args.keys.first, args.values.first
7
+ def self.color(string = nil, code = nil)
8
+ return string unless ::LeftRight::tty?
9
+ string.nil? ? "\e[#{code}m" : "\e[#{code}m" + string + "\e[0m"
10
+ end
11
+
12
+ def self.reset(string = nil)
13
+ color string, 0
14
+ end
15
+
16
+ def self.bold(string = nil)
17
+ color string, 1
18
+ end
10
19
 
11
- eval %' def self.#{name}(string = nil)
12
- string.nil? ? "\e[#{code}m" : "\e[#{code}m" + string + "\e[0m"
13
- end ', binding, __FILE__, __LINE__
14
- end
20
+ def self.red(string = nil)
21
+ color string, 31
22
+ end
23
+
24
+ def self.green(string = nil)
25
+ color string, 32
26
+ end
27
+
28
+ def self.yellow(string = nil)
29
+ color string, 33
30
+ end
15
31
 
16
- color :red => 31
17
- color :green => 32
18
- color :yellow => 33
19
- color :cyan => 36
20
- color :reset => 0
21
- color :bold => 1
22
- else
23
- def self.method_missing(color, *args)
24
- args.first.nil? ? '' : args.first
25
- end
32
+ def self.cyan(string = nil)
33
+ color string, 36
26
34
  end
27
35
  end
28
36
  end
@@ -1,3 +1,3 @@
1
1
  module LeftRight
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leftright
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
4
+ version: 0.0.5
11
5
  platform: ruby
12
6
  authors:
13
7
  - Jordi Bunster
@@ -49,27 +43,21 @@ rdoc_options: []
49
43
  require_paths:
50
44
  - lib
51
45
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
46
  requirements:
54
47
  - - ">="
55
48
  - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
49
  version: "0"
50
+ version:
60
51
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
52
  requirements:
63
53
  - - ">="
64
54
  - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
67
- - 0
68
55
  version: "0"
56
+ version:
69
57
  requirements: []
70
58
 
71
59
  rubyforge_project:
72
- rubygems_version: 1.3.7
60
+ rubygems_version: 1.3.5
73
61
  signing_key:
74
62
  specification_version: 3
75
63
  summary: Cool replacement for Test::Unit's TestRunner