win32console 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/Win32/Console.rb +10 -1
- data/lib/Win32/Console/ANSI.rb +15 -7
- data/tasks/gem.rake +7 -2
- metadata +51 -3
data/History.txt
CHANGED
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
|
data/lib/Win32/Console/ANSI.rb
CHANGED
@@ -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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
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
|
-
#
|
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.
|
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.
|
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
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-05-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rdoc
|
@@ -45,6 +45,54 @@ dependencies:
|
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.7.0
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: mocha
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.10.5
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.10.5
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rspec
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 2.9.0
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.9.0
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec-core
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 2.9.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.9.0
|
48
96
|
- !ruby/object:Gem::Dependency
|
49
97
|
name: hoe
|
50
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
177
|
version: '0'
|
130
178
|
requirements: []
|
131
179
|
rubyforge_project: winconsole
|
132
|
-
rubygems_version: 1.8.
|
180
|
+
rubygems_version: 1.8.24
|
133
181
|
signing_key:
|
134
182
|
specification_version: 3
|
135
183
|
summary: Win32::Console allows controling the windows command line terminal thru an
|