windows-pr 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +444 -438
  3. data/MANIFEST +68 -65
  4. data/README +154 -153
  5. data/Rakefile +42 -37
  6. data/doc/conversion_guide.txt +37 -37
  7. data/lib/windows/clipboard.rb +61 -61
  8. data/lib/windows/com.rb +192 -192
  9. data/lib/windows/com/accessibility.rb +16 -16
  10. data/lib/windows/com/automation.rb +149 -149
  11. data/lib/windows/com/variant.rb +24 -24
  12. data/lib/windows/console.rb +114 -114
  13. data/lib/windows/debug.rb +35 -35
  14. data/lib/windows/device_io.rb +248 -248
  15. data/lib/windows/directory.rb +27 -27
  16. data/lib/windows/error.rb +504 -498
  17. data/lib/windows/eventlog.rb +80 -80
  18. data/lib/windows/file.rb +264 -264
  19. data/lib/windows/file_mapping.rb +25 -25
  20. data/lib/windows/filesystem.rb +15 -15
  21. data/lib/windows/gdi/bitmap.rb +65 -65
  22. data/lib/windows/gdi/device_context.rb +46 -46
  23. data/lib/windows/gdi/metafile.rb +40 -40
  24. data/lib/windows/gdi/painting_drawing.rb +115 -115
  25. data/lib/windows/handle.rb +23 -23
  26. data/lib/windows/library.rb +44 -44
  27. data/lib/windows/limits.rb +34 -34
  28. data/lib/windows/mailslot.rb +24 -24
  29. data/lib/windows/memory.rb +128 -128
  30. data/lib/windows/msvcrt/buffer.rb +75 -75
  31. data/lib/windows/msvcrt/directory.rb +31 -31
  32. data/lib/windows/msvcrt/file.rb +47 -47
  33. data/lib/windows/msvcrt/io.rb +73 -73
  34. data/lib/windows/msvcrt/string.rb +182 -182
  35. data/lib/windows/msvcrt/time.rb +169 -169
  36. data/lib/windows/national.rb +580 -580
  37. data/lib/windows/network/management.rb +525 -525
  38. data/lib/windows/network/snmp.rb +92 -92
  39. data/lib/windows/network/winsock.rb +128 -128
  40. data/lib/windows/nio.rb +50 -50
  41. data/lib/windows/ntfs/winternl.rb +117 -117
  42. data/lib/windows/path.rb +143 -143
  43. data/lib/windows/pipe.rb +42 -42
  44. data/lib/windows/process.rb +176 -176
  45. data/lib/windows/registry.rb +171 -171
  46. data/lib/windows/security.rb +479 -479
  47. data/lib/windows/security/authentication.rb +32 -32
  48. data/lib/windows/security/sspi.rb +153 -0
  49. data/lib/windows/service.rb +142 -142
  50. data/lib/windows/shell.rb +171 -171
  51. data/lib/windows/socket.rb +86 -86
  52. data/lib/windows/sound.rb +39 -39
  53. data/lib/windows/synchronize.rb +133 -133
  54. data/lib/windows/system_info.rb +229 -229
  55. data/lib/windows/thread.rb +64 -64
  56. data/lib/windows/time.rb +48 -48
  57. data/lib/windows/tool_helper.rb +36 -36
  58. data/lib/windows/unicode.rb +155 -155
  59. data/lib/windows/volume.rb +61 -61
  60. data/lib/windows/window.rb +81 -81
  61. data/lib/windows/window/classes.rb +59 -59
  62. data/lib/windows/window/dialog.rb +91 -91
  63. data/lib/windows/window/menu.rb +102 -102
  64. data/lib/windows/window/message.rb +297 -297
  65. data/lib/windows/window/properties.rb +20 -20
  66. data/lib/windows/window/timer.rb +19 -19
  67. data/lib/windows/wsa.rb +102 -102
  68. data/test/tc_clipboard.rb +41 -41
  69. data/test/tc_com.rb +32 -32
  70. data/test/tc_com_automation.rb +15 -15
  71. data/test/tc_console.rb +108 -108
  72. data/test/tc_debug.rb +48 -48
  73. data/test/tc_device_io.rb +29 -29
  74. data/test/tc_directory.rb +25 -25
  75. data/test/tc_error.rb +38 -38
  76. data/test/tc_eventlog.rb +58 -58
  77. data/test/tc_file.rb +67 -67
  78. data/test/tc_file_mapping.rb +38 -38
  79. data/test/tc_filesystem.rb +27 -27
  80. data/test/tc_gdi_bitmap.rb +25 -25
  81. data/test/tc_gdi_metafile.rb +23 -23
  82. data/test/tc_handle.rb +36 -36
  83. data/test/tc_library.rb +37 -37
  84. data/test/tc_limits.rb +34 -34
  85. data/test/tc_mailslot.rb +22 -22
  86. data/test/tc_memory.rb +44 -44
  87. data/test/tc_msvcrt_buffer.rb +63 -63
  88. data/test/tc_msvcrt_directory.rb +96 -96
  89. data/test/tc_msvcrt_file.rb +80 -80
  90. data/test/tc_msvcrt_io.rb +48 -48
  91. data/test/tc_msvcrt_string.rb +94 -94
  92. data/test/tc_msvcrt_time.rb +19 -19
  93. data/test/tc_national.rb +38 -38
  94. data/test/tc_network_management.rb +32 -32
  95. data/test/tc_network_snmp.rb +31 -31
  96. data/test/tc_network_winsock.rb +34 -34
  97. data/test/tc_nio.rb +32 -32
  98. data/test/tc_ntfs_winternl.rb +48 -48
  99. data/test/tc_path.rb +90 -90
  100. data/test/tc_pipe.rb +53 -53
  101. data/test/tc_process.rb +24 -24
  102. data/test/tc_registry.rb +29 -29
  103. data/test/tc_security.rb +104 -104
  104. data/test/tc_security_authentication.rb +34 -34
  105. data/test/tc_security_sspi.rb +23 -0
  106. data/test/tc_service.rb +57 -57
  107. data/test/tc_shell.rb +34 -34
  108. data/test/tc_socket.rb +20 -20
  109. data/test/tc_sound.rb +37 -37
  110. data/test/tc_synchronize.rb +75 -75
  111. data/test/tc_system_info.rb +33 -33
  112. data/test/tc_thread.rb +29 -29
  113. data/test/tc_time.rb +32 -32
  114. data/test/tc_tool_helper.rb +29 -29
  115. data/test/tc_unicode.rb +83 -83
  116. data/test/tc_volume.rb +47 -47
  117. data/test/tc_window.rb +45 -45
  118. data/test/tc_window_classes.rb +33 -33
  119. data/test/tc_window_dialog.rb +33 -33
  120. data/test/tc_window_menu.rb +29 -29
  121. data/test/tc_window_message.rb +33 -33
  122. data/test/tc_window_properties.rb +29 -29
  123. data/test/tc_window_timer.rb +29 -29
  124. data/test/tc_wsa.rb +19 -19
  125. data/windows-pr.gemspec +33 -34
  126. metadata +31 -32
data/MANIFEST CHANGED
@@ -1,65 +1,68 @@
1
- * CHANGES
2
- * MANIFEST
3
- * README
4
- * Rakefile
5
- * windows-pr.gemspec
6
-
7
- * doc/conversion_guide.txt
8
-
9
- * lib/windows/clipboard.rb
10
- * lib/windows/console.rb
11
- * lib/windows/device_io.rb
12
- * lib/windows/directory.rb
13
- * lib/windows/error.rb
14
- * lib/windows/eventlog.rb
15
- * lib/windows/file_mapping.rb
16
- * lib/windows/file.rb
17
- * lib/windows/filesystem.rb
18
- * lib/windows/handle.rb
19
- * lib/windows/library.rb
20
- * lib/windows/limits.rb
21
- * lib/windows/mailslot.rb
22
- * lib/windows/memory.rb
23
- * lib/windows/national.rb
24
- * lib/windows/nio.rb
25
- * lib/windows/network_management.rb
26
- * lib/windows/path.rb
27
- * lib/windows/pipe.rb
28
- * lib/windows/process.rb
29
- * lib/windows/registry.rb
30
- * lib/windows/security.rb
31
- * lib/windows/service.rb
32
- * lib/windows/shell.rb
33
- * lib/windows/sound.rb
34
- * lib/windows/synchronize.rb
35
- * lib/windows/system_info.rb
36
- * lib/windows/time.rb
37
- * lib/windows/unicode.rb
38
- * lib/windows/volume.rb
39
- * lib/windows/window.rb
40
-
41
- * lib/windows/com/automation.rb
42
-
43
- * lib/windows/gdi/bitmap.rb
44
- * lib/windows/gdi/device_context.rb
45
- * lib/windows/gdi/painting_drawing.rb
46
-
47
- * lib/windows/msvcrt/buffer.rb
48
- * lib/windows/msvcrt/directory.rb
49
- * lib/windows/msvcrt/file.rb
50
- * lib/windows/msvcrt/io.rb
51
- * lib/windows/msvcrt/string.rb
52
- * lib/windows/msvcrt/time.rb
53
-
54
- * lib/windows/network/management.rb
55
- * lib/windows/network/snmp.rb
56
- * lib/windows/network/winsock.rb
57
-
58
- * lib/windows/ntfs/winternl.rb
59
-
60
- * lib/windows/window/classes.rb
61
- * lib/windows/window/dialog.rb
62
- * lib/windows/window/menu.rb
63
- * lib/windows/window/message.rb
64
- * lib/windows/window/properties.rb
65
- * lib/windows/window/timer.rb
1
+ * CHANGES
2
+ * MANIFEST
3
+ * README
4
+ * Rakefile
5
+ * windows-pr.gemspec
6
+
7
+ * doc/conversion_guide.txt
8
+
9
+ * lib/windows/clipboard.rb
10
+ * lib/windows/console.rb
11
+ * lib/windows/device_io.rb
12
+ * lib/windows/directory.rb
13
+ * lib/windows/error.rb
14
+ * lib/windows/eventlog.rb
15
+ * lib/windows/file_mapping.rb
16
+ * lib/windows/file.rb
17
+ * lib/windows/filesystem.rb
18
+ * lib/windows/handle.rb
19
+ * lib/windows/library.rb
20
+ * lib/windows/limits.rb
21
+ * lib/windows/mailslot.rb
22
+ * lib/windows/memory.rb
23
+ * lib/windows/national.rb
24
+ * lib/windows/nio.rb
25
+ * lib/windows/network_management.rb
26
+ * lib/windows/path.rb
27
+ * lib/windows/pipe.rb
28
+ * lib/windows/process.rb
29
+ * lib/windows/registry.rb
30
+ * lib/windows/security.rb
31
+ * lib/windows/service.rb
32
+ * lib/windows/shell.rb
33
+ * lib/windows/sound.rb
34
+ * lib/windows/synchronize.rb
35
+ * lib/windows/system_info.rb
36
+ * lib/windows/time.rb
37
+ * lib/windows/unicode.rb
38
+ * lib/windows/volume.rb
39
+ * lib/windows/window.rb
40
+
41
+ * lib/windows/com/automation.rb
42
+
43
+ * lib/windows/gdi/bitmap.rb
44
+ * lib/windows/gdi/device_context.rb
45
+ * lib/windows/gdi/painting_drawing.rb
46
+
47
+ * lib/windows/msvcrt/buffer.rb
48
+ * lib/windows/msvcrt/directory.rb
49
+ * lib/windows/msvcrt/file.rb
50
+ * lib/windows/msvcrt/io.rb
51
+ * lib/windows/msvcrt/string.rb
52
+ * lib/windows/msvcrt/time.rb
53
+
54
+ * lib/windows/network/management.rb
55
+ * lib/windows/network/snmp.rb
56
+ * lib/windows/network/winsock.rb
57
+
58
+ * lib/windows/ntfs/winternl.rb
59
+
60
+ * lib/windows/security/authentication.rb
61
+ * lib/windows/security/sspi.rb
62
+
63
+ * lib/windows/window/classes.rb
64
+ * lib/windows/window/dialog.rb
65
+ * lib/windows/window/menu.rb
66
+ * lib/windows/window/message.rb
67
+ * lib/windows/window/properties.rb
68
+ * lib/windows/window/timer.rb
data/README CHANGED
@@ -1,153 +1,154 @@
1
- == Description
2
- A collection of Windows functions predefined for you via Win32::API.
3
- Hence the 'pr', for 'Pure Ruby'.
4
-
5
- == Synopsis
6
- require 'windows/path'
7
-
8
- class Foo
9
- include Windows::Path
10
-
11
- if PathIsRoot.call("C:\\") > 0
12
- ...
13
- end
14
-
15
- # or
16
-
17
- if PathIsRoot("C:\\")
18
- ...
19
- end
20
- end
21
-
22
- == Installation
23
- gem install windows-pr
24
-
25
- == Methods
26
- Each of the various files included as part of this package provide a series
27
- of constants corresponding to the equivalent Windows API function and
28
- related numeric constants. For example, if you require 'windows/path',
29
- you now have PathIsRoot, PathIsUNC, etc, available to you as Win32::API
30
- objects in the form of constants.
31
-
32
- A wrapper has been provided for each method in order to avoid the
33
- Win32::API#call method. So, instead of PathIsRoot.call(path) you can
34
- invoke it as PathIsRoot(path). If the original function is lower case
35
- then the wrapper method is lower case as well. For example, instead of
36
- doing 'Memcpy.call(dest, src, size)' you can do 'memcpy(dest, src, size)'.
37
-
38
- Remember boys and girls, if you write 'PathIsRoot', you're referring to
39
- the constant. If you write 'PathIsRoot()', you're calling the wrapper
40
- method.
41
-
42
- Boolean methods automatically perform a check for success or failure. So,
43
- instead of having to do something like 'if PathIsRoot(path) > 0' you can
44
- just do 'if PathIsRoot(path)'. However, I do not add this nicety for the
45
- MSVCRT functions that return int's because some functions have multiple
46
- return values which you may want to inspect. So, rather than making you
47
- guess, I have simply declared that you must inspect return values manually
48
- for any MSVCRT module.
49
-
50
- Source files contain related functions, by topic. For example, the
51
- clipboard.rb file contains clipboard related functions, such as
52
- CloseClipboard(), as well as constants such as CF_TEXT, CF_BITMAP, etc.
53
-
54
- == Wide character functions
55
- I decided that the $KCODE handling was a bad idea, so most of the $KCODE
56
- handling has been removed. The only methods that change their behavior
57
- based on $KCODE are the multi_to_wide and wide_to_multi helper methods
58
- in the Windows::Unicode module. If $KCODE is set to UTF8, then the code
59
- point used is CP_UTF8. Otherwise, CP_ACP is used.
60
-
61
- The modules all come with explicit ANSI and Wide (Unicode) functions,
62
- when available from MS Windows. By default, a function without an explicit
63
- 'A' at the end of the function name uses the ANSI version. It is up to you
64
- to use the wide ('W') functions explicitly if you wish.
65
-
66
- == Platform specific functions
67
- Not all functions are defined on all platforms. For example, the
68
- AttachConsole() function is only defined on Windows XP and later. If you
69
- eed to conditionally test for its existence, simply use the 'defined?'
70
- method:
71
-
72
- if defined? AttachConsole
73
- # Do something
74
- else
75
- # Do something else
76
- end
77
-
78
- == Where are the tests, dude?
79
- While I've made some effort to test these functions, there are simply too
80
- many for me to effectively test them all. We're ultimately talking about
81
- hundreds, if not thousands, of functions, and I don't know what all of them
82
- actually do. That being said, I will add tests where and when I can.
83
-
84
- If you find that I've declared the function prototype wrong for a given
85
- function, please let me know ASAP and I'll fix it. An example program
86
- demonstrating the problem would be helpful, too. Or, if you'd just like
87
- to contribute some test cases, that's fine as well.
88
-
89
- == What's the point?
90
- I became tired of redefining Windows functions over and over whenever I
91
- wanted to use the Win32API library. I thought it would be very handy to
92
- have them predefined for me in a library with convenient wrapper methods
93
- to boot.
94
-
95
- While it's true that Moonwolf has a library on the RAA that includes many
96
- of these functions defined already, there are a few issues with it. First,
97
- it puts *every* function and constant in one or two files. That's a waste
98
- of memory, hard to organize & maintain, and impossible to test. Second,
99
- some of his function declarations are wrong. Third, some of the functions
100
- I needed for my own projects are missing. Fourth, there's no gem. Lastly,
101
- I haven't seen an update in over 6 years, which leads me to believe it is
102
- no longer maintained.
103
-
104
- == Hey, I'm missing function X!
105
- I have only defined a small subset of the overall Windows API. It would
106
- take me years to define them *all*. I defined the ones I needed first,
107
- plus some that I thought would be useful to others. I will continue to
108
- add functions in my spare time, or (especially) by request.
109
-
110
- == Bugs
111
- None that I'm aware of. Please report any bugs on the project page at
112
- http://www.rubyforge.org/projects/win32utils.
113
-
114
- The only real bugs you could find are either bad prototype declarations
115
- or bad constant values. Sometimes I forget to wrap functions properly
116
- that may not be defined on older Windows platforms. But, please report
117
- any of these issues on the project page should you stumble into them.
118
-
119
- == Known Issues
120
- In some cases the MSDN docs are wrong, and we have to learn it the hard
121
- way. If you should happen to find a documentation bug on their site,
122
- please contact them and let them know. They're generally good about fixing
123
- them.
124
-
125
- In other cases library functions are not exported by the dll. For example,
126
- my version of shlwapi.dll does not export the PathIsHTMLFile() function,
127
- despite being well past the minimum version for that DLL. There is nothing
128
- you or I can do about it short of rebuilding the DLL file from scratch
129
- and/or reporting the issue to Microsoft.
130
-
131
- == Supported Platforms
132
- I only support the Windows NT family of Windows, and then only Windows
133
- 2000 and later.
134
-
135
- == Future Plans
136
- I plan on converting this library to use FFI instead of win32-api. There
137
- is already an ffi branch with most of that work done.
138
-
139
- == License
140
- Artistic 2.0
141
-
142
- == Warranty
143
- This package is provided "as is" and without any express or
144
- implied warranties, including, without limitation, the implied
145
- warranties of merchantability and fitness for a particular purpose.
146
-
147
- == Copyright
148
- (C) 2006-2012, Daniel J. Berger
149
- All Rights Reserved
150
-
151
- == Author(s)
152
- Daniel Berger
153
- Park Heesob
1
+ == Description
2
+ A collection of Windows functions predefined for you via Win32::API.
3
+ Hence the 'pr', for 'Pure Ruby'.
4
+
5
+ == Installation
6
+ gem install windows-pr
7
+
8
+ == Synopsis
9
+ require 'windows/path'
10
+
11
+ class Foo
12
+ include Windows::Path
13
+
14
+ if PathIsRoot.call("C:\\") > 0
15
+ ...
16
+ end
17
+
18
+ # or
19
+
20
+ if PathIsRoot("C:\\")
21
+ ...
22
+ end
23
+ end
24
+
25
+ == Methods
26
+ Each of the various files included as part of this package provide a series
27
+ of constants corresponding to the equivalent Windows API function and
28
+ related numeric constants. For example, if you require 'windows/path',
29
+ you now have PathIsRoot, PathIsUNC, etc, available to you as Win32::API
30
+ objects in the form of constants.
31
+
32
+ A wrapper has been provided for each method in order to avoid the
33
+ Win32::API#call method. So, instead of PathIsRoot.call(path) you can
34
+ invoke it as PathIsRoot(path). If the original function is lower case
35
+ then the wrapper method is lower case as well. For example, instead of
36
+ doing 'Memcpy.call(dest, src, size)' you can do 'memcpy(dest, src, size)'.
37
+
38
+ Remember boys and girls, if you write 'PathIsRoot', you're referring to
39
+ the constant. If you write 'PathIsRoot()', you're calling the wrapper
40
+ method.
41
+
42
+ Boolean methods automatically perform a check for success or failure. So,
43
+ instead of having to do something like 'if PathIsRoot(path) > 0' you can
44
+ just do 'if PathIsRoot(path)'. However, I do not add this nicety for the
45
+ MSVCRT functions that return int's because some functions have multiple
46
+ return values which you may want to inspect. So, rather than making you
47
+ guess, I have simply declared that you must inspect return values manually
48
+ for any MSVCRT module.
49
+
50
+ Source files contain related functions, by topic. For example, the
51
+ clipboard.rb file contains clipboard related functions, such as
52
+ CloseClipboard(), as well as constants such as CF_TEXT, CF_BITMAP, etc.
53
+
54
+ == Wide character functions
55
+ I decided that the $KCODE handling was a bad idea, so most of the $KCODE
56
+ handling has been removed. The only methods that change their behavior
57
+ based on $KCODE are the multi_to_wide and wide_to_multi helper methods
58
+ in the Windows::Unicode module. If $KCODE is set to UTF8, then the code
59
+ point used is CP_UTF8. Otherwise, CP_ACP is used.
60
+
61
+ The modules all come with explicit ANSI and Wide (Unicode) functions,
62
+ when available from MS Windows. By default, a function without an explicit
63
+ 'A' at the end of the function name uses the ANSI version. It is up to you
64
+ to use the wide ('W') functions explicitly if you wish.
65
+
66
+ == Platform specific functions
67
+ Not all functions are defined on all platforms. For example, the
68
+ AttachConsole() function is only defined on Windows XP and later. If you
69
+ eed to conditionally test for its existence, simply use the 'defined?'
70
+ method:
71
+
72
+ if defined? AttachConsole
73
+ # Do something
74
+ else
75
+ # Do something else
76
+ end
77
+
78
+ == Where are the tests, dude?
79
+ While I've made some effort to test these functions, there are simply too
80
+ many for me to effectively test them all. We're ultimately talking about
81
+ hundreds, if not thousands, of functions, and I don't know what all of them
82
+ actually do. That being said, I will add tests where and when I can.
83
+
84
+ If you find that I've declared the function prototype wrong for a given
85
+ function, please let me know ASAP and I'll fix it. An example program
86
+ demonstrating the problem would be helpful, too. Or, if you'd just like
87
+ to contribute some test cases, that's fine as well.
88
+
89
+ == What's the point?
90
+ I became tired of redefining Windows functions over and over whenever I
91
+ wanted to use the Win32API library. I thought it would be very handy to
92
+ have them predefined for me in a library with convenient wrapper methods
93
+ to boot.
94
+
95
+ While it's true that Moonwolf has a library on the RAA that includes many
96
+ of these functions defined already, there are a few issues with it. First,
97
+ it puts *every* function and constant in one or two files. That's a waste
98
+ of memory, hard to organize & maintain, and impossible to test. Second,
99
+ some of his function declarations are wrong. Third, some of the functions
100
+ I needed for my own projects are missing. Fourth, there's no gem. Lastly,
101
+ I haven't seen an update in over 6 years, which leads me to believe it is
102
+ no longer maintained.
103
+
104
+ == Hey, I'm missing function X!
105
+ I have only defined a small subset of the overall Windows API. It would
106
+ take me years to define them *all*. I defined the ones I needed first,
107
+ plus some that I thought would be useful to others. I will continue to
108
+ add functions in my spare time, or (especially) by request.
109
+
110
+ == Bugs
111
+ None that I'm aware of. Please report any bugs on the project page at:
112
+
113
+ https://github.com/djberg96/windows-pr
114
+
115
+ The only real bugs you should find are either bad prototype declarations
116
+ or bad constant values. Sometimes I forget to wrap functions properly
117
+ that may not be defined on older Windows platforms. But, please report
118
+ any of these issues on the project page should you stumble into them.
119
+
120
+ == Known Issues
121
+ In some cases the MSDN docs are wrong, and we have to learn it the hard
122
+ way. If you should happen to find a documentation bug on their site,
123
+ please contact them and let them know. They're generally good about fixing
124
+ them.
125
+
126
+ In other cases library functions are not exported by the dll. For example,
127
+ my version of shlwapi.dll does not export the PathIsHTMLFile() function,
128
+ despite being well past the minimum version for that DLL. There is nothing
129
+ you or I can do about it short of rebuilding the DLL file from scratch
130
+ and/or reporting the issue to Microsoft.
131
+
132
+ == Supported Platforms
133
+ I only support the Windows NT family of Windows, and then only Windows
134
+ 2000 and later.
135
+
136
+ == Future Plans
137
+ I plan on converting this library to use FFI instead of win32-api. There
138
+ is already an ffi branch with some of that work done.
139
+
140
+ == License
141
+ Artistic 2.0
142
+
143
+ == Warranty
144
+ This package is provided "as is" and without any express or
145
+ implied warranties, including, without limitation, the implied
146
+ warranties of merchantability and fitness for a particular purpose.
147
+
148
+ == Copyright
149
+ (C) 2006-2014, Daniel J. Berger
150
+ All Rights Reserved
151
+
152
+ == Author(s)
153
+ Daniel Berger
154
+ Park Heesob
data/Rakefile CHANGED
@@ -1,37 +1,42 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
-
5
- CLEAN.include("**/*.gem", "**/*.rbc")
6
-
7
- namespace 'gem' do
8
- desc 'Build the windows-pr gem'
9
- task :create do
10
- spec = eval(IO.read('windows-pr.gemspec'))
11
- Gem::Builder.new(spec).build
12
- end
13
-
14
- desc 'Install the windows-pr gem'
15
- task :install => [:create] do
16
- file = Dir["*.gem"].first
17
- sh "gem install #{file}"
18
- end
19
- end
20
-
21
- namespace 'test' do
22
- Rake::TestTask.new('all') do |t|
23
- t.warning = true
24
- t.test_files = FileList['test/tc*']
25
- end
26
-
27
- # Dynamically generate individual test tasks.
28
- Dir['test/*.rb'].each{ |file|
29
- name = File.basename(file.split('tc_').last, '.rb')
30
- Rake::TestTask.new(name) do |t|
31
- t.warning = true
32
- t.test_files = FileList[file]
33
- end
34
- }
35
- end
36
-
37
- task :default => 'test:all'
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+
5
+ CLEAN.include("**/*.gem", "**/*.rbc")
6
+
7
+ namespace 'gem' do
8
+ desc 'Build the windows-pr gem'
9
+ task :create do
10
+ spec = eval(IO.read('windows-pr.gemspec'))
11
+ if Gem::VERSION < "2.0"
12
+ Gem::Builder.new(spec).build
13
+ else
14
+ require 'rubygems/package'
15
+ Gem::Package.build(spec)
16
+ end
17
+ end
18
+
19
+ desc 'Install the windows-pr gem'
20
+ task :install => [:create] do
21
+ file = Dir["*.gem"].first
22
+ sh "gem install #{file}"
23
+ end
24
+ end
25
+
26
+ namespace 'test' do
27
+ Rake::TestTask.new('all') do |t|
28
+ t.warning = true
29
+ t.test_files = FileList['test/tc*']
30
+ end
31
+
32
+ # Dynamically generate individual test tasks.
33
+ Dir['test/*.rb'].each{ |file|
34
+ name = File.basename(file.split('tc_').last, '.rb')
35
+ Rake::TestTask.new(name) do |t|
36
+ t.warning = true
37
+ t.test_files = FileList[file]
38
+ end
39
+ }
40
+ end
41
+
42
+ task :default => 'test:all'