rdkafka 0.1.3 → 0.1.4

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: 0a7bfbfeabdaa97b1c7868cb714fc1ad1e45fad3
4
- data.tar.gz: 00b04579035bd5a1a47c8e798c8697fd2590dea3
3
+ metadata.gz: d81ac2cd0a6f14c66b39e97f71c273b154d2d8ca
4
+ data.tar.gz: e7eaa65937211de27685765bd3196affcf20bc27
5
5
  SHA512:
6
- metadata.gz: 7224534734bea561d2c063acfb260724afaeea30c102ce5b2d244dafe1cd85387fd698cd4f85012823117291f85159e1894acb4360a81ed60559ea3f7ff6f33c
7
- data.tar.gz: f6d99ec638da0612c73a7ae4abf0432ce3d367f365c84f3a1450971e0d7305d1f136cb54e9dbfdaf5a624701cc6132441e10e5349cd135ecb217440762b95fe1
6
+ metadata.gz: f4033f1e7717797c0ffc4b868c87b186a8648aecd8b1e0580adde6ce955be66151f9a61a467ab74d0487575825f0b077bb690c759ac643f150f347b5a6f74a70
7
+ data.tar.gz: 75218ad280e0d0a277958c16b61baf7f6d0ee3da35d69de78cf0c022ac03ea422f7a6e09a3e1877732c42cb9300f6109f60384ae05da374a4c95106de75cd264
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  Gemfile.lock
2
2
  ext/ports
3
3
  ext/tmp
4
+ ext/librdkafka.*
4
5
  *.gem
data/ext/Rakefile CHANGED
@@ -2,14 +2,28 @@ require File.expand_path('../../lib/rdkafka/version', __FILE__)
2
2
  require "mini_portile2"
3
3
  require "fileutils"
4
4
 
5
- task :default do
5
+ task :default => :clean do
6
+ # Download and compile librdkafka
6
7
  recipe = MiniPortile.new("librdkafka", Rdkafka::LIBRDKAFKA_VERSION)
7
8
  recipe.files = ["https://github.com/edenhill/librdkafka/archive/v#{Rdkafka::LIBRDKAFKA_VERSION}.tar.gz"]
8
9
  recipe.configure_options = ["--host=#{recipe.host}"]
9
10
  recipe.cook
11
+ # Move dynamic library we're interested in
12
+ extension = if recipe.host.include?('darwin')
13
+ 'dylib'
14
+ else
15
+ 'so'
16
+ end
17
+ lib_path = File.join(File.dirname(__FILE__), "ports/#{recipe.host}/librdkafka/#{Rdkafka::LIBRDKAFKA_VERSION}/lib/librdkafka.1.#{extension}")
18
+ FileUtils.mv(lib_path, File.join(File.dirname(__FILE__), "librdkafka.#{extension}"))
19
+ # Cleanup files created miniportile we don't need in the gem
20
+ FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
21
+ FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
10
22
  end
11
23
 
12
24
  task :clean do
13
- FileUtils.rm_rf "ports"
14
- FileUtils.rm_rf "tmp"
25
+ FileUtils.rm_f File.join(File.dirname(__FILE__), "librdkafka.dylib")
26
+ FileUtils.rm_f File.join(File.dirname(__FILE__), "librdkafka.so")
27
+ FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
28
+ FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
15
29
  end
data/lib/rdkafka/ffi.rb CHANGED
@@ -1,21 +1,18 @@
1
1
  require "ffi"
2
- require "mini_portile2"
3
2
 
4
3
  module Rdkafka
5
4
  module FFI
6
5
  extend ::FFI::Library
7
6
 
8
- def self.library_path
9
- mini_portile = MiniPortile.new("librdkafka", Rdkafka::LIBRDKAFKA_VERSION)
10
- extension = if mini_portile.host.include?('darwin')
11
- 'dylib'
12
- else
13
- 'so'
14
- end
15
- "../../ext/ports/#{mini_portile.host}/librdkafka/#{Rdkafka::LIBRDKAFKA_VERSION}/lib/librdkafka.#{extension}"
7
+ def self.lib_extension
8
+ if Gem::Platform.local.os.include?("darwin")
9
+ 'dylib'
10
+ else
11
+ 'so'
12
+ end
16
13
  end
17
14
 
18
- ffi_lib File.join(File.dirname(__FILE__), library_path)
15
+ ffi_lib File.join(File.dirname(__FILE__), "../../ext/librdkafka.#{lib_extension}")
19
16
 
20
17
  # Polling
21
18
 
@@ -1,4 +1,4 @@
1
1
  module Rdkafka
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  LIBRDKAFKA_VERSION = "0.11.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdkafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thijs Cadier