go_version 1.6.0 → 1.7.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +355 -0
- data/README.md +18 -0
- data/ext/Makefile +7 -0
- data/ext/extconf.rb +8 -0
- data/ext/go.mod +5 -0
- data/ext/go.sum +2 -0
- data/ext/main.go +64 -0
- data/lib/go_version/version.rb +3 -0
- data/lib/go_version/wrapper.rb +6 -1
- data/{ext/go-version → lib}/go_version.h +21 -1
- data/lib/go_version.rb +15 -0
- data/lib/go_version.so +0 -0
- metadata +34 -18
- data/ext/go-version/Makefile +0 -270
- data/ext/go-version/extconf.rb +0 -22
- data/ext/go-version/go.mod +0 -5
- data/ext/go-version/go.sum +0 -2
- data/ext/go-version/main.go +0 -24
- data/ext/go-version/mkmf.log +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4a20269713bd2b8af6e9b16eb05c101ee092f45eab091cf17ec9922092006cc
|
4
|
+
data.tar.gz: c53b00491c99dff70b239b9d1463fc44f006e5f31a5905a2c43d8285819e458b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7009b1678e4e3b4dde6137dfd721d1e323b3167ad79c4ad5897a5b9c046326cdde3ae64a6337eeaec1ea57c74f00fb0e7e90f8a5db8743aeb792a36d85179f8b
|
7
|
+
data.tar.gz: 668c105a8aa043e92964cf5532b131ef8bb3dd6923ed75eb4bf89f4182e4fb103139891eb5a0cfe061212e6bca8264bbc86e609a5bc76974a95defe245a5f52b
|
data/LICENSE
ADDED
@@ -0,0 +1,355 @@
|
|
1
|
+
Copyright (c) 2024 Brandon Croft
|
2
|
+
|
3
|
+
Mozilla Public License, version 2.0
|
4
|
+
|
5
|
+
1. Definitions
|
6
|
+
|
7
|
+
1.1. “Contributor”
|
8
|
+
|
9
|
+
means each individual or legal entity that creates, contributes to the
|
10
|
+
creation of, or owns Covered Software.
|
11
|
+
|
12
|
+
1.2. “Contributor Version”
|
13
|
+
|
14
|
+
means the combination of the Contributions of others (if any) used by a
|
15
|
+
Contributor and that particular Contributor’s Contribution.
|
16
|
+
|
17
|
+
1.3. “Contribution”
|
18
|
+
|
19
|
+
means Covered Software of a particular Contributor.
|
20
|
+
|
21
|
+
1.4. “Covered Software”
|
22
|
+
|
23
|
+
means Source Code Form to which the initial Contributor has attached the
|
24
|
+
notice in Exhibit A, the Executable Form of such Source Code Form, and
|
25
|
+
Modifications of such Source Code Form, in each case including portions
|
26
|
+
thereof.
|
27
|
+
|
28
|
+
1.5. “Incompatible With Secondary Licenses”
|
29
|
+
means
|
30
|
+
|
31
|
+
a. that the initial Contributor has attached the notice described in
|
32
|
+
Exhibit B to the Covered Software; or
|
33
|
+
|
34
|
+
b. that the Covered Software was made available under the terms of version
|
35
|
+
1.1 or earlier of the License, but not also under the terms of a
|
36
|
+
Secondary License.
|
37
|
+
|
38
|
+
1.6. “Executable Form”
|
39
|
+
|
40
|
+
means any form of the work other than Source Code Form.
|
41
|
+
|
42
|
+
1.7. “Larger Work”
|
43
|
+
|
44
|
+
means a work that combines Covered Software with other material, in a separate
|
45
|
+
file or files, that is not Covered Software.
|
46
|
+
|
47
|
+
1.8. “License”
|
48
|
+
|
49
|
+
means this document.
|
50
|
+
|
51
|
+
1.9. “Licensable”
|
52
|
+
|
53
|
+
means having the right to grant, to the maximum extent possible, whether at the
|
54
|
+
time of the initial grant or subsequently, any and all of the rights conveyed by
|
55
|
+
this License.
|
56
|
+
|
57
|
+
1.10. “Modifications”
|
58
|
+
|
59
|
+
means any of the following:
|
60
|
+
|
61
|
+
a. any file in Source Code Form that results from an addition to, deletion
|
62
|
+
from, or modification of the contents of Covered Software; or
|
63
|
+
|
64
|
+
b. any new file in Source Code Form that contains any Covered Software.
|
65
|
+
|
66
|
+
1.11. “Patent Claims” of a Contributor
|
67
|
+
|
68
|
+
means any patent claim(s), including without limitation, method, process,
|
69
|
+
and apparatus claims, in any patent Licensable by such Contributor that
|
70
|
+
would be infringed, but for the grant of the License, by the making,
|
71
|
+
using, selling, offering for sale, having made, import, or transfer of
|
72
|
+
either its Contributions or its Contributor Version.
|
73
|
+
|
74
|
+
1.12. “Secondary License”
|
75
|
+
|
76
|
+
means either the GNU General Public License, Version 2.0, the GNU Lesser
|
77
|
+
General Public License, Version 2.1, the GNU Affero General Public
|
78
|
+
License, Version 3.0, or any later versions of those licenses.
|
79
|
+
|
80
|
+
1.13. “Source Code Form”
|
81
|
+
|
82
|
+
means the form of the work preferred for making modifications.
|
83
|
+
|
84
|
+
1.14. “You” (or “Your”)
|
85
|
+
|
86
|
+
means an individual or a legal entity exercising rights under this
|
87
|
+
License. For legal entities, “You” includes any entity that controls, is
|
88
|
+
controlled by, or is under common control with You. For purposes of this
|
89
|
+
definition, “control” means (a) the power, direct or indirect, to cause
|
90
|
+
the direction or management of such entity, whether by contract or
|
91
|
+
otherwise, or (b) ownership of more than fifty percent (50%) of the
|
92
|
+
outstanding shares or beneficial ownership of such entity.
|
93
|
+
|
94
|
+
|
95
|
+
2. License Grants and Conditions
|
96
|
+
|
97
|
+
2.1. Grants
|
98
|
+
|
99
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
100
|
+
non-exclusive license:
|
101
|
+
|
102
|
+
a. under intellectual property rights (other than patent or trademark)
|
103
|
+
Licensable by such Contributor to use, reproduce, make available,
|
104
|
+
modify, display, perform, distribute, and otherwise exploit its
|
105
|
+
Contributions, either on an unmodified basis, with Modifications, or as
|
106
|
+
part of a Larger Work; and
|
107
|
+
|
108
|
+
b. under Patent Claims of such Contributor to make, use, sell, offer for
|
109
|
+
sale, have made, import, and otherwise transfer either its Contributions
|
110
|
+
or its Contributor Version.
|
111
|
+
|
112
|
+
2.2. Effective Date
|
113
|
+
|
114
|
+
The licenses granted in Section 2.1 with respect to any Contribution become
|
115
|
+
effective for each Contribution on the date the Contributor first distributes
|
116
|
+
such Contribution.
|
117
|
+
|
118
|
+
2.3. Limitations on Grant Scope
|
119
|
+
|
120
|
+
The licenses granted in this Section 2 are the only rights granted under this
|
121
|
+
License. No additional rights or licenses will be implied from the distribution
|
122
|
+
or licensing of Covered Software under this License. Notwithstanding Section
|
123
|
+
2.1(b) above, no patent license is granted by a Contributor:
|
124
|
+
|
125
|
+
a. for any code that a Contributor has removed from Covered Software; or
|
126
|
+
|
127
|
+
b. for infringements caused by: (i) Your and any other third party’s
|
128
|
+
modifications of Covered Software, or (ii) the combination of its
|
129
|
+
Contributions with other software (except as part of its Contributor
|
130
|
+
Version); or
|
131
|
+
|
132
|
+
c. under Patent Claims infringed by Covered Software in the absence of its
|
133
|
+
Contributions.
|
134
|
+
|
135
|
+
This License does not grant any rights in the trademarks, service marks, or
|
136
|
+
logos of any Contributor (except as may be necessary to comply with the
|
137
|
+
notice requirements in Section 3.4).
|
138
|
+
|
139
|
+
2.4. Subsequent Licenses
|
140
|
+
|
141
|
+
No Contributor makes additional grants as a result of Your choice to
|
142
|
+
distribute the Covered Software under a subsequent version of this License
|
143
|
+
(see Section 10.2) or under the terms of a Secondary License (if permitted
|
144
|
+
under the terms of Section 3.3).
|
145
|
+
|
146
|
+
2.5. Representation
|
147
|
+
|
148
|
+
Each Contributor represents that the Contributor believes its Contributions
|
149
|
+
are its original creation(s) or it has sufficient rights to grant the
|
150
|
+
rights to its Contributions conveyed by this License.
|
151
|
+
|
152
|
+
2.6. Fair Use
|
153
|
+
|
154
|
+
This License is not intended to limit any rights You have under applicable
|
155
|
+
copyright doctrines of fair use, fair dealing, or other equivalents.
|
156
|
+
|
157
|
+
2.7. Conditions
|
158
|
+
|
159
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
|
160
|
+
Section 2.1.
|
161
|
+
|
162
|
+
|
163
|
+
3. Responsibilities
|
164
|
+
|
165
|
+
3.1. Distribution of Source Form
|
166
|
+
|
167
|
+
All distribution of Covered Software in Source Code Form, including any
|
168
|
+
Modifications that You create or to which You contribute, must be under the
|
169
|
+
terms of this License. You must inform recipients that the Source Code Form
|
170
|
+
of the Covered Software is governed by the terms of this License, and how
|
171
|
+
they can obtain a copy of this License. You may not attempt to alter or
|
172
|
+
restrict the recipients’ rights in the Source Code Form.
|
173
|
+
|
174
|
+
3.2. Distribution of Executable Form
|
175
|
+
|
176
|
+
If You distribute Covered Software in Executable Form then:
|
177
|
+
|
178
|
+
a. such Covered Software must also be made available in Source Code Form,
|
179
|
+
as described in Section 3.1, and You must inform recipients of the
|
180
|
+
Executable Form how they can obtain a copy of such Source Code Form by
|
181
|
+
reasonable means in a timely manner, at a charge no more than the cost
|
182
|
+
of distribution to the recipient; and
|
183
|
+
|
184
|
+
b. You may distribute such Executable Form under the terms of this License,
|
185
|
+
or sublicense it under different terms, provided that the license for
|
186
|
+
the Executable Form does not attempt to limit or alter the recipients’
|
187
|
+
rights in the Source Code Form under this License.
|
188
|
+
|
189
|
+
3.3. Distribution of a Larger Work
|
190
|
+
|
191
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
192
|
+
provided that You also comply with the requirements of this License for the
|
193
|
+
Covered Software. If the Larger Work is a combination of Covered Software
|
194
|
+
with a work governed by one or more Secondary Licenses, and the Covered
|
195
|
+
Software is not Incompatible With Secondary Licenses, this License permits
|
196
|
+
You to additionally distribute such Covered Software under the terms of
|
197
|
+
such Secondary License(s), so that the recipient of the Larger Work may, at
|
198
|
+
their option, further distribute the Covered Software under the terms of
|
199
|
+
either this License or such Secondary License(s).
|
200
|
+
|
201
|
+
3.4. Notices
|
202
|
+
|
203
|
+
You may not remove or alter the substance of any license notices (including
|
204
|
+
copyright notices, patent notices, disclaimers of warranty, or limitations
|
205
|
+
of liability) contained within the Source Code Form of the Covered
|
206
|
+
Software, except that You may alter any license notices to the extent
|
207
|
+
required to remedy known factual inaccuracies.
|
208
|
+
|
209
|
+
3.5. Application of Additional Terms
|
210
|
+
|
211
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
212
|
+
indemnity or liability obligations to one or more recipients of Covered
|
213
|
+
Software. However, You may do so only on Your own behalf, and not on behalf
|
214
|
+
of any Contributor. You must make it absolutely clear that any such
|
215
|
+
warranty, support, indemnity, or liability obligation is offered by You
|
216
|
+
alone, and You hereby agree to indemnify every Contributor for any
|
217
|
+
liability incurred by such Contributor as a result of warranty, support,
|
218
|
+
indemnity or liability terms You offer. You may include additional
|
219
|
+
disclaimers of warranty and limitations of liability specific to any
|
220
|
+
jurisdiction.
|
221
|
+
|
222
|
+
4. Inability to Comply Due to Statute or Regulation
|
223
|
+
|
224
|
+
If it is impossible for You to comply with any of the terms of this License
|
225
|
+
with respect to some or all of the Covered Software due to statute, judicial
|
226
|
+
order, or regulation then You must: (a) comply with the terms of this License
|
227
|
+
to the maximum extent possible; and (b) describe the limitations and the code
|
228
|
+
they affect. Such description must be placed in a text file included with all
|
229
|
+
distributions of the Covered Software under this License. Except to the
|
230
|
+
extent prohibited by statute or regulation, such description must be
|
231
|
+
sufficiently detailed for a recipient of ordinary skill to be able to
|
232
|
+
understand it.
|
233
|
+
|
234
|
+
5. Termination
|
235
|
+
|
236
|
+
5.1. The rights granted under this License will terminate automatically if You
|
237
|
+
fail to comply with any of its terms. However, if You become compliant,
|
238
|
+
then the rights granted under this License from a particular Contributor
|
239
|
+
are reinstated (a) provisionally, unless and until such Contributor
|
240
|
+
explicitly and finally terminates Your grants, and (b) on an ongoing basis,
|
241
|
+
if such Contributor fails to notify You of the non-compliance by some
|
242
|
+
reasonable means prior to 60 days after You have come back into compliance.
|
243
|
+
Moreover, Your grants from a particular Contributor are reinstated on an
|
244
|
+
ongoing basis if such Contributor notifies You of the non-compliance by
|
245
|
+
some reasonable means, this is the first time You have received notice of
|
246
|
+
non-compliance with this License from such Contributor, and You become
|
247
|
+
compliant prior to 30 days after Your receipt of the notice.
|
248
|
+
|
249
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
250
|
+
infringement claim (excluding declaratory judgment actions, counter-claims,
|
251
|
+
and cross-claims) alleging that a Contributor Version directly or
|
252
|
+
indirectly infringes any patent, then the rights granted to You by any and
|
253
|
+
all Contributors for the Covered Software under Section 2.1 of this License
|
254
|
+
shall terminate.
|
255
|
+
|
256
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
|
257
|
+
license agreements (excluding distributors and resellers) which have been
|
258
|
+
validly granted by You or Your distributors under this License prior to
|
259
|
+
termination shall survive termination.
|
260
|
+
|
261
|
+
6. Disclaimer of Warranty
|
262
|
+
|
263
|
+
Covered Software is provided under this License on an “as is” basis, without
|
264
|
+
warranty of any kind, either expressed, implied, or statutory, including,
|
265
|
+
without limitation, warranties that the Covered Software is free of defects,
|
266
|
+
merchantable, fit for a particular purpose or non-infringing. The entire
|
267
|
+
risk as to the quality and performance of the Covered Software is with You.
|
268
|
+
Should any Covered Software prove defective in any respect, You (not any
|
269
|
+
Contributor) assume the cost of any necessary servicing, repair, or
|
270
|
+
correction. This disclaimer of warranty constitutes an essential part of this
|
271
|
+
License. No use of any Covered Software is authorized under this License
|
272
|
+
except under this disclaimer.
|
273
|
+
|
274
|
+
7. Limitation of Liability
|
275
|
+
|
276
|
+
Under no circumstances and under no legal theory, whether tort (including
|
277
|
+
negligence), contract, or otherwise, shall any Contributor, or anyone who
|
278
|
+
distributes Covered Software as permitted above, be liable to You for any
|
279
|
+
direct, indirect, special, incidental, or consequential damages of any
|
280
|
+
character including, without limitation, damages for lost profits, loss of
|
281
|
+
goodwill, work stoppage, computer failure or malfunction, or any and all
|
282
|
+
other commercial damages or losses, even if such party shall have been
|
283
|
+
informed of the possibility of such damages. This limitation of liability
|
284
|
+
shall not apply to liability for death or personal injury resulting from such
|
285
|
+
party’s negligence to the extent applicable law prohibits such limitation.
|
286
|
+
Some jurisdictions do not allow the exclusion or limitation of incidental or
|
287
|
+
consequential damages, so this exclusion and limitation may not apply to You.
|
288
|
+
|
289
|
+
8. Litigation
|
290
|
+
|
291
|
+
Any litigation relating to this License may be brought only in the courts of
|
292
|
+
a jurisdiction where the defendant maintains its principal place of business
|
293
|
+
and such litigation shall be governed by laws of that jurisdiction, without
|
294
|
+
reference to its conflict-of-law provisions. Nothing in this Section shall
|
295
|
+
prevent a party’s ability to bring cross-claims or counter-claims.
|
296
|
+
|
297
|
+
9. Miscellaneous
|
298
|
+
|
299
|
+
This License represents the complete agreement concerning the subject matter
|
300
|
+
hereof. If any provision of this License is held to be unenforceable, such
|
301
|
+
provision shall be reformed only to the extent necessary to make it
|
302
|
+
enforceable. Any law or regulation which provides that the language of a
|
303
|
+
contract shall be construed against the drafter shall not be used to construe
|
304
|
+
this License against a Contributor.
|
305
|
+
|
306
|
+
|
307
|
+
10. Versions of the License
|
308
|
+
|
309
|
+
10.1. New Versions
|
310
|
+
|
311
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
312
|
+
10.3, no one other than the license steward has the right to modify or
|
313
|
+
publish new versions of this License. Each version will be given a
|
314
|
+
distinguishing version number.
|
315
|
+
|
316
|
+
10.2. Effect of New Versions
|
317
|
+
|
318
|
+
You may distribute the Covered Software under the terms of the version of
|
319
|
+
the License under which You originally received the Covered Software, or
|
320
|
+
under the terms of any subsequent version published by the license
|
321
|
+
steward.
|
322
|
+
|
323
|
+
10.3. Modified Versions
|
324
|
+
|
325
|
+
If you create software not governed by this License, and you want to
|
326
|
+
create a new license for such software, you may create and use a modified
|
327
|
+
version of this License if you rename the license and remove any
|
328
|
+
references to the name of the license steward (except to note that such
|
329
|
+
modified license differs from this License).
|
330
|
+
|
331
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
|
332
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
333
|
+
Secondary Licenses under the terms of this version of the License, the
|
334
|
+
notice described in Exhibit B of this License must be attached.
|
335
|
+
|
336
|
+
Exhibit A - Source Code Form License Notice
|
337
|
+
|
338
|
+
This Source Code Form is subject to the
|
339
|
+
terms of the Mozilla Public License, v.
|
340
|
+
2.0. If a copy of the MPL was not
|
341
|
+
distributed with this file, You can
|
342
|
+
obtain one at
|
343
|
+
http://mozilla.org/MPL/2.0/.
|
344
|
+
|
345
|
+
If it is not possible or desirable to put the notice in a particular file, then
|
346
|
+
You may include the notice in a location (such as a LICENSE file in a relevant
|
347
|
+
directory) where a recipient would be likely to look for such a notice.
|
348
|
+
|
349
|
+
You may add additional accurate notices of copyright ownership.
|
350
|
+
|
351
|
+
Exhibit B - “Incompatible With Secondary Licenses” Notice
|
352
|
+
|
353
|
+
This Source Code Form is “Incompatible
|
354
|
+
With Secondary Licenses”, as defined by
|
355
|
+
the Mozilla Public License, v. 2.0.
|
data/README.md
CHANGED
@@ -16,6 +16,8 @@ go 1.17
|
|
16
16
|
|
17
17
|
### Usage
|
18
18
|
|
19
|
+
1. Using a constraint to check individual versions
|
20
|
+
|
19
21
|
```ruby
|
20
22
|
require 'go_version'
|
21
23
|
|
@@ -23,3 +25,19 @@ constraint = GoVersion::Constraint.new("> 1.0.0")
|
|
23
25
|
constraint.check("1.1.0") # true
|
24
26
|
constraint.check("1.0.0") # false
|
25
27
|
```
|
28
|
+
|
29
|
+
2. Checking if a version string is valid
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'go_version'
|
33
|
+
|
34
|
+
GoVersion.valid?("1.1.0") # true
|
35
|
+
```
|
36
|
+
|
37
|
+
3. Compare two versions
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require 'go_version'
|
41
|
+
|
42
|
+
GoVersion.compare("1.2.0", "1.2.1") # -1
|
43
|
+
```
|
data/ext/Makefile
ADDED
data/ext/extconf.rb
ADDED
data/ext/go.mod
ADDED
data/ext/go.sum
ADDED
data/ext/main.go
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"C"
|
5
|
+
|
6
|
+
"github.com/hashicorp/go-version"
|
7
|
+
)
|
8
|
+
|
9
|
+
// Check returns true if the given version string satisfies the
|
10
|
+
// given constraint string
|
11
|
+
//
|
12
|
+
//export Check
|
13
|
+
func Check(constraint, ver *C.char) bool {
|
14
|
+
constraints, err := version.NewConstraint(C.GoString(constraint))
|
15
|
+
if err != nil {
|
16
|
+
return false
|
17
|
+
}
|
18
|
+
|
19
|
+
checkVersion, err := version.NewVersion(C.GoString(ver))
|
20
|
+
if err != nil {
|
21
|
+
return false
|
22
|
+
}
|
23
|
+
|
24
|
+
return constraints.Check(checkVersion)
|
25
|
+
}
|
26
|
+
|
27
|
+
// ValidVersion returns true if it can be parsed as a version
|
28
|
+
//
|
29
|
+
//export ValidVersion
|
30
|
+
func ValidVersion(s *C.char) bool {
|
31
|
+
_, err := version.NewVersion(C.GoString(s))
|
32
|
+
return err == nil
|
33
|
+
}
|
34
|
+
|
35
|
+
// ValidSemver parses the given version and returns true if it
|
36
|
+
// adheres strictly to SemVer specs
|
37
|
+
//
|
38
|
+
//export ValidSemver
|
39
|
+
func ValidSemver(s *C.char) bool {
|
40
|
+
_, err := version.NewSemver(C.GoString(s))
|
41
|
+
return err == nil
|
42
|
+
}
|
43
|
+
|
44
|
+
// Compare compares two valid versions and returns -1, 0, or 1
|
45
|
+
// if 'a' version is smaller, equal, or larger than 'b' version,
|
46
|
+
// respectively. Invalid versions are considered smaller,
|
47
|
+
// to use ValidVersion to check for validity first.
|
48
|
+
//
|
49
|
+
//export Compare
|
50
|
+
func Compare(a, b *C.char) int {
|
51
|
+
va, err := version.NewVersion(C.GoString(a))
|
52
|
+
if err != nil {
|
53
|
+
return -1
|
54
|
+
}
|
55
|
+
|
56
|
+
vb, err := version.NewVersion(C.GoString(b))
|
57
|
+
if err != nil {
|
58
|
+
return -1
|
59
|
+
}
|
60
|
+
|
61
|
+
return va.Compare(vb)
|
62
|
+
}
|
63
|
+
|
64
|
+
func main() {}
|
data/lib/go_version/wrapper.rb
CHANGED
@@ -4,7 +4,12 @@ module GoVersion
|
|
4
4
|
module Wrapper
|
5
5
|
extend FFI::Library
|
6
6
|
|
7
|
-
|
7
|
+
# Requires rake install
|
8
|
+
ffi_lib File.join(File.expand_path(__dir__), "../go_version.so")
|
9
|
+
|
8
10
|
attach_function :Check, [:string, :string], :bool
|
11
|
+
attach_function :ValidVersion, [:string], :bool
|
12
|
+
attach_function :ValidSemver, [:string], :bool
|
13
|
+
attach_function :Compare, [:string, :string], :int
|
9
14
|
end
|
10
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
2
|
|
3
|
-
/* package
|
3
|
+
/* package go-version */
|
4
4
|
|
5
5
|
|
6
6
|
#line 1 "cgo-builtin-export-prolog"
|
@@ -74,8 +74,28 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
74
74
|
extern "C" {
|
75
75
|
#endif
|
76
76
|
|
77
|
+
|
78
|
+
// Check returns true if the given version string satisfies the
|
79
|
+
// given constraint string
|
80
|
+
//
|
77
81
|
extern GoUint8 Check(char* constraint, char* ver);
|
78
82
|
|
83
|
+
// ValidVersion returns true if it can be parsed as a version
|
84
|
+
//
|
85
|
+
extern GoUint8 ValidVersion(char* s);
|
86
|
+
|
87
|
+
// ValidSemver parses the given version and returns true if it
|
88
|
+
// adheres strictly to SemVer specs
|
89
|
+
//
|
90
|
+
extern GoUint8 ValidSemver(char* s);
|
91
|
+
|
92
|
+
// Compare compares two valid versions and returns -1, 0, or 1
|
93
|
+
// if 'a' version is smaller, equal, or larger than 'b' version,
|
94
|
+
// respectively. Invalid versions are considered smaller,
|
95
|
+
// to use ValidVersion to check for validity first.
|
96
|
+
//
|
97
|
+
extern GoInt Compare(char* a, char* b);
|
98
|
+
|
79
99
|
#ifdef __cplusplus
|
80
100
|
}
|
81
101
|
#endif
|
data/lib/go_version.rb
CHANGED
@@ -1,2 +1,17 @@
|
|
1
|
+
require "go_version/version"
|
1
2
|
require "go_version/wrapper"
|
2
3
|
require "go_version/constraint"
|
4
|
+
|
5
|
+
module GoVersion
|
6
|
+
def self.valid?(s)
|
7
|
+
Wrapper.ValidVersion(s)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.valid_strict?(s)
|
11
|
+
Wrapper.ValidSemver(s)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.compare(a, b)
|
15
|
+
Wrapper.Compare(a, b)
|
16
|
+
end
|
17
|
+
end
|
data/lib/go_version.so
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Croft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -25,40 +25,56 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '0'
|
41
55
|
description: Wraps native go-version in a ruby library for deep compatibility.
|
42
|
-
email:
|
56
|
+
email: brandon.croft@gmail.com
|
43
57
|
executables: []
|
44
58
|
extensions:
|
45
|
-
- ext/
|
59
|
+
- ext/extconf.rb
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
62
|
+
- LICENSE
|
48
63
|
- README.md
|
49
|
-
- ext/
|
50
|
-
- ext/
|
51
|
-
- ext/go
|
52
|
-
- ext/go
|
53
|
-
- ext/go
|
54
|
-
-
|
55
|
-
- ext/go-version/mkmf.log
|
64
|
+
- ext/Makefile
|
65
|
+
- ext/extconf.rb
|
66
|
+
- ext/go.mod
|
67
|
+
- ext/go.sum
|
68
|
+
- ext/main.go
|
69
|
+
- lib/go_version.h
|
56
70
|
- lib/go_version.rb
|
71
|
+
- lib/go_version.so
|
57
72
|
- lib/go_version/constraint.rb
|
73
|
+
- lib/go_version/version.rb
|
58
74
|
- lib/go_version/wrapper.rb
|
59
75
|
homepage: https://github.com/brandonc/go-version-ruby
|
60
76
|
licenses:
|
61
|
-
-
|
77
|
+
- MPL-2.0
|
62
78
|
metadata: {}
|
63
79
|
post_install_message:
|
64
80
|
rdoc_options: []
|
@@ -75,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
91
|
- !ruby/object:Gem::Version
|
76
92
|
version: '0'
|
77
93
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
94
|
+
rubygems_version: 3.5.9
|
79
95
|
signing_key:
|
80
96
|
specification_version: 4
|
81
97
|
summary: Ruby bindings for the hashicorp/go-version lib.
|
data/ext/go-version/Makefile
DELETED
@@ -1,270 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
V0 = $(V:0=)
|
7
|
-
Q1 = $(V:1=)
|
8
|
-
Q = $(Q1:0=@)
|
9
|
-
ECHO1 = $(V:1=@ :)
|
10
|
-
ECHO = $(ECHO1:0=@ echo)
|
11
|
-
NULLCMD = :
|
12
|
-
|
13
|
-
#### Start of system configuration section. ####
|
14
|
-
|
15
|
-
srcdir = .
|
16
|
-
topdir = /Users/brandonc/.rbenv/versions/3.1.1/include/ruby-3.1.0
|
17
|
-
hdrdir = $(topdir)
|
18
|
-
arch_hdrdir = /Users/brandonc/.rbenv/versions/3.1.1/include/ruby-3.1.0/x86_64-darwin20
|
19
|
-
PATH_SEPARATOR = :
|
20
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
21
|
-
prefix = $(DESTDIR)/Users/brandonc/.rbenv/versions/3.1.1
|
22
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
23
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
24
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
25
|
-
exec_prefix = $(prefix)
|
26
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
27
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
28
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
29
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
30
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
31
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
32
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
33
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
34
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
35
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
37
|
-
sitedir = $(rubylibprefix)/site_ruby
|
38
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
39
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
40
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
41
|
-
archincludedir = $(includedir)/$(arch)
|
42
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
43
|
-
archlibdir = $(libdir)/$(arch)
|
44
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
45
|
-
mandir = $(datarootdir)/man
|
46
|
-
localedir = $(datarootdir)/locale
|
47
|
-
libdir = $(exec_prefix)/lib
|
48
|
-
psdir = $(docdir)
|
49
|
-
pdfdir = $(docdir)
|
50
|
-
dvidir = $(docdir)
|
51
|
-
htmldir = $(docdir)
|
52
|
-
infodir = $(datarootdir)/info
|
53
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
54
|
-
oldincludedir = $(DESTDIR)/usr/include
|
55
|
-
includedir = $(SDKROOT)$(prefix)/include
|
56
|
-
runstatedir = $(localstatedir)/run
|
57
|
-
localstatedir = $(prefix)/var
|
58
|
-
sharedstatedir = $(prefix)/com
|
59
|
-
sysconfdir = $(prefix)/etc
|
60
|
-
datadir = $(datarootdir)
|
61
|
-
datarootdir = $(prefix)/share
|
62
|
-
libexecdir = $(exec_prefix)/libexec
|
63
|
-
sbindir = $(exec_prefix)/sbin
|
64
|
-
bindir = $(exec_prefix)/bin
|
65
|
-
archdir = $(rubyarchdir)
|
66
|
-
|
67
|
-
|
68
|
-
CC_WRAPPER =
|
69
|
-
CC = clang
|
70
|
-
CXX = clang++
|
71
|
-
LIBRUBY = $(LIBRUBY_SO)
|
72
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
73
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
74
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
|
75
|
-
empty =
|
76
|
-
OUTFLAG = -o $(empty)
|
77
|
-
COUTFLAG = -o $(empty)
|
78
|
-
CSRCFLAG = $(empty)
|
79
|
-
|
80
|
-
RUBY_EXTCONF_H =
|
81
|
-
cflags = -fdeclspec $(optflags) $(debugflags) $(warnflags)
|
82
|
-
cxxflags =
|
83
|
-
optflags = -O3 -fno-fast-math
|
84
|
-
debugflags = -ggdb3
|
85
|
-
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef
|
86
|
-
cppflags =
|
87
|
-
CCDLFLAGS = -fno-common
|
88
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe $(ARCH_FLAG)
|
89
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
90
|
-
DEFS =
|
91
|
-
CPPFLAGS = -I/Users/brandonc/.rbenv/versions/3.1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
92
|
-
CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
|
93
|
-
ldflags = -L. -L/Users/brandonc/.rbenv/versions/3.1.1/lib -fstack-protector-strong -L/usr/local/lib
|
94
|
-
dldflags = -L/Users/brandonc/.rbenv/versions/3.1.1/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
95
|
-
ARCH_FLAG =
|
96
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
97
|
-
LDSHARED = $(CC) -dynamic -bundle
|
98
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
99
|
-
AR = ar
|
100
|
-
EXEEXT =
|
101
|
-
|
102
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
103
|
-
RUBY_SO_NAME = ruby.3.1
|
104
|
-
RUBYW_INSTALL_NAME =
|
105
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
106
|
-
RUBYW_BASE_NAME = rubyw
|
107
|
-
RUBY_BASE_NAME = ruby
|
108
|
-
|
109
|
-
arch = x86_64-darwin20
|
110
|
-
sitearch = $(arch)
|
111
|
-
ruby_version = 3.1.0
|
112
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
113
|
-
RUBY = $(ruby)
|
114
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
115
|
-
|
116
|
-
RM = rm -f
|
117
|
-
RM_RF = rm -fr
|
118
|
-
RMDIRS = rmdir -p
|
119
|
-
MAKEDIRS = /usr/local/bin/gmkdir -p
|
120
|
-
INSTALL = /usr/local/bin/ginstall -c
|
121
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
122
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
123
|
-
COPY = cp
|
124
|
-
TOUCH = exit >
|
125
|
-
|
126
|
-
#### End of system configuration section. ####
|
127
|
-
|
128
|
-
preload =
|
129
|
-
libpath = . $(libdir)
|
130
|
-
LIBPATH = -L. -L$(libdir)
|
131
|
-
DEFFILE =
|
132
|
-
|
133
|
-
CLEANFILES = mkmf.log
|
134
|
-
DISTCLEANFILES =
|
135
|
-
DISTCLEANDIRS =
|
136
|
-
|
137
|
-
extout =
|
138
|
-
extout_prefix =
|
139
|
-
target_prefix = /go_version
|
140
|
-
LOCAL_LIBS =
|
141
|
-
LIBS = $(LIBRUBYARG_SHARED)
|
142
|
-
ORIG_SRCS =
|
143
|
-
SRCS = $(ORIG_SRCS)
|
144
|
-
OBJS =
|
145
|
-
HDRS =
|
146
|
-
LOCAL_HDRS =
|
147
|
-
TARGET = go_version
|
148
|
-
TARGET_NAME = go_version
|
149
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
150
|
-
DLLIB = $(TARGET).bundle
|
151
|
-
EXTSTATIC =
|
152
|
-
STATIC_LIB =
|
153
|
-
|
154
|
-
TIMESTAMP_DIR = .
|
155
|
-
BINDIR = $(bindir)
|
156
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
157
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
158
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
159
|
-
HDRDIR = $(sitehdrdir)$(target_prefix)
|
160
|
-
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
161
|
-
TARGET_SO_DIR =
|
162
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
163
|
-
CLEANLIBS = $(TARGET_SO) $(TARGET_SO).dSYM
|
164
|
-
CLEANOBJS = *.o *.bak
|
165
|
-
|
166
|
-
all: $(DLLIB)
|
167
|
-
static: $(STATIC_LIB)
|
168
|
-
.PHONY: all install static install-so install-rb
|
169
|
-
.PHONY: clean clean-so clean-static clean-rb
|
170
|
-
|
171
|
-
clean-static::
|
172
|
-
clean-rb-default::
|
173
|
-
clean-rb::
|
174
|
-
clean-so::
|
175
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
176
|
-
-$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
177
|
-
|
178
|
-
distclean-rb-default::
|
179
|
-
distclean-rb::
|
180
|
-
distclean-so::
|
181
|
-
distclean-static::
|
182
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
183
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
184
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
185
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
186
|
-
|
187
|
-
realclean: distclean
|
188
|
-
install: install-so install-rb
|
189
|
-
|
190
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.-.go_version.time
|
191
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
192
|
-
clean-static::
|
193
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
194
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
195
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
196
|
-
pre-install-rb: Makefile
|
197
|
-
pre-install-rb-default: Makefile
|
198
|
-
do-install-rb:
|
199
|
-
do-install-rb-default:
|
200
|
-
pre-install-rb-default:
|
201
|
-
@$(NULLCMD)
|
202
|
-
$(TIMESTAMP_DIR)/.sitearchdir.-.go_version.time:
|
203
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
204
|
-
$(Q) $(TOUCH) $@
|
205
|
-
|
206
|
-
site-install: site-install-so site-install-rb
|
207
|
-
site-install-so: install-so
|
208
|
-
site-install-rb: install-rb
|
209
|
-
|
210
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
211
|
-
|
212
|
-
.cc.o:
|
213
|
-
$(ECHO) compiling $(<)
|
214
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
215
|
-
|
216
|
-
.cc.S:
|
217
|
-
$(ECHO) translating $(<)
|
218
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
219
|
-
|
220
|
-
.mm.o:
|
221
|
-
$(ECHO) compiling $(<)
|
222
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
223
|
-
|
224
|
-
.mm.S:
|
225
|
-
$(ECHO) translating $(<)
|
226
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
227
|
-
|
228
|
-
.cxx.o:
|
229
|
-
$(ECHO) compiling $(<)
|
230
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
231
|
-
|
232
|
-
.cxx.S:
|
233
|
-
$(ECHO) translating $(<)
|
234
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
235
|
-
|
236
|
-
.cpp.o:
|
237
|
-
$(ECHO) compiling $(<)
|
238
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
239
|
-
|
240
|
-
.cpp.S:
|
241
|
-
$(ECHO) translating $(<)
|
242
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
243
|
-
|
244
|
-
.c.o:
|
245
|
-
$(ECHO) compiling $(<)
|
246
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
247
|
-
|
248
|
-
.c.S:
|
249
|
-
$(ECHO) translating $(<)
|
250
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
251
|
-
|
252
|
-
.m.o:
|
253
|
-
$(ECHO) compiling $(<)
|
254
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
255
|
-
|
256
|
-
.m.S:
|
257
|
-
$(ECHO) translating $(<)
|
258
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
259
|
-
|
260
|
-
$(TARGET_SO): $(OBJS) Makefile
|
261
|
-
$(ECHO) linking shared-object go_version/$(DLLIB)
|
262
|
-
-$(Q)$(RM) $(@)
|
263
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
264
|
-
$(Q) $(POSTLINK)
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|
269
|
-
$(DLLIB):
|
270
|
-
CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='-undefined dynamic_lookup' go build -buildmode=c-shared -o $(DLLIB) .
|
data/ext/go-version/extconf.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require "mkmf"
|
2
|
-
|
3
|
-
find_executable("go")
|
4
|
-
|
5
|
-
$objs = []
|
6
|
-
def $objs.empty?; false; end
|
7
|
-
|
8
|
-
create_makefile("go_version/go_version")
|
9
|
-
|
10
|
-
case `#{CONFIG["CC"]} --version`
|
11
|
-
when /Free Software Foundation/
|
12
|
-
ldflags = '-W1,--unresolved-symbols=ignore-all'
|
13
|
-
when /clang/
|
14
|
-
ldflags = '-undefined dynamic_lookup'
|
15
|
-
end
|
16
|
-
|
17
|
-
File.open("Makefile", "a") do |f|
|
18
|
-
f.write <<-EOS.gsub(/^ {8}/, "\t")
|
19
|
-
$(DLLIB):
|
20
|
-
CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ldflags}' go build -buildmode=c-shared -o $(DLLIB) .
|
21
|
-
EOS
|
22
|
-
end
|
data/ext/go-version/go.mod
DELETED
data/ext/go-version/go.sum
DELETED
data/ext/go-version/main.go
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
package main
|
2
|
-
|
3
|
-
import (
|
4
|
-
"C"
|
5
|
-
|
6
|
-
"github.com/hashicorp/go-version"
|
7
|
-
)
|
8
|
-
|
9
|
-
//export Check
|
10
|
-
func Check(constraint *C.char, ver *C.char) bool {
|
11
|
-
constraints, err := version.NewConstraint(C.GoString(constraint))
|
12
|
-
if err != nil {
|
13
|
-
return false
|
14
|
-
}
|
15
|
-
|
16
|
-
checkVersion, err := version.NewVersion(C.GoString(ver))
|
17
|
-
if err != nil {
|
18
|
-
return false
|
19
|
-
}
|
20
|
-
|
21
|
-
return constraints.Check(checkVersion)
|
22
|
-
}
|
23
|
-
|
24
|
-
func main() {}
|
data/ext/go-version/mkmf.log
DELETED