win32-api 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,107 +1,111 @@
1
- = 1.4.2 - 31-May-2009
2
- * Updated the internal StringError() function to better handle the possibility
3
- of the English .mui file not being found. Thanks go to Michel Demazure for
4
- the spot.
5
-
6
- = 1.4.1 - 29-May-2009
7
- * Callback handling improvements.
8
- * Updated the gemspec description.
9
-
10
- = 1.4.0 - 19-Feb-2009
11
- * Now compatible with Ruby 1.9.x.
12
- * In what will go down as, "It seemed like a good idea at the time", I have
13
- removed the feature where W (wide) character functions were used first if
14
- your $KCODE environment variable was set to "UTF8". It caused too many
15
- headaches in practice, especially amongst Rails users. You must now always
16
- explicitly specify 'W' in the constructor if that's what you want.
17
- * Fixed RF bug #23944 - bad error message for MSVCRT functions that failed
18
- to load properly.
19
-
20
- = 1.3.0 - 1-Jan-2009
21
- * Fixed RubyForge bug #23395, which was caused by inadvertently modifying
22
- a variable within a loop. This caused callbacks to fail in certain
23
- situations.
24
- * Added the Win32::API::LoadLibraryError and Win32::API::PrototypeError classes
25
- to provide more fine grained handling of possible error conditions in the
26
- constructor. These are both subclasses of Win32::API::Error.
27
- * Removed the Win32::API::CallbackError class.
28
- * Changed the upper limit on prototypes from 16 to 20. It turns out that
29
- there are actually Windows functions with more than 16 prototypes.
30
- * Refactored a high iteration test so that it counts as only one test
31
- instead of 1000.
32
-
33
- = 1.2.2 - 27-Nov-2008
34
- * Fixed bug in the error message for illegal prototypes and illegal return
35
- types where the character in question would come out as empty or garbage.
36
- * Passing a bad return type to Win32::API::Callback now raises an error.
37
- * Updated the error message for illegal return types to say, "Illegal return
38
- type" instead of "Illegal prototype" as it did previously.
39
- * The error message for a bad function name passed to Win32::API.new now
40
- matches JRuby's FFI error message.
41
- * Improved the handling of msvcrt functions with regards to skipping 'A'
42
- and 'W' checks. Previously it was checking against the literal string
43
- 'msvcrt'. Now it checks against any string that starts with 'msvcr'.
44
- * Added test-unit 2.x as a prerequisite.
45
- * Added tests for the Win32::API::Callback#address method.
46
- * Added tests to all Win32::API classes that explicitly check error messages.
47
-
48
- = 1.2.1 - 14-Nov-2008
49
- * Fixed and updated callback handling.
50
- * Fixed wide string return handling for pointers and strings.
51
- * Added the Win32::API::Callback#address instance method.
52
- * All errors are now in English instead of your native language, because
53
- that's what Ruby itself does.
54
-
55
- = 1.2.0 - 22-Jul-2008
56
- * Added support for the 'S' (string) prototype and return type. It can be
57
- used instead of 'P' (pointer) for const char*.
58
- * Some internal refactoring. The attempts to load ANSI and/or Wide character
59
- versions of functions are skipped for MSVCRT functions, since they do not
60
- exist. This eliminates some unnecessary LoadLibrary() calls.
61
- * Added a couple of gem building Rake tasks.
62
- * Added a few more tests.
63
-
64
- = 1.1.0 - 12-Jun-2008
65
- * Added the Windows::API::Function class. This is a subclass of Win32::API
66
- meant only for use with raw function pointers.
67
- * Some documentation updates in the source and README files.
68
-
69
- = 1.0.6 - 18-Apr-2008
70
- * Added the effective_function_name method. This allows you to see what the
71
- actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
72
- * Replaced an instance of _tcscmp with strcmp. The case in question was always
73
- going to be ASCII.
74
- * Cleaned up some -W3 warnings.
75
- * Added the build_manifest task to the Rakefile, which is automatically run if
76
- you're using a version of Ruby built with VC++ 8 or later. This builds a
77
- ruby.exe.manifest file (if it doesn't already exist).
78
-
79
- = 1.0.5 - 20-Nov-2007
80
- * The API.new method now defaults to "W" (wide character functions) before "A"
81
- (ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
82
- * Minor improvements to the Rakefile.
83
-
84
- = 1.0.4 - 26-Oct-2007
85
- * Fixed a bug where methods that returned pointers ('P') could choke if the
86
- resulting pointer was 0 or NULL. In this case, nil is now returned instead.
87
- * Tweak to the extconf.rb file that helps the gem build it from source
88
- properly.
89
-
90
- = 1.0.3 - 28-Sep-2007
91
- * Fixed a subtle but dangerous copy-on-write bug in the API#call method.
92
-
93
- = 1.0.2 - 28-Sep-2007
94
- * Fixed a bug in an internal struct member that was causing segfaults. Thanks
95
- go to Lars Olsson for the spot.
96
- * Fixed the 'install' task in the Rakefile. This only affected native builds,
97
- not the prebuilt binary.
98
- * Added a few more tests.
99
-
100
- = 1.0.1 - 27-Sep-2007
101
- * Functions declared with a void prototype no longer require an explicit nil
102
- argument to fulfill the arity requirement. You can still call them with an
103
- explicit nil if you wish, however.
104
- * Fixed the gemspec for the native build.
105
-
106
- = 1.0.0 - 14-Sep-2007
107
- * Initial release
1
+ = 1.4.3 - 23-Jun-2009
2
+ * Bug fix for mingw.
3
+ * License now set to Artistic 2.0.
4
+
5
+ = 1.4.2 - 31-May-2009
6
+ * Updated the internal StringError() function to better handle the possibility
7
+ of the English .mui file not being found. Thanks go to Michel Demazure for
8
+ the spot.
9
+
10
+ = 1.4.1 - 29-May-2009
11
+ * Callback handling improvements.
12
+ * Updated the gemspec description.
13
+
14
+ = 1.4.0 - 19-Feb-2009
15
+ * Now compatible with Ruby 1.9.x.
16
+ * In what will go down as, "It seemed like a good idea at the time", I have
17
+ removed the feature where W (wide) character functions were used first if
18
+ your $KCODE environment variable was set to "UTF8". It caused too many
19
+ headaches in practice, especially amongst Rails users. You must now always
20
+ explicitly specify 'W' in the constructor if that's what you want.
21
+ * Fixed RF bug #23944 - bad error message for MSVCRT functions that failed
22
+ to load properly.
23
+
24
+ = 1.3.0 - 1-Jan-2009
25
+ * Fixed RubyForge bug #23395, which was caused by inadvertently modifying
26
+ a variable within a loop. This caused callbacks to fail in certain
27
+ situations.
28
+ * Added the Win32::API::LoadLibraryError and Win32::API::PrototypeError classes
29
+ to provide more fine grained handling of possible error conditions in the
30
+ constructor. These are both subclasses of Win32::API::Error.
31
+ * Removed the Win32::API::CallbackError class.
32
+ * Changed the upper limit on prototypes from 16 to 20. It turns out that
33
+ there are actually Windows functions with more than 16 prototypes.
34
+ * Refactored a high iteration test so that it counts as only one test
35
+ instead of 1000.
36
+
37
+ = 1.2.2 - 27-Nov-2008
38
+ * Fixed bug in the error message for illegal prototypes and illegal return
39
+ types where the character in question would come out as empty or garbage.
40
+ * Passing a bad return type to Win32::API::Callback now raises an error.
41
+ * Updated the error message for illegal return types to say, "Illegal return
42
+ type" instead of "Illegal prototype" as it did previously.
43
+ * The error message for a bad function name passed to Win32::API.new now
44
+ matches JRuby's FFI error message.
45
+ * Improved the handling of msvcrt functions with regards to skipping 'A'
46
+ and 'W' checks. Previously it was checking against the literal string
47
+ 'msvcrt'. Now it checks against any string that starts with 'msvcr'.
48
+ * Added test-unit 2.x as a prerequisite.
49
+ * Added tests for the Win32::API::Callback#address method.
50
+ * Added tests to all Win32::API classes that explicitly check error messages.
51
+
52
+ = 1.2.1 - 14-Nov-2008
53
+ * Fixed and updated callback handling.
54
+ * Fixed wide string return handling for pointers and strings.
55
+ * Added the Win32::API::Callback#address instance method.
56
+ * All errors are now in English instead of your native language, because
57
+ that's what Ruby itself does.
58
+
59
+ = 1.2.0 - 22-Jul-2008
60
+ * Added support for the 'S' (string) prototype and return type. It can be
61
+ used instead of 'P' (pointer) for const char*.
62
+ * Some internal refactoring. The attempts to load ANSI and/or Wide character
63
+ versions of functions are skipped for MSVCRT functions, since they do not
64
+ exist. This eliminates some unnecessary LoadLibrary() calls.
65
+ * Added a couple of gem building Rake tasks.
66
+ * Added a few more tests.
67
+
68
+ = 1.1.0 - 12-Jun-2008
69
+ * Added the Windows::API::Function class. This is a subclass of Win32::API
70
+ meant only for use with raw function pointers.
71
+ * Some documentation updates in the source and README files.
72
+
73
+ = 1.0.6 - 18-Apr-2008
74
+ * Added the effective_function_name method. This allows you to see what the
75
+ actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
76
+ * Replaced an instance of _tcscmp with strcmp. The case in question was always
77
+ going to be ASCII.
78
+ * Cleaned up some -W3 warnings.
79
+ * Added the build_manifest task to the Rakefile, which is automatically run if
80
+ you're using a version of Ruby built with VC++ 8 or later. This builds a
81
+ ruby.exe.manifest file (if it doesn't already exist).
82
+
83
+ = 1.0.5 - 20-Nov-2007
84
+ * The API.new method now defaults to "W" (wide character functions) before "A"
85
+ (ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
86
+ * Minor improvements to the Rakefile.
87
+
88
+ = 1.0.4 - 26-Oct-2007
89
+ * Fixed a bug where methods that returned pointers ('P') could choke if the
90
+ resulting pointer was 0 or NULL. In this case, nil is now returned instead.
91
+ * Tweak to the extconf.rb file that helps the gem build it from source
92
+ properly.
93
+
94
+ = 1.0.3 - 28-Sep-2007
95
+ * Fixed a subtle but dangerous copy-on-write bug in the API#call method.
96
+
97
+ = 1.0.2 - 28-Sep-2007
98
+ * Fixed a bug in an internal struct member that was causing segfaults. Thanks
99
+ go to Lars Olsson for the spot.
100
+ * Fixed the 'install' task in the Rakefile. This only affected native builds,
101
+ not the prebuilt binary.
102
+ * Added a few more tests.
103
+
104
+ = 1.0.1 - 27-Sep-2007
105
+ * Functions declared with a void prototype no longer require an explicit nil
106
+ argument to fulfill the arity requirement. You can still call them with an
107
+ explicit nil if you wish, however.
108
+ * Fixed the gemspec for the native build.
109
+
110
+ = 1.0.0 - 14-Sep-2007
111
+ * Initial release
data/MANIFEST CHANGED
@@ -1,10 +1,10 @@
1
- * CHANGES
2
- * MANIFEST
3
- * README
4
- * Rakefile
5
- * win32-api.gemspec
6
- * ext/extconf.rb
7
- * ext/win32/api.c
8
- * test/test_win32_api.rb
9
- * test/test_win32_api_callback.rb
1
+ * CHANGES
2
+ * MANIFEST
3
+ * README
4
+ * Rakefile
5
+ * win32-api.gemspec
6
+ * ext/extconf.rb
7
+ * ext/win32/api.c
8
+ * test/test_win32_api.rb
9
+ * test/test_win32_api_callback.rb
10
10
  * test/test_win32_api_function.rb
data/README CHANGED
@@ -1,103 +1,103 @@
1
- = Description
2
- This is a drop-in replacement for the Win32API library currently part of
3
- Ruby's standard library.
4
-
5
- = Synopsis
6
- require 'win32/api'
7
- include Win32
8
-
9
- # Typical example - Get user name
10
- buf = 0.chr * 260
11
- len = [buf.length].pack('L')
12
-
13
- GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
14
- GetUserName.call(buf, len)
15
-
16
- puts buf.strip
17
-
18
- # Callback example - Enumerate windows
19
- EnumWindows = API.new('EnumWindows', 'KP', 'L', 'user32')
20
- GetWindowText = API.new('GetWindowText', 'LPI', 'I', 'user32')
21
- EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
22
- buf = "\0" * 200
23
- GetWindowText.call(handle, buf, 200);
24
- puts buf.strip unless buf.strip.empty?
25
- buf.index(param).nil? ? true : false
26
- }
27
-
28
- EnumWindows.call(EnumWindowsProc, 'UEDIT32')
29
-
30
- # Raw function pointer example - System beep
31
- LoadLibrary = API.new('LoadLibrary', 'P', 'L')
32
- GetProcAddress = API.new('GetProcAddress', 'LP', 'L')
33
-
34
- hlib = LoadLibrary.call('user32')
35
- addr = GetProcAddress.call(hlib, 'MessageBeep')
36
- func = Win32::API::Function.new(addr, 'L', 'L')
37
- func.call(0)
38
-
39
- = Differences between win32-api and Win32API
40
- * This library has callback support
41
- * This library supports raw function pointers.
42
- * This library supports a separate string type for const char* (S).
43
- * Argument order change. The DLL name is now last, not first.
44
- * Removed the 'N' and 'n' prototypes. Always use 'L' for longs now.
45
- * Sensible default arguments for the prototype, return type and DLL name.
46
- * Reader methods for the function name, effective function name, prototype,
47
- return type and DLL.
48
- * Removed the support for lower case prototype and return types. Always
49
- use capital letters.
50
- * Resorts to wide character functions (where possible) when $KCODE is set
51
- to UTF8.
52
-
53
- = Developer's Notes
54
- The current Win32API library that ships with the standard library has been
55
- slated for removal from Ruby 2.0 and it will not receive any updates in the
56
- Ruby 1.8.x branch. I have far too many libraries invested in it to let it
57
- die at this point.
58
-
59
- In addition, the current Win32API library was written in the bad old Ruby
60
- 1.6.x days, which means it doesn't use the newer allocation framework.
61
- There were several other refactorings that I felt it needed to more closely
62
- match how it was actually being used in practice.
63
-
64
- The first order of business was changing the order of the arguments. By
65
- moving the DLL name from first to last, I was able to provide reasonable
66
- default arguments for the prototype, return type and the DLL. Only the
67
- function name is required now.
68
-
69
- There was a laundry list of other refactorings that were needed: sensical
70
- instance variable names with proper accessors, removing support for lower
71
- case prototype and return value characters that no one used in practice,
72
- better naming conventions, the addition of RDoc ready comments and,
73
- especially, callback and raw function pointer support.
74
-
75
- Most importantly, we can now add, modify and fix any features that we feel
76
- best benefit our end users.
77
-
78
- = Documentation
79
- The source file contains inline RDoc documentation. If you installed
80
- this file as a gem, then you have the docs.
81
-
82
- = Warranty
83
- This package is provided "as is" and without any express or
84
- implied warranties, including, without limitation, the implied
85
- warranties of merchantability and fitness for a particular purpose.
86
-
87
- = Known Issues
88
- Possible callback issues when dealing with multi-threaded applications.
89
- We are working on this for the next 1.2.x release.
90
-
91
- Please submit any bug reports to the project page at
92
- http://www.rubyforge.org/projects/win32utils.
93
-
94
- = Copyright
95
- (C) 2003-2009 Daniel J. Berger
96
- All Rights Reserved
97
-
98
- = License
99
- Ruby's
100
-
101
- = Authors
102
- Daniel J. Berger
103
- Park Heesob
1
+ = Description
2
+ This is a drop-in replacement for the Win32API library currently part of
3
+ Ruby's standard library.
4
+
5
+ = Synopsis
6
+ require 'win32/api'
7
+ include Win32
8
+
9
+ # Typical example - Get user name
10
+ buf = 0.chr * 260
11
+ len = [buf.length].pack('L')
12
+
13
+ GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
14
+ GetUserName.call(buf, len)
15
+
16
+ puts buf.strip
17
+
18
+ # Callback example - Enumerate windows
19
+ EnumWindows = API.new('EnumWindows', 'KP', 'L', 'user32')
20
+ GetWindowText = API.new('GetWindowText', 'LPI', 'I', 'user32')
21
+ EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
22
+ buf = "\0" * 200
23
+ GetWindowText.call(handle, buf, 200);
24
+ puts buf.strip unless buf.strip.empty?
25
+ buf.index(param).nil? ? true : false
26
+ }
27
+
28
+ EnumWindows.call(EnumWindowsProc, 'UEDIT32')
29
+
30
+ # Raw function pointer example - System beep
31
+ LoadLibrary = API.new('LoadLibrary', 'P', 'L')
32
+ GetProcAddress = API.new('GetProcAddress', 'LP', 'L')
33
+
34
+ hlib = LoadLibrary.call('user32')
35
+ addr = GetProcAddress.call(hlib, 'MessageBeep')
36
+ func = Win32::API::Function.new(addr, 'L', 'L')
37
+ func.call(0)
38
+
39
+ = Differences between win32-api and Win32API
40
+ * This library has callback support
41
+ * This library supports raw function pointers.
42
+ * This library supports a separate string type for const char* (S).
43
+ * Argument order change. The DLL name is now last, not first.
44
+ * Removed the 'N' and 'n' prototypes. Always use 'L' for longs now.
45
+ * Sensible default arguments for the prototype, return type and DLL name.
46
+ * Reader methods for the function name, effective function name, prototype,
47
+ return type and DLL.
48
+ * Removed the support for lower case prototype and return types. Always
49
+ use capital letters.
50
+ * Resorts to wide character functions (where possible) when $KCODE is set
51
+ to UTF8.
52
+
53
+ = Developer's Notes
54
+ The current Win32API library that ships with the standard library has been
55
+ slated for removal from Ruby 2.0 and it will not receive any updates in the
56
+ Ruby 1.8.x branch. I have far too many libraries invested in it to let it
57
+ die at this point.
58
+
59
+ In addition, the current Win32API library was written in the bad old Ruby
60
+ 1.6.x days, which means it doesn't use the newer allocation framework.
61
+ There were several other refactorings that I felt it needed to more closely
62
+ match how it was actually being used in practice.
63
+
64
+ The first order of business was changing the order of the arguments. By
65
+ moving the DLL name from first to last, I was able to provide reasonable
66
+ default arguments for the prototype, return type and the DLL. Only the
67
+ function name is required now.
68
+
69
+ There was a laundry list of other refactorings that were needed: sensical
70
+ instance variable names with proper accessors, removing support for lower
71
+ case prototype and return value characters that no one used in practice,
72
+ better naming conventions, the addition of RDoc ready comments and,
73
+ especially, callback and raw function pointer support.
74
+
75
+ Most importantly, we can now add, modify and fix any features that we feel
76
+ best benefit our end users.
77
+
78
+ = Documentation
79
+ The source file contains inline RDoc documentation. If you installed
80
+ this file as a gem, then you have the docs.
81
+
82
+ = Warranty
83
+ This package is provided "as is" and without any express or
84
+ implied warranties, including, without limitation, the implied
85
+ warranties of merchantability and fitness for a particular purpose.
86
+
87
+ = Known Issues
88
+ Possible callback issues when dealing with multi-threaded applications.
89
+ We are working on this for the next 1.2.x release.
90
+
91
+ Please submit any bug reports to the project page at
92
+ http://www.rubyforge.org/projects/win32utils.
93
+
94
+ = Copyright
95
+ (C) 2003-2009 Daniel J. Berger
96
+ All Rights Reserved
97
+
98
+ = License
99
+ Ruby's
100
+
101
+ = Authors
102
+ Daniel J. Berger
103
+ Park Heesob
data/Rakefile ADDED
@@ -0,0 +1,146 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include Config
6
+
7
+ desc 'Build the ruby.exe.manifest if it does not already exist'
8
+ task :build_manifest do
9
+ version = CONFIG['host_os'].split('_')[1]
10
+
11
+ if version && version.to_i >= 80
12
+ unless File.exist?(File.join(CONFIG['bindir'], 'ruby.exe.manifest'))
13
+ Dir.chdir(CONFIG['bindir']) do
14
+ sh "mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest"
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ desc 'Install the win32-api library (non-gem)'
21
+ task :install => [:build] do
22
+ Dir.chdir('ext'){
23
+ sh "nmake install"
24
+ }
25
+ end
26
+
27
+ task :install_gem do
28
+ ruby 'win32-api.gemspec'
29
+ file = Dir["*.gem"].first
30
+ sh "gem install #{file}"
31
+ end
32
+
33
+ desc "Clean any build files for Win32::API"
34
+ task :clean do
35
+ Dir.chdir('ext') do
36
+ if File.exists?("api.so") || File.exists?("win32/api.so") ||
37
+ File.exists?("api.obj")
38
+ then
39
+ sh "nmake distclean"
40
+ rm "win32/api.so" if File.exists?("win32/api.so")
41
+ rm "api.so" if File.exists?("api.so")
42
+ end
43
+ end
44
+ end
45
+
46
+ desc "Build Win32::API (but don't install it)"
47
+ task :build => [:clean, :build_manifest] do
48
+ Dir.chdir('ext') do
49
+ ruby "extconf.rb"
50
+ sh "nmake"
51
+ mv "api.so", "win32" # For the test suite
52
+ end
53
+ end
54
+
55
+ desc "Build a standard gem"
56
+ task :build_gem => [:clean] do
57
+ spec = Gem::Specification.new do |gem|
58
+ gem.name = "win32-api"
59
+ gem.version = "1.4.3"
60
+ gem.authors = ["Daniel J. Berger", "Park Heesob"]
61
+ gem.email = "djberg96@gmail.com"
62
+ gem.homepage = "http://www.rubyforge.org/projects/win32utils"
63
+ gem.rubyforge_project = "win32utils"
64
+ gem.platform = Gem::Platform::RUBY
65
+ gem.summary = "A superior replacement for Win32API"
66
+ gem.has_rdoc = true
67
+ gem.test_files = Dir['test/test*']
68
+ gem.extensions = ['ext/extconf.rb']
69
+ gem.license = 'Artistic 2.0'
70
+ files = Dir["ext/win32/api.c"] + Dir["test/*"]
71
+ files.delete_if{ |f| f.include?('CVS') }
72
+ gem.files = files
73
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
74
+ gem.rubyforge_project = 'win32utils'
75
+ gem.required_ruby_version = '>= 1.8.2'
76
+
77
+ gem.description = <<-EOF
78
+ The Win32::API library is meant as a replacement for the Win32API
79
+ library that ships as part of the standard library. It contains several
80
+ advantages over Win32API, including callback support, raw function
81
+ pointers, an additional string type, and more.
82
+ EOF
83
+ end
84
+
85
+ Gem::Builder.new(spec).build
86
+ end
87
+
88
+ desc "Build a binary gem"
89
+ task :build_binary_gem => [:build] do
90
+ mkdir_p 'lib/win32'
91
+ mv 'ext/win32/api.so', 'lib/win32'
92
+ rm_rf 'lib/ffi'
93
+ rm_rf 'lib/jruby'
94
+
95
+ task :build_binary_gem => [:clean]
96
+
97
+ spec = Gem::Specification.new do |gem|
98
+ gem.name = "win32-api"
99
+ gem.version = "1.4.3"
100
+ gem.authors = ["Daniel J. Berger", "Park Heesob"]
101
+ gem.email = "djberg96@gmail.com"
102
+ gem.homepage = "http://www.rubyforge.org/projects/win32utils"
103
+ gem.rubyforge_project = "win32utils"
104
+ gem.platform = Gem::Platform::CURRENT
105
+ gem.summary = "A superior replacement for Win32API"
106
+ gem.has_rdoc = true
107
+ gem.test_files = Dir['test/test*']
108
+ gem.license = 'Artistic 2.0'
109
+ files = Dir["lib/win32/api.so"] + Dir["test/*"]
110
+ files.delete_if{ |f| f.include?('CVS') }
111
+ gem.files = files
112
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
113
+ gem.rubyforge_project = 'win32utils'
114
+ gem.required_ruby_version = '>= 1.8.2'
115
+
116
+ gem.description = <<-EOF
117
+ The Win32::API library is meant as a replacement for the Win32API
118
+ library that ships as part of the standard library. It contains several
119
+ advantages over Win32API, including callback support, raw function
120
+ pointers, an additional string type, and more.
121
+ EOF
122
+ end
123
+
124
+ Gem::Builder.new(spec).build
125
+ end
126
+
127
+ Rake::TestTask.new('test') do |test|
128
+ if RUBY_PLATFORM.match('java')
129
+ test.libs << 'lib/ffi'
130
+ test.test_files = Dir['test/test_win32_api.rb']
131
+ else
132
+ task :test => [:build]
133
+ test.libs << 'ext'
134
+ test.libs.delete('lib')
135
+ end
136
+
137
+ test.warning = true
138
+ test.verbose = true
139
+ end
140
+
141
+ task :test do
142
+ Rake.application[:clean].execute
143
+
144
+ Rake::TestTask.new('test_jruby') do |test|
145
+ test.warning = true
146
+ end