mkmf-lite 0.3.0 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b09c774e9b8a62f9c17fc3bddb1a3f5031aec85456258ff557dbd7945897a029
4
- data.tar.gz: 1f278b056338594d68a3bcc6d3a2b61730fc91acca58826335119c34d9736298
3
+ metadata.gz: fb7fbb52c76d52fa9c2bced3b3c0927b2ba925286dd782816be821d8ee7bfaff
4
+ data.tar.gz: 599dfa3155156bffc37448faf50dd75cf9c8f9712d776572227262796664b0d0
5
5
  SHA512:
6
- metadata.gz: 05766eb2658383495265b925361943902dacdab84e8fd88c514ec1b4797f0deb3569e9f82462a8f84ddcd42bd90a0840e0c4384d8f1e60a0403fa10d376d3ab5
7
- data.tar.gz: b919b4924fd50ac8137c1d76bbb613c3c66f243f9c51c162473377c9b790a66aa263ef86662e87740c59a99fa08d853c3ddb701e41dde438503e972cc445ff14
6
+ metadata.gz: 4b62df8f8e130e286f9bade23825c67a6fc3989e543080785afba148919fe6dc0bd7fdef36421922ecb81a43c80c5fcb2b924aae13eba4b663d063538c5c4b38
7
+ data.tar.gz: 8188ae2ad183dc8113fbc4d3a86c72bc62eeb1efa587472a9bfd2f41f8d0edfcdb26576c909cdf58ba2f616bfd81db6fa96731c4353f8eef08ca7450416b2ae4
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,22 +1,40 @@
1
- = 0.3.0 - 6-Jan-2019
1
+ == 0.4.2 - 31-Aug-2020
2
+ * Did I say I didn't need ptools? Well I was wrong. It's back.
3
+
4
+ == 0.4.1 - 31-Aug-2020
5
+ * Removed the ptools dependency, just use IO::NULL.
6
+
7
+ == 0.4.0 - 4-Jul-2020
8
+ * Replaced test-unit with rspec, rewrote the tests, and made relevant
9
+ changes to the gemspec, etc.
10
+ * Pinned the ptools version to 1.3.x.
11
+
12
+ == 0.3.2 - 19-Mar-2020
13
+ * Properly include a LICENSE file as per the Apache-2.0 license.
14
+
15
+ == 0.3.1 - 11-Dec-2019
16
+ * Added .rdoc extension to various text files so that they render more nicely
17
+ on github.
18
+
19
+ == 0.3.0 - 6-Jan-2019
2
20
  * Changed license to Apache-2.0.
3
21
  * Replaced class variables with methods.
4
22
  * Updated cert.
5
23
 
6
- = 0.2.6 - 6-Sep-2015
24
+ == 0.2.6 - 6-Sep-2015
7
25
  * Added an mkmf-lite.rb file for convenience.
8
26
  * Assume Rubygems 2.x.
9
27
  * This gem is now signed.
10
28
 
11
- = 0.2.5 - 2-Oct-2014
29
+ == 0.2.5 - 2-Oct-2014
12
30
  * The CC command for mingw now defaults to searching your path rather than
13
31
  relying on an environment variable because it wasn't trustworthy.
14
32
  * Updated the gem:install task for Rubygems 2.x.
15
33
 
16
- = 0.2.4 - 7-Mar-2013
34
+ == 0.2.4 - 7-Mar-2013
17
35
  * The have_header method now accepts an optional list of directories to search.
18
36
 
19
- = 0.2.3 - 25-Apr-2012
37
+ == 0.2.3 - 25-Apr-2012
20
38
  * No longer assumes mingw/gcc on Windows. Now passes all tests with a
21
39
  version of Ruby compiled with MSVC++.
22
40
  * Eliminate Config vs RbConfig warnings in 1.9.3.
@@ -24,17 +42,17 @@
24
42
  result in unwanted output.
25
43
  * Upgraded test-unit prerequisite to 2.4.0 or later.
26
44
 
27
- = 0.2.2 - 6-Dec-2011
45
+ == 0.2.2 - 6-Dec-2011
28
46
  * Added the check_sizeof method.
29
47
  * If CONFIG['COMMON_HEADERS'] is blank then stdio.h and stdlib.h are
30
48
  used instead. On MS Windows the windows.h header is also used.
31
49
 
32
- = 0.2.1 - 21-Jan-2011
50
+ == 0.2.1 - 21-Jan-2011
33
51
  * Minor platform detection adjustments for MS Windows.
34
52
 
35
- = 0.2.0 - 8-Jun-2010
53
+ == 0.2.0 - 8-Jun-2010
36
54
  * Now works properly with JRuby (though it still requires a compiler
37
55
  somewhere on your system).
38
56
 
39
- = 0.1.0 - 24-May-2010
57
+ == 0.1.0 - 24-May-2010
40
58
  * Initial release.
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -1,5 +1,6 @@
1
- * CHANGES
2
- * MANIFEST
1
+ * CHANGES.rdoc
2
+ * LICENSE
3
+ * MANIFEST.rdoc
3
4
  * Rakefile
4
5
  * mkmf-lite.gemspec
5
6
  * certs/djberg96_pub.pem
@@ -8,4 +9,4 @@
8
9
  * lib/mkmf/templates/have_func_pointer.erb
9
10
  * lib/mkmf/templates/have_header.erb
10
11
  * lib/mkmf/templates/have_struct_member.erb
11
- * test/test_mkmf_lite.rb
12
+ * spec/mkmf_lite_spec.rb
@@ -0,0 +1,59 @@
1
+ == Summary
2
+ A light version of mkmf designed for use within programs.
3
+
4
+ == Installation
5
+ gem install mkmf-lite
6
+
7
+ == Prerequisites
8
+ A C compiler somewhere on your system.
9
+
10
+ == Synopsis
11
+ require 'mkmf/lite'
12
+
13
+ class System
14
+ extend Mkmf::Lite
15
+
16
+ HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
17
+
18
+ def some_method
19
+ if HAVE_PW_NAME
20
+ # Do something
21
+ end
22
+ end
23
+ end
24
+
25
+ == Description
26
+ The mkmf library that ships as part of the Ruby standard library is not
27
+ meant for use as an internal library. It's strictly designed for building
28
+ C extensions. It's huge, its methods sit in a global namespace, it contains
29
+ many methods you don't care about, and it emits stuff to $stdout that cannot
30
+ easily be disabled. Also, the source code is monstrous.
31
+
32
+ The mkmf-lite library is a module, it's small, and it's designed to be mixed
33
+ into classes. It contains a handful of methods that, most likely, will be
34
+ used in conjunction with FFI. Also, the source code is quite readable.
35
+
36
+ It does not package C extensions, nor generate a log file or a Makefile. It
37
+ does, however, require that you have a C compiler somewhere on your system.
38
+
39
+ == Known Issues
40
+ You may see this warning from JRuby 1.4.x and earlier:
41
+
42
+ warning: Useless use of a variable in void context.
43
+
44
+ You can ignore these (or, upgrade your Jruby).
45
+
46
+ == License
47
+ Apache-2.0
48
+
49
+ == Copyright
50
+ (C) 2010-2020 Daniel J. Berger
51
+ All Rights Reserved
52
+
53
+ == Warranty
54
+ This library is provided "as is" and without any express or
55
+ implied warranties, including, without limitation, the implied
56
+ warranties of merchantability and fitness for a particular purpose.
57
+
58
+ == Author
59
+ Daniel Berger
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
4
 
5
5
  CLEAN.include("**/*.gem", "**/*.rbc")
6
6
 
@@ -20,9 +20,7 @@ namespace 'gem' do
20
20
  end
21
21
  end
22
22
 
23
- Rake::TestTask.new do |t|
24
- t.verbose = true
25
- t.warning = true
26
- end
23
+ desc "Run the test suite"
24
+ RSpec::Core::RakeTask.new(:spec)
27
25
 
28
- task :default => :test
26
+ task :default => :spec
@@ -1,13 +1,13 @@
1
1
  require 'erb'
2
2
  require 'rbconfig'
3
3
  require 'tmpdir'
4
- require 'ptools'
5
4
  require 'open3'
5
+ require 'ptools'
6
6
 
7
7
  module Mkmf
8
8
  module Lite
9
9
  # The version of the mkmf-lite library
10
- MKMF_LITE_VERSION = '0.3.0'.freeze
10
+ MKMF_LITE_VERSION = '0.4.2'.freeze
11
11
 
12
12
  private
13
13
 
@@ -171,8 +171,8 @@ module Mkmf
171
171
  command += cpp_source_file
172
172
 
173
173
  # Temporarily close these
174
- $stderr.reopen(File.null)
175
- $stdout.reopen(File.null)
174
+ $stderr.reopen(IO::NULL)
175
+ $stdout.reopen(IO::NULL)
176
176
 
177
177
  if system(command)
178
178
  $stdout.reopen(stdout_orig) # We need this back for open3 to work.
@@ -223,8 +223,8 @@ module Mkmf
223
223
  command += cpp_out_file + ' '
224
224
  command += cpp_source_file
225
225
 
226
- $stderr.reopen(File.null)
227
- $stdout.reopen(File.null)
226
+ $stderr.reopen(IO::NULL)
227
+ $stdout.reopen(IO::NULL)
228
228
  boolean = system(command)
229
229
  }
230
230
  ensure
@@ -3,24 +3,24 @@ require 'rubygems'
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'mkmf-lite'
5
5
  spec.summary = 'A lighter version of mkmf designed for use as a library'
6
- spec.version = '0.3.0'
6
+ spec.version = '0.4.2'
7
7
  spec.author = 'Daniel J. Berger'
8
8
  spec.license = 'Apache-2.0'
9
9
  spec.email = 'djberg96@gmail.com'
10
10
  spec.homepage = 'http://github.com/djberg96/mkmf-lite'
11
- spec.test_file = 'test/test_mkmf_lite.rb'
11
+ spec.test_file = 'spec/mkmf_lite_spec.rb'
12
12
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
13
  spec.cert_chain = ['certs/djberg96_pub.pem']
14
14
 
15
- spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
15
+ spec.extra_rdoc_files = Dir['*.rdoc']
16
16
 
17
- spec.add_dependency('ptools')
18
- spec.add_development_dependency('test-unit', '>= 2.4.0')
17
+ spec.add_dependency('ptools', '~> 1.4')
18
+ spec.add_development_dependency('rspec', '~> 3.9')
19
19
 
20
20
  spec.metadata = {
21
21
  'homepage_uri' => 'https://github.com/djberg96/mkmf-lite',
22
22
  'bug_tracker_uri' => 'https://github.com/djberg96/mkmf-lite/issues',
23
- 'changelog_uri' => 'https://github.com/djberg96/mkmf-lite/blob/master/CHANGES',
23
+ 'changelog_uri' => 'https://github.com/djberg96/mkmf-lite/blob/master/CHANGES.rdoc',
24
24
  'documentation_uri' => 'https://github.com/djberg96/mkmf-lite/wiki',
25
25
  'source_code_uri' => 'https://github.com/djberg96/mkmf-lite',
26
26
  'wiki_uri' => 'https://github.com/djberg96/mkmf-lite/wiki'
@@ -0,0 +1,111 @@
1
+ ########################################################################
2
+ # mkmf_lite_spec.rb
3
+ #
4
+ # Tests for the mkmf-lite library.
5
+ ########################################################################
6
+ require 'rubygems'
7
+ require 'rspec'
8
+ require 'mkmf/lite'
9
+
10
+ describe Mkmf::Lite do
11
+ subject { Class.new{ |obj| obj.extend Mkmf::Lite } }
12
+
13
+ let(:st_type) { 'struct stat' }
14
+ let(:st_member) { 'st_uid' }
15
+ let(:st_header) { 'sys/stat.h' }
16
+
17
+ describe "constants" do
18
+ example "version information" do
19
+ expect(described_class::MKMF_LITE_VERSION).to eq('0.4.2')
20
+ expect(described_class::MKMF_LITE_VERSION).to be_frozen
21
+ end
22
+ end
23
+
24
+ describe "have_header" do
25
+ example "have_header basic functionality" do
26
+ expect(subject).to respond_to(:have_header)
27
+ end
28
+
29
+ example "have_header returns expected boolean value" do
30
+ expect(subject.have_header('stdio.h')).to eq(true)
31
+ expect(subject.have_header('foobar.h')).to eq(false)
32
+ end
33
+
34
+ example "have_header accepts an array of directories as a second argument" do
35
+ expect{ subject.have_header('stdio.h', '/usr/local/include') }.not_to raise_error
36
+ expect{ subject.have_header('stdio.h', '/usr/local/include', '/usr/include') }.not_to raise_error
37
+ end
38
+ end
39
+
40
+ context "have_func" do
41
+ example "have_func basic functionality" do
42
+ expect(subject).to respond_to(:have_func)
43
+ end
44
+
45
+ example "have_func with no arguments returns expected boolean value" do
46
+ expect(subject.have_func('abort')).to eq(true)
47
+ expect(subject.have_func('abortxyz')).to eq(false)
48
+ end
49
+
50
+ example "have_func with arguments returns expected boolean value" do
51
+ expect(subject.have_func('printf', 'stdio.h')).to eq(true)
52
+ expect(subject.have_func('printfx', 'stdio.h')).to eq(false)
53
+ end
54
+
55
+ example "have_func requires at least one argument" do
56
+ expect{ subject.have_func }.to raise_error(ArgumentError)
57
+ end
58
+
59
+ example "have_func accepts a maximum of two arguments" do
60
+ expect{ subject.have_func('printf', 'stdio.h', 'bogus') }.to raise_error(ArgumentError)
61
+ end
62
+ end
63
+
64
+ context "have_struct_member" do
65
+ example "have_struct_member basic functionality" do
66
+ expect(subject).to respond_to(:have_struct_member)
67
+ end
68
+
69
+ example "have_struct_member returns expected boolean value" do
70
+ expect(subject.have_struct_member(st_type, st_member, st_header)).to eq(true)
71
+ expect(subject.have_struct_member(st_type, 'pw_bogus', st_header)).to eq(false)
72
+ expect(subject.have_struct_member(st_type, st_member)).to eq(false)
73
+ end
74
+
75
+ example "have_struct_member requires at least two arguments" do
76
+ expect{ subject.have_struct_member() }.to raise_error(ArgumentError)
77
+ expect{ subject.have_struct_member('struct passwd') }.to raise_error(ArgumentError)
78
+ end
79
+
80
+ example "have_struct_member accepts a maximum of three arguments" do
81
+ expect{ subject.have_struct_member('struct passwd', 'pw_name', 'pwd.h', true) }.to raise_error(ArgumentError)
82
+ end
83
+ end
84
+
85
+ context "check_sizeof" do
86
+ example "check_sizeof basic functionality" do
87
+ expect(subject).to respond_to(:check_sizeof)
88
+ expect{ subject.check_sizeof(st_type, st_header) }.not_to raise_error
89
+ end
90
+
91
+ example "check_sizeof requires at least one argument" do
92
+ expect{ subject.check_sizeof }.to raise_error(ArgumentError)
93
+ expect{ subject.check_sizeof('struct passwd', 'pw_name', 1) }.to raise_error(ArgumentError)
94
+ end
95
+
96
+ example "check_sizeof accepts a maximum of two arguments" do
97
+ expect{ subject.check_sizeof('div_t', 'stdlib.h', 1) }.to raise_error(ArgumentError)
98
+ end
99
+
100
+ example "check_sizeof works with one or two arguments" do
101
+ expect{ subject.check_sizeof('div_t') }.not_to raise_error
102
+ expect{ subject.check_sizeof('div_t', 'stdlib.h') }.not_to raise_error
103
+ end
104
+
105
+ example "check_sizeof returns an integer value" do
106
+ size = subject.check_sizeof(st_type, st_header)
107
+ expect(size).to be_kind_of(Integer)
108
+ expect(size).to be > 0
109
+ end
110
+ end
111
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mkmf-lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,36 +35,36 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date: 2019-01-08 00:00:00.000000000 Z
38
+ date: 2020-08-31 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ptools
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '1.4'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.4'
54
54
  - !ruby/object:Gem::Dependency
55
- name: test-unit
55
+ name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 2.4.0
60
+ version: '3.9'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 2.4.0
67
+ version: '3.9'
68
68
  description: |2
69
69
  The mkmf-lite library is a light version of the the mkmf library
70
70
  designed for use as a library. It does not create packages, builds,
@@ -75,13 +75,14 @@ email: djberg96@gmail.com
75
75
  executables: []
76
76
  extensions: []
77
77
  extra_rdoc_files:
78
- - CHANGES
79
- - README
80
- - MANIFEST
78
+ - CHANGES.rdoc
79
+ - MANIFEST.rdoc
80
+ - README.rdoc
81
81
  files:
82
- - CHANGES
83
- - MANIFEST
84
- - README
82
+ - CHANGES.rdoc
83
+ - LICENSE
84
+ - MANIFEST.rdoc
85
+ - README.rdoc
85
86
  - Rakefile
86
87
  - certs/djberg96_pub.pem
87
88
  - lib/mkmf-lite.rb
@@ -92,18 +93,18 @@ files:
92
93
  - lib/mkmf/templates/have_header.erb
93
94
  - lib/mkmf/templates/have_struct_member.erb
94
95
  - mkmf-lite.gemspec
95
- - test/test_mkmf_lite.rb
96
+ - spec/mkmf_lite_spec.rb
96
97
  homepage: http://github.com/djberg96/mkmf-lite
97
98
  licenses:
98
99
  - Apache-2.0
99
100
  metadata:
100
101
  homepage_uri: https://github.com/djberg96/mkmf-lite
101
102
  bug_tracker_uri: https://github.com/djberg96/mkmf-lite/issues
102
- changelog_uri: https://github.com/djberg96/mkmf-lite/blob/master/CHANGES
103
+ changelog_uri: https://github.com/djberg96/mkmf-lite/blob/master/CHANGES.rdoc
103
104
  documentation_uri: https://github.com/djberg96/mkmf-lite/wiki
104
105
  source_code_uri: https://github.com/djberg96/mkmf-lite
105
106
  wiki_uri: https://github.com/djberg96/mkmf-lite/wiki
106
- post_install_message:
107
+ post_install_message:
107
108
  rdoc_options: []
108
109
  require_paths:
109
110
  - lib
@@ -118,10 +119,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.7.6
123
- signing_key:
122
+ rubygems_version: 3.1.4
123
+ signing_key:
124
124
  specification_version: 4
125
125
  summary: A lighter version of mkmf designed for use as a library
126
126
  test_files:
127
- - test/test_mkmf_lite.rb
127
+ - spec/mkmf_lite_spec.rb
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1,59 +0,0 @@
1
- == Summary
2
- A light version of mkmf designed for use within programs.
3
-
4
- == Installation
5
- gem install mkmf-lite
6
-
7
- == Prerequisites
8
- A C compiler somewhere on your system.
9
-
10
- == Synopsis
11
- require 'mkmf/lite'
12
-
13
- class System
14
- extend Mkmf::Lite
15
-
16
- HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
17
-
18
- def some_method
19
- if HAVE_PW_NAME
20
- # Do something
21
- end
22
- end
23
- end
24
-
25
- == Description
26
- The mkmf library that ships as part of the Ruby standard library is not
27
- meant for use as an internal library. It's strictly designed for building
28
- C extensions. It's huge, its methods sit in a global namespace, it contains
29
- many methods you don't care about, and it emits stuff to $stdout that cannot
30
- easily be disabled. Also, the source code is monstrous.
31
-
32
- The mkmf-lite library is a module, it's small, and it's designed to be mixed
33
- into classes. It contains a handful of methods that, most likely, will be
34
- used in conjunction with FFI. Also, the source code is quite readable.
35
-
36
- It does not package C extensions, nor generate a log file or a Makefile. It
37
- does, however, require that you have a C compiler somewhere on your system.
38
-
39
- == Known Issues
40
- You may see this warning from JRuby 1.4.x and earlier:
41
-
42
- warning: Useless use of a variable in void context.
43
-
44
- You can ignore these (or, upgrade your Jruby).
45
-
46
- == License
47
- Apache-2.0
48
-
49
- == Copyright
50
- (C) 2010-2019 Daniel J. Berger
51
- All Rights Reserved
52
-
53
- == Warranty
54
- This library is provided "as is" and without any express or
55
- implied warranties, including, without limitation, the implied
56
- warranties of merchantability and fitness for a particular purpose.
57
-
58
- == Author
59
- Daniel Berger
@@ -1,119 +0,0 @@
1
- ########################################################################
2
- # test_mkmf_lite.rb
3
- #
4
- # Tests for the mkmf-lite library.
5
- ########################################################################
6
- require 'rubygems'
7
- require 'test-unit'
8
- require 'mkmf/lite'
9
-
10
- class TC_Mkmf_Lite < Test::Unit::TestCase
11
- include Mkmf::Lite
12
-
13
- def self.startup
14
- @@windows = File::ALT_SEPARATOR
15
- end
16
-
17
- def setup
18
- @st_type = 'struct stat'
19
- @st_member = 'st_uid'
20
- @st_header = 'sys/stat.h'
21
- end
22
-
23
- test "version information" do
24
- assert_equal('0.3.0', MKMF_LITE_VERSION)
25
- assert_true(MKMF_LITE_VERSION.frozen?)
26
- end
27
-
28
- test "have_header basic functionality" do
29
- assert_respond_to(self, :have_header)
30
- end
31
-
32
- test "have_header returns expected boolean value" do
33
- assert_true(have_header('stdio.h'))
34
- assert_false(have_header('foobar.h'))
35
- end
36
-
37
- test "have_header accepts an array of directories as a second argument" do
38
- assert_nothing_raised{ have_header('stdio.h', '/usr/local/include') }
39
- assert_nothing_raised{ have_header('stdio.h', '/usr/local/include', '/usr/include') }
40
- end
41
-
42
- test "have_func basic functionality" do
43
- assert_respond_to(self, :have_func)
44
- end
45
-
46
- test "have_func with no arguments returns expected boolean value" do
47
- assert_true(have_func('abort'))
48
- assert_false(have_func('abortxyz'))
49
- end
50
-
51
- test "have_func with arguments returns expected boolean value" do
52
- assert_true(have_func('printf', 'stdio.h'))
53
- assert_false(have_func('printfx', 'stdio.h'))
54
- end
55
-
56
- test "have_func requires at least one argument" do
57
- assert_raise(ArgumentError){ have_func }
58
- end
59
-
60
- test "have_func accepts a maximum of two arguments" do
61
- assert_raise(ArgumentError){ have_func('printf', 'stdio.h', 'bogus') }
62
- end
63
-
64
- test "have_struct_member basic functionality" do
65
- assert_respond_to(self, :have_struct_member)
66
- end
67
-
68
- test "have_struct_member returns expected boolean value" do
69
- assert_true(have_struct_member(@st_type, @st_member, @st_header))
70
- assert_false(have_struct_member(@st_type, 'pw_bogus', @st_header))
71
- assert_false(have_struct_member(@st_type, @st_member))
72
- end
73
-
74
- test "have_struct_member requires at least two arguments" do
75
- assert_raise(ArgumentError){ have_struct_member() }
76
- assert_raise(ArgumentError){ have_struct_member('struct passwd') }
77
- end
78
-
79
- test "have_struct_member accepts a maximum of three arguments" do
80
- assert_raise(ArgumentError){
81
- have_struct_member('struct passwd', 'pw_name', 'pwd.h', true)
82
- }
83
- end
84
-
85
- test "check_sizeof basic functionality" do
86
- assert_respond_to(self, :check_sizeof)
87
- assert_nothing_raised{ check_sizeof(@st_type, @st_header) }
88
- end
89
-
90
- test "check_sizeof requires at least one argument" do
91
- assert_raise(ArgumentError){ check_sizeof }
92
- assert_raise(ArgumentError){ check_sizeof('struct passwd', 'pw_name', 1) }
93
- end
94
-
95
- test "check_sizeof accepts a maximum of two arguments" do
96
- assert_raise(ArgumentError){ check_sizeof('div_t', 'stdlib.h', 1) }
97
- end
98
-
99
- test "check_sizeof works with one or two arguments" do
100
- assert_nothing_raised{ check_sizeof('div_t') }
101
- assert_nothing_raised{ check_sizeof('div_t', 'stdlib.h') }
102
- end
103
-
104
- test "check_sizeof returns an integer value" do
105
- size = check_sizeof(@st_type, @st_header)
106
- assert_kind_of(Integer, size)
107
- assert_true(size > 0)
108
- end
109
-
110
- def teardown
111
- @st_type = nil
112
- @st_member = nil
113
- @st_header = nil
114
- end
115
-
116
- def self.shutdown
117
- @@windows = nil
118
- end
119
- end