win32console 1.3.0-x86-mingw32 → 1.3.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/History.txt CHANGED
@@ -1,4 +1,9 @@
1
- === 1.3.0 / 2007-03-14
1
+ === 1.3.1 / 2012-04-15
2
+
3
+ * Enhancements:
4
+ * Maintain Fore and background colors [kbarber & vertigious]
5
+
6
+ === 1.3.0 / 2010-03-14
2
7
 
3
8
  * Enhancements
4
9
  * Works with Ruby 1.9
data/README.txt CHANGED
@@ -4,6 +4,15 @@
4
4
  * http://github.com/luislavena/win32console
5
5
  * http://rdoc.info/projects/luislavena/win32console
6
6
 
7
+ == DEPRECATION NOTICE
8
+
9
+ Win32::Console has been deprecated in favor of an external tool named ANSICON:
10
+
11
+ * https://github.com/adoxa/ansicon
12
+ * http://blog.mmediasys.com/2010/11/24/we-all-love-colors/
13
+
14
+ This project is left here for history purposes but no further development will be done.
15
+
7
16
  == DESCRIPTION
8
17
 
9
18
  Win32::Console allows controling the windows command line terminal
@@ -41,8 +50,22 @@ To output a simple bolded string, try this script:
41
50
 
42
51
  == INSTALL
43
52
 
53
+ To install from rubygems, simple run:
54
+
44
55
  gem install win32console
45
56
 
57
+ To install from source, make sure you have the Ruby development kit from
58
+ RubyInstaller on your Windows host, install the following gems:
59
+
60
+ * rake
61
+ * hoe
62
+ * rake-compiler
63
+
64
+ Then run the following:
65
+
66
+ rake gem
67
+ gem install pkg\win32console-1.3.0.gem
68
+
46
69
  == DEVELOPERS:
47
70
 
48
71
  After checking out the source, run:
Binary file
Binary file
data/lib/Win32/Console.rb CHANGED
@@ -29,6 +29,11 @@ module Win32
29
29
  @handle = API.CreateConsoleScreenBuffer( param1, param2,
30
30
  CONSOLE_TEXTMODE_BUFFER )
31
31
  end
32
+
33
+ # Preserve original attribute setting, so Cls can use it
34
+ if t == STD_OUTPUT_HANDLE or t == STD_ERROR_HANDLE
35
+ @attr_default = self.Attr
36
+ end
32
37
  end
33
38
 
34
39
  def Display
@@ -207,6 +212,24 @@ module Win32
207
212
  end
208
213
  end
209
214
 
215
+ def DefaultBold # Foreground Intensity
216
+ self.Attr[3] == 1
217
+ end
218
+
219
+ def DefaultUnderline # Background Intensity
220
+ self.Attr[7] == 1
221
+ end
222
+
223
+ def DefaultForeground
224
+ a = self.Attr
225
+ (0..2).map{|i| a[i] }.inject(0){|num, bit| (num << 1) + bit }
226
+ end
227
+
228
+ def DefaultBackground
229
+ a = self.Attr
230
+ (4..6).map{|i| a[i] }.inject(0){|num, bit| (num << 1) + bit }
231
+ end
232
+
210
233
  def Size(*t)
211
234
  if t.size == 0
212
235
  col, row = API.GetConsoleScreenBufferInfo(@handle )
@@ -251,7 +274,7 @@ module Win32
251
274
  end
252
275
 
253
276
  def Cls()
254
- attr = ATTR_NORMAL
277
+ attr = @attr_default || ATTR_NORMAL
255
278
  x, y = Size()
256
279
  left, top, right , bottom = Window()
257
280
  vx = right - left
@@ -87,10 +87,14 @@ module Win32
87
87
  super(fd, 'w')
88
88
  @Out = Win32::Console.new(handle)
89
89
  @x = @y = 0 # to save cursor position
90
- @foreground = 7
91
- @background = 0
92
- @bold =
93
- @underline =
90
+ @default_foreground = @Out.DefaultForeground
91
+ @default_background = @Out.DefaultBackground
92
+ @default_bold = @Out.DefaultBold
93
+ @default_underline = @Out.DefaultUnderline
94
+ @foreground = @default_foreground
95
+ @background = @default_background
96
+ @bold = @default_bold
97
+ @underline = @default_underline
94
98
  @revideo =
95
99
  @concealed = nil
96
100
  @conv = 1 # char conversion by default
@@ -159,10 +163,10 @@ module Win32
159
163
  atv = attr.to_i
160
164
  case atv
161
165
  when 0 # ESC[0m reset
162
- @foreground = 7
163
- @background = 0
164
- @bold =
165
- @underline =
166
+ @foreground = @default_foreground
167
+ @background = @default_background
168
+ @bold = @default_bold
169
+ @underline = @default_underline
166
170
  @revideo =
167
171
  @concealed = nil
168
172
  when 1
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.0'
4
+ self.version = '1.3.1'
5
5
 
6
6
  developer 'Gonzalo Garramuno', 'ggarra@advancedsl.com.ar'
7
7
  developer 'Justin Bailey', 'jgbailey@gmail.com'
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 1
10
+ version: 1.3.1
5
11
  platform: x86-mingw32
6
12
  authors:
7
13
  - Gonzalo Garramuno
@@ -11,49 +17,54 @@ autorequire:
11
17
  bindir: bin
12
18
  cert_chain: []
13
19
 
14
- date: 2010-03-14 00:00:00 -03:00
15
- default_executable:
20
+ date: 2012-04-23 00:00:00 Z
16
21
  dependencies:
17
22
  - !ruby/object:Gem::Dependency
18
- name: rubyforge
19
- type: :development
20
- version_requirement:
21
- version_requirements: !ruby/object:Gem::Requirement
23
+ name: rdoc
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
22
27
  requirements:
23
- - - ">="
28
+ - - ~>
24
29
  - !ruby/object:Gem::Version
25
- version: 2.0.3
26
- version:
27
- - !ruby/object:Gem::Dependency
28
- name: gemcutter
30
+ hash: 19
31
+ segments:
32
+ - 3
33
+ - 10
34
+ version: "3.10"
29
35
  type: :development
30
- version_requirement:
31
- version_requirements: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 0.3.0
36
- version:
36
+ version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rake-compiler
39
- type: :development
40
- version_requirement:
41
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ - 7
49
+ - 0
45
50
  version: 0.7.0
46
- version:
51
+ type: :development
52
+ version_requirements: *id002
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: hoe
49
- type: :development
50
- version_requirement:
51
- version_requirements: !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
- - - ">="
59
+ - - ~>
54
60
  - !ruby/object:Gem::Version
55
- version: 2.5.0
56
- version:
61
+ hash: 7
62
+ segments:
63
+ - 3
64
+ - 0
65
+ version: "3.0"
66
+ type: :development
67
+ version_requirements: *id003
57
68
  description: |-
58
69
  Win32::Console allows controling the windows command line terminal
59
70
  thru an OO-interface. This allows you to query the terminal (find
@@ -105,9 +116,9 @@ files:
105
116
  - test/test_title.rb
106
117
  - test/test_write.rb
107
118
  - test/test_std.rb
119
+ - .gemtest
108
120
  - lib/1.8/Console_ext.so
109
121
  - lib/1.9/Console_ext.so
110
- has_rdoc: true
111
122
  homepage: http://rubyforge.org/projects/winconsole
112
123
  licenses: []
113
124
 
@@ -119,32 +130,39 @@ rdoc_options:
119
130
  - ext
120
131
  require_paths:
121
132
  - lib
122
- - ext
123
133
  required_ruby_version: !ruby/object:Gem::Requirement
134
+ none: false
124
135
  requirements:
125
136
  - - ">="
126
137
  - !ruby/object:Gem::Version
138
+ hash: 59
139
+ segments:
140
+ - 1
141
+ - 8
142
+ - 6
127
143
  version: 1.8.6
128
- version:
129
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
130
146
  requirements:
131
147
  - - ">="
132
148
  - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
133
152
  version: "0"
134
- version:
135
153
  requirements: []
136
154
 
137
155
  rubyforge_project: winconsole
138
- rubygems_version: 1.3.5
156
+ rubygems_version: 1.8.23
139
157
  signing_key:
140
158
  specification_version: 3
141
159
  summary: Win32::Console allows controling the windows command line terminal thru an OO-interface
142
160
  test_files:
161
+ - test/test_cursor.rb
143
162
  - test/test_mouse.rb
144
- - test/test_std.rb
145
- - test/test_readoutput.rb
146
- - test/test_write.rb
147
163
  - test/test_readinput.rb
164
+ - test/test_readoutput.rb
148
165
  - test/test_sendevent.rb
166
+ - test/test_std.rb
149
167
  - test/test_title.rb
150
- - test/test_cursor.rb
168
+ - test/test_write.rb