go_version 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f82286c5a009760d278845c33a57be46deed12a1fe7956b2bd0d9e16c1d8f292
4
- data.tar.gz: 238dda82d020c48e4fad75ea4cfd6e79d403f5c86f112e162b5961d9deaf8a45
3
+ metadata.gz: 1ab2fea67829122925a91e7061e0457e1809725c55342119004e827a967f164a
4
+ data.tar.gz: a52e043eb0fed2f0cf3dadff944fe7f2f66f9badff31899e1fa4c32e8ff87b90
5
5
  SHA512:
6
- metadata.gz: 238ad24c3b8a2aa7d7cd6e484042993bc294afd9a8d3ca03e2e38b1e28b8fc2a9f4adb3aa7588c07d2281aa34f4809170f779aa3e6c866e63ceed3ce23f1b8cb
7
- data.tar.gz: 1f76a0c54ff2fdffee9b63a45f6108141775af546425ca936f2517a298d264c0bf3d69bed01f9eb92a4862510eaecae353e8fcf908ffdcbeb6ef557099bbc366
6
+ metadata.gz: cf0b3dc991d14e620fa7295ff6b0e610647a8c697392ea77ac818cf4df263b966b923b761703df8aefb95a2b652f46ed3f3be447aae69601fdbe6a15b669a0d3
7
+ data.tar.gz: ae3b06c0e213ccb1b81082e7f4dd1545d45ae2052284903f3b2a340804878ff68b8da988c4370870f08600f19298769bed9be2b02610aaf617a66f429fbb8417
data/README.md CHANGED
@@ -1,7 +1,25 @@
1
1
  # go-version-ruby
2
2
 
3
- Ruby bindings for [go-version](https://github.com/hashicorp/go-version)
3
+ Ruby bindings for [hashicorp/go-version](https://github.com/hashicorp/go-version)
4
4
 
5
- ### Building
5
+ ### Why?
6
6
 
7
- 1. `go build -o go-version.so -buildmode=c-shared .`
7
+ This can be useful when you want to match the exact behavior of go-version from a ruby app.
8
+
9
+ ### Prerequisites
10
+
11
+ go 1.16+
12
+
13
+ ### Installing
14
+
15
+ `gem install go_version`
16
+
17
+ ### Usage
18
+
19
+ ```ruby
20
+ require 'go_version'
21
+
22
+ constraint = GoVersion::Constraint.new("> 1.0.0")
23
+ constraint.check("1.1.0") # true
24
+ constraint.check("1.0.0") # false
25
+ ```
@@ -6,8 +6,8 @@ import (
6
6
  "github.com/hashicorp/go-version"
7
7
  )
8
8
 
9
- //export Satisfies
10
- func Satisfies(constraint *C.char, ver *C.char) bool {
9
+ //export Check
10
+ func Check(constraint *C.char, ver *C.char) bool {
11
11
  constraints, err := version.NewConstraint(C.GoString(constraint))
12
12
  if err != nil {
13
13
  return false
@@ -4,8 +4,8 @@ module GoVersion
4
4
  @constraint = constraint
5
5
  end
6
6
 
7
- def satisfies?(version)
8
- Wrapper.Satisfies(@constraint, version)
7
+ def check(version)
8
+ Wrapper.Check(@constraint, version)
9
9
  end
10
10
  end
11
11
  end
@@ -5,6 +5,6 @@ module GoVersion
5
5
  extend FFI::Library
6
6
 
7
7
  ffi_lib File.join(File.expand_path(__dir__), "../../ext/go-version/go_version.bundle")
8
- attach_function :Satisfies, [:string, :string], :bool
8
+ attach_function :Check, [:string, :string], :bool
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Croft
@@ -53,7 +53,7 @@ files:
53
53
  - lib/go_version.rb
54
54
  - lib/go_version/constraint.rb
55
55
  - lib/go_version/wrapper.rb
56
- homepage: https://rubygems.org/gems/go_version
56
+ homepage: https://github.com/brandonc/go-version-ruby
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}