win32console 1.3.1-x86-mswin32-60 → 1.3.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.3.2 / 2012-05-11
2
+
3
+ * Bugfixes:
4
+ * Fix background color issue associated with redirected outputs. Closes GH-14
5
+ [kbarber]
6
+
1
7
  === 1.3.1 / 2012-04-15
2
8
 
3
9
  * Enhancements:
Binary file
Binary file
data/lib/Win32/Console.rb CHANGED
@@ -31,7 +31,7 @@ module Win32
31
31
  end
32
32
 
33
33
  # Preserve original attribute setting, so Cls can use it
34
- if t == STD_OUTPUT_HANDLE or t == STD_ERROR_HANDLE
34
+ if (t == STD_OUTPUT_HANDLE or t == STD_ERROR_HANDLE) and not redirected?
35
35
  @attr_default = self.Attr
36
36
  end
37
37
  end
@@ -285,6 +285,15 @@ module Win32
285
285
  Window(1,0,0,vx,vy)
286
286
  end
287
287
 
288
+ # Return true if console is redirected or piped and no longer is outputing
289
+ # to the normal console.
290
+ #
291
+ # This can be used to determine if normal console operations will be
292
+ # available.
293
+ def redirected?
294
+ self.Mode > 31
295
+ end
296
+
288
297
  def Console.Free()
289
298
  API.FreeConsole()
290
299
  end
@@ -87,10 +87,15 @@ module Win32
87
87
  super(fd, 'w')
88
88
  @Out = Win32::Console.new(handle)
89
89
  @x = @y = 0 # to save cursor position
90
- @default_foreground = @Out.DefaultForeground
91
- @default_background = @Out.DefaultBackground
92
- @default_bold = @Out.DefaultBold
93
- @default_underline = @Out.DefaultUnderline
90
+
91
+ # None of these calls will work, when we are redirected
92
+ unless redirected?
93
+ @default_foreground = @Out.DefaultForeground
94
+ @default_background = @Out.DefaultBackground
95
+ @default_bold = @Out.DefaultBold
96
+ @default_underline = @Out.DefaultUnderline
97
+ end
98
+
94
99
  @foreground = @default_foreground
95
100
  @background = @default_background
96
101
  @bold = @default_bold
@@ -109,7 +114,7 @@ module Win32
109
114
  if @buffer.empty?
110
115
  # match \e
111
116
  unless int == 27
112
- write(int.chr)
117
+ write(int.chr)
113
118
  else
114
119
  @buffer << int
115
120
  end
@@ -142,9 +147,12 @@ module Win32
142
147
  end
143
148
  end
144
149
 
145
- # returns true if outputs is being redirected.
150
+ # Returns true if output is being redirected to something other then a
151
+ # terminal.
152
+ #
153
+ # For now just checks the status of Win32::Console#redirected?
146
154
  def redirected?
147
- @Out.Mode > 31
155
+ @Out.redirected?
148
156
  end
149
157
 
150
158
  private
data/tasks/gem.rake CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'hoe'
2
2
 
3
3
  HOE = Hoe.spec 'win32console' do
4
- self.version = '1.3.1'
4
+ self.version = '1.3.2'
5
5
 
6
6
  developer 'Gonzalo Garramuno', 'ggarra@advancedsl.com.ar'
7
7
  developer 'Justin Bailey', 'jgbailey@gmail.com'
@@ -19,7 +19,12 @@ HOE = Hoe.spec 'win32console' do
19
19
  rdoc_options << "--exclude" << "ext"
20
20
  end
21
21
 
22
- extra_dev_deps << ['rake-compiler', "~> 0.7.0"]
22
+ extra_dev_deps.push(
23
+ ['rake-compiler', "~> 0.7.0"],
24
+ ['mocha', '>= 0.10.5'],
25
+ ['rspec', '>= 2.9.0'],
26
+ ['rspec-core', '>= 2.9.0']
27
+ )
23
28
  end
24
29
 
25
30
  file "#{HOE.spec.name}.gemspec" => ['Rakefile', 'tasks/gem.rake'] do |t|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32console
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 1
10
- version: 1.3.1
9
+ - 2
10
+ version: 1.3.2
11
11
  platform: x86-mswin32-60
12
12
  authors:
13
13
  - Gonzalo Garramuno
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-23 00:00:00 Z
20
+ date: 2012-05-14 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rdoc
@@ -51,9 +51,57 @@ dependencies:
51
51
  type: :development
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: hoe
54
+ name: mocha
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 61
62
+ segments:
63
+ - 0
64
+ - 10
65
+ - 5
66
+ version: 0.10.5
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 43
78
+ segments:
79
+ - 2
80
+ - 9
81
+ - 0
82
+ version: 2.9.0
83
+ type: :development
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: rspec-core
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 43
94
+ segments:
95
+ - 2
96
+ - 9
97
+ - 0
98
+ version: 2.9.0
99
+ type: :development
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: hoe
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
57
105
  none: false
58
106
  requirements:
59
107
  - - ~>
@@ -64,7 +112,7 @@ dependencies:
64
112
  - 0
65
113
  version: "3.0"
66
114
  type: :development
67
- version_requirements: *id003
115
+ version_requirements: *id006
68
116
  description: |-
69
117
  Win32::Console allows controling the windows command line terminal
70
118
  thru an OO-interface. This allows you to query the terminal (find
@@ -153,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
201
  requirements: []
154
202
 
155
203
  rubyforge_project: winconsole
156
- rubygems_version: 1.8.23
204
+ rubygems_version: 1.8.24
157
205
  signing_key:
158
206
  specification_version: 3
159
207
  summary: Win32::Console allows controling the windows command line terminal thru an OO-interface