tdev_kiwi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -6
- data/README.md +2 -0
- data/lib/tdev_kiwi/version.rb +1 -1
- data/lib/tdev_kiwi.rb +12 -1
- metadata +3 -3
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Ruby Gem to send a messages to [Kiwi](https://github.com/TotenDev/Kiwi)
|
4
4
|
|
5
|
+
A special thanks to [Peter Cooper](@peterc) for this great [gist](https://gist.github.com/2582673) that helped me a lot!
|
6
|
+
|
5
7
|
[![Build Status](https://secure.travis-ci.org/TotenDev/Kiwi-LibRuby.png?branch=master)](http://travis-ci.org/TotenDev/Kiwi-LibRuby)
|
6
8
|
|
7
9
|
## Requirements
|
data/lib/tdev_kiwi/version.rb
CHANGED
data/lib/tdev_kiwi.rb
CHANGED
@@ -14,7 +14,15 @@ require 'tdev_kiwi/version'
|
|
14
14
|
module TotenDev
|
15
15
|
class Kiwi
|
16
16
|
|
17
|
-
|
17
|
+
begin
|
18
|
+
LIBC = DL.dlopen('libc.dylib')
|
19
|
+
rescue
|
20
|
+
begin
|
21
|
+
LIBC = DL.dlopen('libc.so')
|
22
|
+
rescue
|
23
|
+
LIBC = nil
|
24
|
+
end
|
25
|
+
end
|
18
26
|
|
19
27
|
IPC_CREAT = 001000
|
20
28
|
IPC_EXCL = 002000
|
@@ -24,13 +32,16 @@ module TotenDev
|
|
24
32
|
IPC_M = 010000
|
25
33
|
|
26
34
|
attr_accessor :queue_id, :message
|
35
|
+
attr_reader :queue_key
|
27
36
|
|
28
37
|
def initialize(qk, qid = 'TDKiwi')
|
29
38
|
@queue_id = qid
|
39
|
+
@queue_key = qk
|
30
40
|
@kiwi = self.class.get(qk) unless qk.nil?
|
31
41
|
end
|
32
42
|
|
33
43
|
def self.get( queue_key, msgflag = IPC_CREAT | IPC_R | IPC_W | IPC_M )
|
44
|
+
return nil if LIBC.nil?
|
34
45
|
queue_key = queue_key.to_i if queue_key.is_a? String
|
35
46
|
Fiddle::Function.new( LIBC['msgget'],
|
36
47
|
[Fiddle::TYPE_INT, Fiddle::TYPE_INT],
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdev_kiwi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -46,7 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
46
|
version: '0'
|
47
47
|
segments:
|
48
48
|
- 0
|
49
|
-
hash:
|
49
|
+
hash: -4085342975312793651
|
50
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
segments:
|
57
57
|
- 0
|
58
|
-
hash:
|
58
|
+
hash: -4085342975312793651
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project:
|
61
61
|
rubygems_version: 1.8.23
|