machine-gun 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
  SHA1:
3
- metadata.gz: fc41498deb5502dd39588f7a30fe6364cfefb1b8
4
- data.tar.gz: 3f9e0c38485725896eaa056a567eec1a4b0bd4e7
3
+ metadata.gz: dc753fef798acdec0fa7d91a14d75f97518cec8c
4
+ data.tar.gz: 7d086330e29a7f10064f2e6ab8fe7943e7f6df89
5
5
  SHA512:
6
- metadata.gz: 2221c00c3c828811de0b0490f31632b0cad4f2052daa73a286bfa88a9b7742dfb14e3a154dcc79427b6384c4deeee86e8671967362430db30699ab719d4ea5d5
7
- data.tar.gz: c6b691f539e4666a5fb4b6e753457ca5100659973038dade409f6db153c03e24fe02e69e80a803e8694814469102bdc731903ead2ba96d2e6c757584c6060c36
6
+ metadata.gz: 0370cff7e0ffdf574432732e7ea11e90ad4d029b40b885ee2db7a2bb35ae5aaf67dd1aaeef376ee54ae9f543612088d942b5d201fddc8107c6022f4238d2702b
7
+ data.tar.gz: 56707af5a8040d163aa5a5190b8f2fd7e1c479b9c91f1336e93610b4621b2616877efc7c8659503ab64e6febeb4a7ac8b113aaf10dda92ec3fcf4edaad736e15
@@ -0,0 +1,62 @@
1
+ /* Created by "go tool cgo" - DO NOT EDIT. */
2
+
3
+ /* package command-line-arguments */
4
+
5
+ /* Start of preamble from import "C" comments. */
6
+
7
+
8
+ #line 3 "/work/src/bridge.go"
9
+ #include <stdlib.h>
10
+
11
+
12
+
13
+ /* End of preamble from import "C" comments. */
14
+
15
+
16
+ /* Start of boilerplate cgo prologue. */
17
+
18
+ #ifndef GO_CGO_PROLOGUE_H
19
+ #define GO_CGO_PROLOGUE_H
20
+
21
+ typedef signed char GoInt8;
22
+ typedef unsigned char GoUint8;
23
+ typedef short GoInt16;
24
+ typedef unsigned short GoUint16;
25
+ typedef int GoInt32;
26
+ typedef unsigned int GoUint32;
27
+ typedef long long GoInt64;
28
+ typedef unsigned long long GoUint64;
29
+ typedef GoInt64 GoInt;
30
+ typedef GoUint64 GoUint;
31
+ typedef __SIZE_TYPE__ GoUintptr;
32
+ typedef float GoFloat32;
33
+ typedef double GoFloat64;
34
+ typedef __complex float GoComplex64;
35
+ typedef __complex double GoComplex128;
36
+
37
+ // static assertion to make sure the file is being used on architecture
38
+ // at least with matching size of GoInt.
39
+ typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
40
+
41
+ typedef struct { char *p; GoInt n; } GoString;
42
+ typedef void *GoMap;
43
+ typedef void *GoChan;
44
+ typedef struct { void *t; void *v; } GoInterface;
45
+ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
46
+
47
+ #endif
48
+
49
+ /* End of boilerplate cgo prologue. */
50
+
51
+ #ifdef __cplusplus
52
+ extern "C" {
53
+ #endif
54
+
55
+
56
+ extern GoInt Free(void* p0);
57
+
58
+ extern GoInt BridgeCommand(char* p0, char* p1, char** p2);
59
+
60
+ #ifdef __cplusplus
61
+ }
62
+ #endif
@@ -1,3 +1,4 @@
1
+ require 'machine-gun/os'
1
2
  require 'machine-gun/bridge'
2
3
  require 'machine-gun/commands'
3
4
  require 'machine-gun/request'
@@ -5,7 +5,7 @@ module MachineGun
5
5
  module Bridge
6
6
  extend FFI::Library
7
7
 
8
- ffi_lib './lib/machine-gun.so'
8
+ ffi_lib "./lib/#{OS.host}/#{OS.arch}/machine-gun.so"
9
9
  attach_function :Free, [:pointer], :int
10
10
 
11
11
  attach_function :BridgeCommand, [:string, :string, :pointer], :int
@@ -0,0 +1,34 @@
1
+ module MachineGun
2
+ module OS
3
+ class << self
4
+ def platform
5
+ RUBY_PLATFORM
6
+ end
7
+
8
+ def host
9
+ h = platform.split('-')[1]
10
+
11
+ case
12
+ when h =~ /darwin/
13
+ 'darwin'
14
+ when h =~ /linux/
15
+ 'linux'
16
+ else
17
+ 'unknown'
18
+ end
19
+ end
20
+
21
+ def arch
22
+ platform.split('-')[0]
23
+ end
24
+
25
+ def mac?
26
+ host =~ /darwin/i
27
+ end
28
+
29
+ def linux?
30
+ host =~ /linux/i
31
+ end
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: machine-gun
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
  - Chakrit Wichian
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,11 +115,14 @@ executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
104
- - lib/machine-gun.h
118
+ - lib/darwin/x86_64/machine-gun.h
119
+ - lib/darwin/x86_64/machine-gun.so
120
+ - lib/linux/x86_64/machine-gun.h
121
+ - lib/linux/x86_64/machine-gun.so
105
122
  - lib/machine-gun.rb
106
- - lib/machine-gun.so
107
123
  - lib/machine-gun/bridge.rb
108
124
  - lib/machine-gun/commands.rb
125
+ - lib/machine-gun/os.rb
109
126
  - lib/machine-gun/request.rb
110
127
  - lib/machine-gun/response.rb
111
128
  homepage: https://www.omise.co