win32console 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -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:
@@ -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
@@ -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,87 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: win32console
3
- version: !ruby/object:Gem::Version
4
- version: 1.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.1
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Gonzalo Garramuno
8
9
  - Justin Bailey
9
10
  - Luis Lavena
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
-
14
- date: 2010-03-14 00:00:00 -03:00
15
- default_executable:
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
18
- name: rubyforge
19
- type: :development
20
- version_requirement:
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: 2.0.3
26
- version:
27
- - !ruby/object:Gem::Dependency
28
- name: gemcutter
14
+ date: 2012-04-15 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rdoc
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '3.10'
29
24
  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:
37
- - !ruby/object:Gem::Dependency
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '3.10'
32
+ - !ruby/object:Gem::Dependency
38
33
  name: rake-compiler
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 0.7.0
39
40
  type: :development
40
- version_requirement:
41
- version_requirements: !ruby/object:Gem::Requirement
42
- requirements:
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
43
45
  - - ~>
44
- - !ruby/object:Gem::Version
46
+ - !ruby/object:Gem::Version
45
47
  version: 0.7.0
46
- version:
47
- - !ruby/object:Gem::Dependency
48
+ - !ruby/object:Gem::Dependency
48
49
  name: hoe
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
49
56
  type: :development
50
- version_requirement:
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 2.5.0
56
- version:
57
- description: |-
58
- Win32::Console allows controling the windows command line terminal
59
- thru an OO-interface. This allows you to query the terminal (find
60
- its size, characters, attributes, etc). The interface and functionality
61
- should be identical to Perl's counterpart.
62
-
63
- A port of Perl's Win32::Console and Win32::Console::ANSI modules.
64
-
65
- This gem packages Gonzalo Garramuno's Win32::Console project, and includes
66
- a compiled binary for speed. The Win32::Console project's home can be
67
- found at:
68
-
69
- http://rubyforge.org/projects/win32console
70
- email:
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: '3.0'
64
+ description: ! "Win32::Console allows controling the windows command line terminal\nthru
65
+ an OO-interface. This allows you to query the terminal (find\nits size, characters,
66
+ attributes, etc). The interface and functionality\nshould be identical to Perl's
67
+ counterpart.\n\nA port of Perl's Win32::Console and Win32::Console::ANSI modules.\n\nThis
68
+ gem packages Gonzalo Garramuno's Win32::Console project, and includes\na compiled
69
+ binary for speed. The Win32::Console project's home can be\nfound at:\n\n http://rubyforge.org/projects/win32console"
70
+ email:
71
71
  - ggarra@advancedsl.com.ar
72
72
  - jgbailey@gmail.com
73
73
  - luislavena@gmail.com
74
74
  executables: []
75
-
76
- extensions:
75
+ extensions:
77
76
  - ext/Console_ext/extconf.rb
78
- extra_rdoc_files:
77
+ extra_rdoc_files:
79
78
  - History.txt
80
79
  - Manifest.txt
81
80
  - README.txt
82
81
  - extra/Console.rdoc
83
82
  - extra/Console_ANSI.rdoc
84
- files:
83
+ files:
85
84
  - History.txt
86
85
  - Manifest.txt
87
86
  - Rakefile
@@ -104,44 +103,43 @@ files:
104
103
  - test/test_sendevent.rb
105
104
  - test/test_title.rb
106
105
  - test/test_write.rb
107
- has_rdoc: true
106
+ - test/test_std.rb
107
+ - .gemtest
108
108
  homepage: http://rubyforge.org/projects/winconsole
109
109
  licenses: []
110
-
111
110
  post_install_message:
112
- rdoc_options:
111
+ rdoc_options:
113
112
  - --main
114
113
  - README.txt
115
114
  - --exclude
116
115
  - ext
117
- require_paths:
116
+ require_paths:
118
117
  - lib
119
- - ext
120
- required_ruby_version: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
124
123
  version: 1.8.6
125
- version:
126
- required_rubygems_version: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: "0"
131
- version:
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
132
130
  requirements: []
133
-
134
131
  rubyforge_project: winconsole
135
- rubygems_version: 1.3.5
132
+ rubygems_version: 1.8.22
136
133
  signing_key:
137
134
  specification_version: 3
138
- summary: Win32::Console allows controling the windows command line terminal thru an OO-interface
139
- test_files:
135
+ summary: Win32::Console allows controling the windows command line terminal thru an
136
+ OO-interface
137
+ test_files:
138
+ - test/test_cursor.rb
140
139
  - test/test_mouse.rb
141
- - test/test_std.rb
142
- - test/test_readoutput.rb
143
- - test/test_write.rb
144
140
  - test/test_readinput.rb
141
+ - test/test_readoutput.rb
145
142
  - test/test_sendevent.rb
143
+ - test/test_std.rb
146
144
  - test/test_title.rb
147
- - test/test_cursor.rb
145
+ - test/test_write.rb