chef-win32-api 1.11.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b1fc17ab9ebef181965a0a807944d6eddb62d43b15382043e0312dcfc3f8509
4
+ data.tar.gz: 3debbe5e1faccf9ba107ac0d294d4fda9a41a1248a06632bcf6cd7fa0dcb62dd
5
+ SHA512:
6
+ metadata.gz: ba319e5ae797c684ac2e3a162671204826ab032eb0bbab3a3a325c1527d00b43c8c1d001fe1441a36579bec826f95705d40f25ab49e2542e30efe0aa237f521a
7
+ data.tar.gz: a366ad7ecde98a7db771b834069dea9684cac8867b2fe0a18002bbc68f8500a4c2fe37b3522bcd999b5824df6cdb93a19b95f28db852e825dc072db419989f20
data/CHANGES ADDED
@@ -0,0 +1,222 @@
1
+ == 1.10.1 - 23-Apr-2021
2
+ * Use ULONG2NUM() for API.last_error to avoid truncate
3
+
4
+ == 1.10.0 - 19-Apr-2021
5
+ * Add Ruby 3.1 snapshot support
6
+ * Add API.last_error
7
+
8
+ == 1.9.2 - 13-Sep-2020
9
+ * Handle Ruby 3.0 snapshot (formerly known as Ruby 2.8).
10
+
11
+ == 1.9.1 - 14-Jul-2020
12
+ * Handle whether tainted support or not.
13
+
14
+ == 1.9.0 - 6-Jan-2020
15
+ * Add Ruby 2.8 snapshot support.
16
+ * Now includes binaries for Ruby 2.8 both 32 and 64 bit versions.
17
+ * Use RubyInstaller 2.7.0-1 for Ruby 2.7 binaries.
18
+
19
+ == 1.8.0 - 6-Jan-2019
20
+ * Add Ruby 2.7 snapshot support.
21
+ * Now includes binaries for Ruby 2.7 both 32 and 64 bit versions.
22
+ * Use RubyInstaller 2.6.0-1 for Ruby 2.6 binaries.
23
+
24
+ == 1.7.1 - 4-Jan-2018
25
+ * Add Ruby 2.6 snapshot support.
26
+ * Now includes binaries for Ruby 2.6 both 32 and 64 bit versions.
27
+ * Use RubyInstaller 2.5.0-1 for Ruby 2.5 binaries.
28
+
29
+ == 1.7.0 - 28-Nov-2017
30
+ * Add gcc option to fix crash on RubyInstaller2 x86
31
+
32
+ == 1.7.0.pre1 - 16-July-2017
33
+ * Add Ruby 2.5 snapshot support.
34
+ * Now includes binaries for Ruby 2.5 for both 32 and 64 bit versions.
35
+
36
+ == 1.6.1.2 - 2-Feb-2017
37
+ * Fix wrong gem packaging.
38
+
39
+ == 1.6.1.1 - 31-Jan-2017 (yanked)
40
+ * Fix wrong returning version number
41
+
42
+ == 1.6.1 - 31-Jan-2017 (yanked)
43
+ * Depends on MSYS2 based RubyInstaller2 to create binaries for Ruby 2.4.0.
44
+
45
+ == 1.6.1.beta1 - 14-Jan-2017
46
+ * Now includes binaries for Ruby 2.4 for both 32 and 64 bit versions.
47
+ * Try to depends on MSYS2 based RubyInstaller2 on Ruby 2.4.
48
+
49
+ == 1.6.0 - 09-Jun-2016
50
+ * Now includes binaries for Ruby 2.3 for both 32 and 64 bit versions.
51
+ * Now drop support Ruby 1.9 or earlier.
52
+ * Some README and gemspec updates, including new maintainer information.
53
+
54
+ == 1.5.3 - 18-Mar-2015
55
+ * Now includes binaries for Ruby 2.2 for both 32 and 64 bit versions.
56
+ * Fixed potential stack corruption caused by callbacks. Thanks go to
57
+ rickerliang for the spot and patch.
58
+ * Some minor updates and additions to the Rakefile.
59
+
60
+ == 1.5.2 - 11-Oct-2014
61
+ * Now includes binaries for Ruby 2.1 for both 32 and 64 bit versions.
62
+ * Some refactoring of the gem:binary task, mostly for me.
63
+
64
+ == 1.5.1 - 14-Feb-2014
65
+ * Fixed a potential zero-initialization issue. Thanks go to Peter Huene
66
+ for the spot and the patch.
67
+ * Added rake as a development dependency.
68
+
69
+ == 1.5.0 - 22-Aug-2013
70
+ * Fixes for Ruby x64.
71
+ * There are now separate 32 and 64 bit binaries packaged for Ruby 2.x.
72
+ * Updates to the Rakefile for the gem:binary task.
73
+ * Some README updates, including Future Plans.
74
+
75
+ == 1.4.9 - 14-Jul-2013
76
+ * Added a binary for Ruby 2.0.
77
+ * Add devkit to Rakefile for the gem:binary task.
78
+
79
+ == 1.4.8 - 16-Jan-2011
80
+ * A binary for both 1.8.x and 1.9.x is now shipped as part of the binary
81
+ build. A stub file is used to dynamically require the correct binary based
82
+ on your current version of Ruby.
83
+ * Some updates to the Rakefile to help build multiple binaries.
84
+
85
+ == 1.4.7 - 4-Dec-2010
86
+ * An internal error formatting function now resorts to the default
87
+ LANGID on error 1815 (ERROR_RESOURCE_LANG_NOT_FOUND). Thanks go to
88
+ Little Snake for the spot.
89
+ * Added a default Rake task and refactored the clean task.
90
+
91
+ == 1.4.6 - 9-Feb-2010
92
+ * Fixed a warning that showed up with MinGW/gcc caused by an unnecessary
93
+ pointer dereference.
94
+ * Some updates to the Rakefile and gemspec. Gem building is now handled via
95
+ Rake tasks.
96
+ * Minor updates to the test suite.
97
+
98
+ == 1.4.5 - 24-Aug-2009
99
+ * Reverted the change in 1.4.4. We need unsigned longs in a few cases.
100
+ Consequently, you should upgrade windows-pr to 1.0.8 or later because
101
+ some return values were set to -1 instead of 0xFFFFFFFF as they are now.
102
+ * Updated one test to validate return value from failed function.
103
+
104
+ == 1.4.4 - 18-Aug-2009
105
+ * Fixed a bug where functions that returned a long return type were unsigned
106
+ instead of signed.
107
+ * The Rakefile has been refactored somewhat, including the removal of FFI
108
+ related tasks. Those are now in a separate branch in the repository.
109
+ * The test-unit library is now a development dependency instead of a runtime
110
+ dependency.
111
+
112
+ == 1.4.3 - 23-Jun-2009
113
+ * Bug fix for mingw.
114
+ * License now set to Artistic 2.0.
115
+
116
+ == 1.4.2 - 31-May-2009
117
+ * Updated the internal StringError() function to better handle the possibility
118
+ of the English .mui file not being found. Thanks go to Michel Demazure for
119
+ the spot.
120
+
121
+ == 1.4.1 - 29-May-2009
122
+ * Callback handling improvements.
123
+ * Updated the gemspec description.
124
+
125
+ == 1.4.0 - 19-Feb-2009
126
+ * Now compatible with Ruby 1.9.x.
127
+ * In what will go down as, "It seemed like a good idea at the time", I have
128
+ removed the feature where W (wide) character functions were used first if
129
+ your $KCODE environment variable was set to "UTF8". It caused too many
130
+ headaches in practice, especially amongst Rails users. You must now always
131
+ explicitly specify 'W' in the constructor if that's what you want.
132
+ * Fixed RF bug #23944 - bad error message for MSVCRT functions that failed
133
+ to load properly.
134
+
135
+ == 1.3.0 - 1-Jan-2009
136
+ * Fixed RubyForge bug #23395, which was caused by inadvertently modifying
137
+ a variable within a loop. This caused callbacks to fail in certain
138
+ situations.
139
+ * Added the Win32::API::LoadLibraryError and Win32::API::PrototypeError classes
140
+ to provide more fine grained handling of possible error conditions in the
141
+ constructor. These are both subclasses of Win32::API::Error.
142
+ * Removed the Win32::API::CallbackError class.
143
+ * Changed the upper limit on prototypes from 16 to 20. It turns out that
144
+ there are actually Windows functions with more than 16 prototypes.
145
+ * Refactored a high iteration test so that it counts as only one test
146
+ instead of 1000.
147
+
148
+ == 1.2.2 - 27-Nov-2008
149
+ * Fixed bug in the error message for illegal prototypes and illegal return
150
+ types where the character in question would come out as empty or garbage.
151
+ * Passing a bad return type to Win32::API::Callback now raises an error.
152
+ * Updated the error message for illegal return types to say, "Illegal return
153
+ type" instead of "Illegal prototype" as it did previously.
154
+ * The error message for a bad function name passed to Win32::API.new now
155
+ matches JRuby's FFI error message.
156
+ * Improved the handling of msvcrt functions with regards to skipping 'A'
157
+ and 'W' checks. Previously it was checking against the literal string
158
+ 'msvcrt'. Now it checks against any string that starts with 'msvcr'.
159
+ * Added test-unit 2.x as a prerequisite.
160
+ * Added tests for the Win32::API::Callback#address method.
161
+ * Added tests to all Win32::API classes that explicitly check error messages.
162
+
163
+ == 1.2.1 - 14-Nov-2008
164
+ * Fixed and updated callback handling.
165
+ * Fixed wide string return handling for pointers and strings.
166
+ * Added the Win32::API::Callback#address instance method.
167
+ * All errors are now in English instead of your native language, because
168
+ that's what Ruby itself does.
169
+
170
+ == 1.2.0 - 22-Jul-2008
171
+ * Added support for the 'S' (string) prototype and return type. It can be
172
+ used instead of 'P' (pointer) for const char*.
173
+ * Some internal refactoring. The attempts to load ANSI and/or Wide character
174
+ versions of functions are skipped for MSVCRT functions, since they do not
175
+ exist. This eliminates some unnecessary LoadLibrary() calls.
176
+ * Added a couple of gem building Rake tasks.
177
+ * Added a few more tests.
178
+
179
+ == 1.1.0 - 12-Jun-2008
180
+ * Added the Windows::API::Function class. This is a subclass of Win32::API
181
+ meant only for use with raw function pointers.
182
+ * Some documentation updates in the source and README files.
183
+
184
+ == 1.0.6 - 18-Apr-2008
185
+ * Added the effective_function_name method. This allows you to see what the
186
+ actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
187
+ * Replaced an instance of _tcscmp with strcmp. The case in question was always
188
+ going to be ASCII.
189
+ * Cleaned up some -W3 warnings.
190
+ * Added the build_manifest task to the Rakefile, which is automatically run if
191
+ you're using a version of Ruby built with VC++ 8 or later. This builds a
192
+ ruby.exe.manifest file (if it doesn't already exist).
193
+
194
+ == 1.0.5 - 20-Nov-2007
195
+ * The API.new method now defaults to "W" (wide character functions) before "A"
196
+ (ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
197
+ * Minor improvements to the Rakefile.
198
+
199
+ == 1.0.4 - 26-Oct-2007
200
+ * Fixed a bug where methods that returned pointers ('P') could choke if the
201
+ resulting pointer was 0 or NULL. In this case, nil is now returned instead.
202
+ * Tweak to the extconf.rb file that helps the gem build it from source
203
+ properly.
204
+
205
+ == 1.0.3 - 28-Sep-2007
206
+ * Fixed a subtle but dangerous copy-on-write bug in the API#call method.
207
+
208
+ == 1.0.2 - 28-Sep-2007
209
+ * Fixed a bug in an internal struct member that was causing segfaults. Thanks
210
+ go to Lars Olsson for the spot.
211
+ * Fixed the 'install' task in the Rakefile. This only affected native builds,
212
+ not the prebuilt binary.
213
+ * Added a few more tests.
214
+
215
+ == 1.0.1 - 27-Sep-2007
216
+ * Functions declared with a void prototype no longer require an explicit nil
217
+ argument to fulfill the arity requirement. You can still call them with an
218
+ explicit nil if you wish, however.
219
+ * Fixed the gemspec for the native build.
220
+
221
+ == 1.0.0 - 14-Sep-2007
222
+ * Initial release
data/Dockerfile ADDED
@@ -0,0 +1,37 @@
1
+ FROM mcr.microsoft.com/windows/servercore:20H2
2
+ LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
3
+ LABEL Description="win32-api building docker image"
4
+
5
+ # Do not split this into multiple RUN!
6
+ # Docker creates a layer for every RUN-Statement
7
+ RUN powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
8
+
9
+ # Ruby 3.0 and 3.1
10
+ RUN powershell \
11
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
12
+ Invoke-WebRequest -OutFile C:\rubyinstaller-3.0.0-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.exe
13
+ RUN cmd /c "C:\rubyinstaller-3.0.0-1-x64.exe" /silent /dir=c:\ruby30-x64
14
+ RUN powershell \
15
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
16
+ Invoke-WebRequest -OutFile C:\rubyinstaller-3.1.6-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.6-1/rubyinstaller-3.1.6-1-x64.exe
17
+ RUN cmd /c "C:\rubyinstaller-3.1.6-1-x64.exe" /silent /dir=c:\ruby31-x64
18
+
19
+ # DevKit
20
+ RUN powershell \
21
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
22
+ Invoke-WebRequest -OutFile C:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
23
+ RUN cmd /c C:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe -o"c:\DevKit64" -y
24
+ RUN powershell \
25
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
26
+ Invoke-WebRequest -OutFile rubyinstaller-devkit-3.1.6-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.6-1/rubyinstaller-devkit-3.1.6-1-x64.exe
27
+ RUN cmd /c rubyinstaller-devkit-3.1.6-1-x64.exe -o"c:\DevKit64" -y
28
+
29
+ RUN choco install -y git \
30
+ && choco install -y msys2 --params "'/NoPath /NoUpdate /InstallDir:C:\msys64'"
31
+ # pacman -Syu --noconfirm is needed for downloading ucrt64 repo.
32
+ # They should be removed after using Ruby 2.5.9, 2.6.7, and 2.7.3 installers.
33
+ RUN refreshenv \
34
+ && C:\ruby31-x64\bin\ridk exec pacman -Syu --noconfirm \
35
+ && C:\ruby31-x64\bin\ridk install 2 3
36
+
37
+ ENTRYPOINT ["cmd"]
data/Dockerfile.trunk ADDED
@@ -0,0 +1,17 @@
1
+ FROM cosmo0920/win32-api:latest
2
+ LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
3
+ LABEL Description="win32-api building docker image"
4
+
5
+ # Ruby 3.1
6
+ RUN powershell \
7
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
8
+ Invoke-WebRequest -OutFile C:\rubyinstaller-head-x86-20210418.exe https://ci.appveyor.com/api/buildjobs/smfh4ojkobb4duif/artifacts/packages%2Fri%2Frecipes%2Finstaller-inno%2Frubyinstaller-head-x86.exe
9
+ RUN cmd /c "C:\rubyinstaller-head-x86-20210418.exe" /silent /dir=c:\ruby31
10
+ RUN powershell \
11
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
12
+ Invoke-WebRequest -OutFile C:\rubyinstaller-head-x64-20210418.exe https://ci.appveyor.com/api/buildjobs/hsgdg4xl5ny74k94/artifacts/packages%2Fri%2Frecipes%2Finstaller-inno%2Frubyinstaller-head-x64.exe
13
+ RUN cmd /c "C:\rubyinstaller-head-x64-20210418.exe" /silent /dir=c:\ruby31-x64
14
+
15
+ RUN mkdir C:\pkg
16
+ COPY build-gem.bat C:\\build-gem.bat
17
+ ENTRYPOINT ["cmd"]
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ gemspec
data/MANIFEST ADDED
@@ -0,0 +1,10 @@
1
+ * CHANGES
2
+ * MANIFEST
3
+ * README.md
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
+ * test/test_win32_api_function.rb
data/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # Description
2
+ This is a drop-in replacement for the Win32API library currently part of
3
+ Ruby's standard library. This fork is taken by Chef Infra to update it to Ruby 3.1 support
4
+
5
+ # Synopsis
6
+
7
+ ```ruby
8
+ require 'win32/api'
9
+ include Win32
10
+
11
+ # Typical example - Get user name
12
+ buf = 0.chr * 260
13
+ len = [buf.length].pack('L')
14
+
15
+ GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
16
+ GetUserName.call(buf, len)
17
+
18
+ puts buf.strip
19
+
20
+ # Callback example - Enumerate windows
21
+ EnumWindows = API.new('EnumWindows', 'KP', 'L', 'user32')
22
+ GetWindowText = API.new('GetWindowText', 'LPI', 'I', 'user32')
23
+ EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
24
+ buf = "\0" * 200
25
+ GetWindowText.call(handle, buf, 200);
26
+ puts buf.strip unless buf.strip.empty?
27
+ buf.index(param).nil? ? true : false
28
+ }
29
+
30
+ EnumWindows.call(EnumWindowsProc, 'UEDIT32')
31
+
32
+ # Raw function pointer example - System beep
33
+ LoadLibrary = API.new('LoadLibrary', 'P', 'L')
34
+ GetProcAddress = API.new('GetProcAddress', 'LP', 'L')
35
+
36
+ hlib = LoadLibrary.call('user32')
37
+ addr = GetProcAddress.call(hlib, 'MessageBeep')
38
+ func = Win32::API::Function.new(addr, 'L', 'L')
39
+ func.call(0)
40
+ ```
41
+
42
+ # Differences between win32-api and Win32API
43
+ * This library has callback support
44
+ * This library supports raw function pointers.
45
+ * This library supports a separate string type for const char* (S).
46
+ * Argument order change. The DLL name is now last, not first.
47
+ * Removed the 'N' and 'n' prototypes. Always use 'L' for longs now.
48
+ * Sensible default arguments for the prototype, return type and DLL name.
49
+ * Reader methods for the function name, effective function name, prototype,
50
+ return type and DLL.
51
+ * Removed the support for lower case prototype and return types. Always
52
+ use capital letters.
53
+
54
+ # Developer's Notes
55
+ NOTE: **Some of the information below is now out of date, but explains my
56
+ motivation at the time the project was originally created.**
57
+
58
+ The current Win32API library that ships with the standard library has been
59
+ slated for removal from Ruby 2.0 and it will not receive any updates in the
60
+ Ruby 1.8.x branch. I have far too many libraries invested in it to let it
61
+ die at this point.
62
+
63
+ In addition, the current Win32API library was written in the bad old Ruby
64
+ 1.6.x days, which means it doesn't use the newer allocation framework.
65
+ There were several other refactorings that I felt it needed to more closely
66
+ match how it was actually being used in practice.
67
+
68
+ The first order of business was changing the order of the arguments. By
69
+ moving the DLL name from first to last, I was able to provide reasonable
70
+ default arguments for the prototype, return type and the DLL. Only the
71
+ function name is required now.
72
+
73
+ There was a laundry list of other refactorings that were needed: sensical
74
+ instance variable names with proper accessors, removing support for lower
75
+ case prototype and return value characters that no one used in practice,
76
+ better naming conventions, the addition of RDoc ready comments and,
77
+ especially, callback and raw function pointer support.
78
+
79
+ Most importantly, we can now add, modify and fix any features that we feel
80
+ best benefit our end users.
81
+
82
+ # Multiple Binaries
83
+ As of win32-api 1.4.8 a binary gem is shipped that contains binaries for
84
+ both Ruby 1.8, Ruby 1.9, and 2.x. For Ruby 2.x, both 32 and 64 bit binaries
85
+ are included as of release 1.5.0.
86
+
87
+ The file under lib/win32 dynamically requires the correct binary based on
88
+ your version of Ruby.
89
+
90
+ # Documentation
91
+ The source file contains inline RDoc documentation. If you installed
92
+ this file as a gem, then you have the docs. Run "gem server" and point
93
+ your browser at http://localhost:8808 to see them.
94
+
95
+ # Warranty
96
+ This package is provided "as is" and without any express or
97
+ implied warranties, including, without limitation, the implied
98
+ warranties of merchantability and fitness for a particular purpose.
99
+
100
+ # Known Issues
101
+ Possible callback issues when dealing with multi-threaded applications.
102
+
103
+ Please submit any bug reports to the project page at
104
+ https://github.com/cosmo0920/win32-api
105
+
106
+ ## Contributions
107
+ Although this library is free, please consider having your company
108
+ setup a gittip if used by your company professionally.
109
+
110
+ http://www.gittip.com/djberg96/
111
+
112
+ # Future Plans
113
+ I really don't have future plans for this library since you should use FFI
114
+ as your preferred C interface going forward. All of my own projects have
115
+ since been converted to either use FFI or an analogous OLE interface.
116
+
117
+ I will continue to maintain this library as long as there are folks out
118
+ there who are still using it, but I strongly encourage you to convert
119
+ your projects to FFI when possible.
120
+
121
+ # Copyright
122
+ (C) 2003-2015 Daniel J. Berger
123
+
124
+ (C) 2016-2020 Hiroshi Hatake
125
+
126
+ All Rights Reserved
127
+
128
+ # License
129
+ Artistic 2.0
130
+
131
+ # Authors
132
+ Daniel J. Berger
133
+
134
+ Park Heesob
135
+
136
+ Hiroshi Hatake
data/RELEASE.md ADDED
@@ -0,0 +1,41 @@
1
+ ## Prerequisites
2
+
3
+ * Docker for Windows
4
+
5
+ ### Release step
6
+
7
+ #### Fat GEM
8
+
9
+ Check the latest ruby-head-YYYYmmDD image:
10
+ https://hub.docker.com/r/cosmo0920/win32-api/tags?page=1&name=ruby-head
11
+
12
+ ```powershell
13
+ PS> mkdir pkg
14
+ PS> docker run -it -v $PWD\pkg:C:\pkg cosmo0920/win32-api:ruby-head-AWESOMEDATE
15
+ ```
16
+
17
+ Build universal gem:
18
+
19
+ ```cmd
20
+ > .\build-gem.bat
21
+ ```
22
+
23
+ Copy built universal gem into mounted directory:
24
+
25
+ ```cmd
26
+ > copy C:\win32-api\win32-api-*.gem C:\pkg
27
+ ```
28
+
29
+ Then, exit and push built gem:
30
+
31
+ ```cmd
32
+ > exit
33
+ > gem push win32-api-*.gem
34
+ ```
35
+
36
+ #### Non Fat GEM
37
+
38
+ ```cmd
39
+ > rake gem:create
40
+ > gem push win32-api-*.gem
41
+ ```
data/Rakefile ADDED
@@ -0,0 +1,63 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+
6
+ CLEAN.include(
7
+ '**/*.gem', # Gem files
8
+ '**/*.rbc', # Rubinius
9
+ '**/*.o', # C object file
10
+ '**/*.log', # Ruby extension build log
11
+ '**/Makefile', # C Makefile
12
+ '**/*.def', # Definition files
13
+ '**/*.exp',
14
+ '**/*.lib',
15
+ '**/*.pdb',
16
+ '**/*.obj',
17
+ '**/*.stackdump', # Junk that can happen on Windows
18
+ "**/*.#{RbConfig::CONFIG['DLEXT']}", # C shared object
19
+ "**/tmp/"
20
+ )
21
+
22
+ require 'rake/extensiontask'
23
+
24
+ spec = eval(File.read("chef-win32-api.gemspec"))
25
+
26
+ def configure_cross_compilation(ext)
27
+ unless RUBY_PLATFORM =~ /mswin|mingw/
28
+ ext.cross_compile = true
29
+ ext.cross_platform = ['x64-mingw32', 'x64-mingw-ucrt']
30
+ end
31
+ end
32
+
33
+ Rake::ExtensionTask.new('win32/api', spec) do |ext|
34
+ ext.ext_dir = 'ext/win32'
35
+ ext.lib_dir = 'lib/win32'
36
+ configure_cross_compilation(ext)
37
+ end
38
+
39
+ namespace 'test' do
40
+ Rake::TestTask.new(:all) do |test|
41
+ test.libs << 'test'
42
+ test.libs << 'lib'
43
+ test.warning = true
44
+ test.verbose = true
45
+ end
46
+
47
+ Rake::TestTask.new(:callback) do |test|
48
+ test.test_files = FileList['test/test_win32_api_callback.rb']
49
+ test.libs << 'test'
50
+ test.libs << 'lib'
51
+ test.warning = true
52
+ test.verbose = true
53
+ end
54
+
55
+ Rake::TestTask.new(:function) do |test|
56
+ test.test_files = FileList['test/test_win32_api_function.rb']
57
+ test.libs << 'ext'
58
+ test.warning = true
59
+ test.verbose = true
60
+ end
61
+ end
62
+
63
+ task :default => %w(clobber compile test:all)
data/appveyor.yml ADDED
@@ -0,0 +1,35 @@
1
+ version: '{build}'
2
+
3
+ image: Visual Studio 2019
4
+
5
+ init:
6
+ # use a minimal path
7
+ - set PATH=C:\ruby%ruby_version%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32
8
+ # Load ruby trunk build
9
+ - if %ruby_version%==_trunk (
10
+ appveyor DownloadFile https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z -FileName C:\ruby_trunk.7z &
11
+ 7z x C:\ruby_trunk.7z -oC:\ruby_trunk
12
+ )
13
+
14
+ platform: x64
15
+
16
+ install:
17
+ - set SSL_CERT_FILE=C:/ruby31-x64/ssl/cert.pem
18
+ - ruby --version
19
+ - gem --version
20
+ # Assume we can use the version of bundler that Appveyor has packaged with each ruby version
21
+ - bundle install
22
+
23
+ build: off
24
+
25
+ test_script:
26
+ - rake -rdevkit
27
+
28
+ environment:
29
+ matrix:
30
+ - ruby_version: 30-x64
31
+ - ruby_version: 31-x64
32
+
33
+ matrix:
34
+ allow_failures:
35
+ - ruby_version: _trunk
data/build-gem.bat ADDED
@@ -0,0 +1,3 @@
1
+ git clone https://github.com/cosmo0920/win32-api win32-api
2
+ cd win32-api
3
+ rake -rdevkit gem:binary
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'chef-win32-api'
5
+ spec.version = '1.11.0'
6
+ spec.authors = ['Daniel J. Berger', 'Park Heesob', 'Hiroshi Hatake']
7
+ spec.license = 'Artistic-2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'http://github.com/cosmo0920/win32-api'
10
+ spec.summary = 'A superior replacement for Win32API'
11
+ spec.test_files = Dir['test/test*']
12
+ spec.extensions = ['ext/win32/extconf.rb']
13
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
14
+
15
+ if RUBY_VERSION.match?("3.0")
16
+ spec.required_ruby_version = '~> 3.0'
17
+ else
18
+ spec.required_ruby_version = '>= 3.1.6'
19
+ end
20
+
21
+ spec.extra_rdoc_files = ['CHANGES', 'MANIFEST', 'ext/win32/api.c']
22
+
23
+ spec.add_development_dependency('test-unit', '>= 3.6.7')
24
+ spec.add_development_dependency('rake')
25
+ spec.add_development_dependency("rake-compiler", ">= 1.2.9")
26
+
27
+ spec.description = <<-EOF
28
+ The Win32::API library is meant as a replacement for the Win32API
29
+ library that ships as part of the standard library. It contains several
30
+ advantages over Win32API, including callback support, raw function
31
+ pointers, an additional string type, and more.
32
+ EOF
33
+ end