tdev_kiwi 0.0.1 → 0.0.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.
data/.travis.yml CHANGED
@@ -5,9 +5,4 @@ rvm:
5
5
  - 1.9.3
6
6
 
7
7
  notifications:
8
- irc:
9
- channels:
10
- - "irc.freenode.org#TotenDev"
11
- template:
12
- - "%{repository_url} (%{commit}) : %{message} %{foo}"
13
- - "Build details: %{build_url}"
8
+ irc: "irc.freenode.org#TotenDev"
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
@@ -1,3 +1,3 @@
1
1
  module Kiwi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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
- LIBC = DL.dlopen('libc.dylib')
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.1
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: 2067003275227394834
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: 2067003275227394834
58
+ hash: -4085342975312793651
59
59
  requirements: []
60
60
  rubyforge_project:
61
61
  rubygems_version: 1.8.23