hermann 0.16.0
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.
- checksums.yaml +7 -0
- data/Rakefile +33 -0
- data/ext/hermann/extconf.rb +74 -0
- data/ext/hermann/hermann_lib.c +1031 -0
- data/ext/hermann/hermann_lib.h +107 -0
- data/ext/patches/librdkafka/0006-Update-some-headers-to-include-the-right-headers-to-.patch +57 -0
- data/lib/hermann/consumer.rb +19 -0
- data/lib/hermann/errors.rb +8 -0
- data/lib/hermann/producer.rb +122 -0
- data/lib/hermann/result.rb +74 -0
- data/lib/hermann/timeout.rb +37 -0
- data/lib/hermann/version.rb +3 -0
- data/lib/hermann.rb +2 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8194f73012572376c8cd14ae68042da11fc79dfc
|
4
|
+
data.tar.gz: 355dacd9317c634b430e4a7f32216aaccf07a308
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a1d4dd0e592433519e086d889b4362ff1e69f805f121517812bffd4b67ea1a77fb1d941fe0e017968ad791fe23506371831070a905259600f7154f8adca2cd7b
|
7
|
+
data.tar.gz: db0b9f012f34e31c23268b4a93cbf40ea38a2b8239c3fe4fb7ca140d339259adffec0aa31f6098466ed57e107149c537ed43630694c6cea852c4048512266db9
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'fileutils'
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rake/extensiontask'
|
6
|
+
|
7
|
+
|
8
|
+
Rake::ExtensionTask.new do |t|
|
9
|
+
t.name = 'hermann_lib'
|
10
|
+
t.ext_dir = 'ext/hermann'
|
11
|
+
t.gem_spec = Gem::Specification.load('hermann.gemspec')
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec::Core::RakeTask.new(:spec) do |r|
|
15
|
+
r.rspec_opts = '--tag ~type:integration'
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :spec do
|
19
|
+
RSpec::Core::RakeTask.new(:integration) do |r|
|
20
|
+
r.rspec_opts = '--tag type:integration'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Remove the entire ./tmp directory'
|
25
|
+
task :removetmp do
|
26
|
+
FileUtils.rm_rf('tmp')
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
task :build => [:compile]
|
31
|
+
task :clean => [:removetmp]
|
32
|
+
task :default => [:clean, :build, :spec]
|
33
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# External configuration for Hermann Gem
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'mkmf'
|
5
|
+
require 'mini_portile'
|
6
|
+
require 'digest/md5'
|
7
|
+
|
8
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
9
|
+
|
10
|
+
LIBDIR = RbConfig::CONFIG['libdir']
|
11
|
+
INCLUDEDIR = RbConfig::CONFIG['includedir']
|
12
|
+
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../')
|
13
|
+
|
14
|
+
puts "Library Dir: #{LIBDIR}\n"
|
15
|
+
puts "Include Dir: #{INCLUDEDIR}"
|
16
|
+
|
17
|
+
################################################################################
|
18
|
+
# MiniPortile overrides
|
19
|
+
################################################################################
|
20
|
+
# RdKafkaRecipe is a class that adds some librdkafka specific customizations to
|
21
|
+
# make sure that we can safely build librdkafka when installing this gem
|
22
|
+
class RdKafkaRecipe < MiniPortile
|
23
|
+
attr_accessor :checksum
|
24
|
+
|
25
|
+
def configure
|
26
|
+
execute('configure', %Q(bash configure #{computed_options}))
|
27
|
+
end
|
28
|
+
|
29
|
+
def configured?
|
30
|
+
File.exists?(File.join(work_path, 'Makefile.config'))
|
31
|
+
end
|
32
|
+
|
33
|
+
# Overriding this from MiniPortile because it includes autoconf defaults that
|
34
|
+
# don't apply to librdkafka's mklove-based configure script
|
35
|
+
def configure_defaults
|
36
|
+
[]
|
37
|
+
end
|
38
|
+
|
39
|
+
def download_file(url, full_path, count=3)
|
40
|
+
super(url, full_path, count)
|
41
|
+
|
42
|
+
# Support some simple checksumming
|
43
|
+
unless Digest::MD5.hexdigest(File.read(full_path)) == checksum
|
44
|
+
raise 'Checksum error!'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
################################################################################
|
49
|
+
|
50
|
+
librdkafka = RdKafkaRecipe.new('librdkafka', '0.8.4')
|
51
|
+
librdkafka.files = ["https://github.com/edenhill/librdkafka/archive/#{librdkafka.version}.tar.gz"]
|
52
|
+
librdkafka.checksum = '28a3252fd0f31d4a38bea9cd25083a06'
|
53
|
+
librdkafka.patch_files = Dir["#{File.join(BASE_DIR, 'ext', 'patches', 'librdkafka')}/*.patch"]
|
54
|
+
checkpoint = ".librdkafka.#{librdkafka.version}.cooked"
|
55
|
+
|
56
|
+
unless File.exists?(checkpoint)
|
57
|
+
librdkafka.cook
|
58
|
+
File.open(checkpoint, 'w+') do |f|
|
59
|
+
f.write("Cooked: #{Time.now}\n")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
librdkafka.activate
|
64
|
+
|
65
|
+
HEADER_DIRS = [INCLUDEDIR, File.join(librdkafka.path, 'include')]
|
66
|
+
LIB_DIRS = [LIBDIR]
|
67
|
+
dir_config('rdkafka', HEADER_DIRS, LIB_DIRS)
|
68
|
+
|
69
|
+
# Tell mkmf to staticallly link our mini_portile generated static library,
|
70
|
+
# courtesty of:
|
71
|
+
# <http://blog.zachallett.com/howto-ruby-c-extension-with-a-static-library>
|
72
|
+
$LOCAL_LIBS << File.join(librdkafka.path, 'lib', 'librdkafka.a')
|
73
|
+
|
74
|
+
create_makefile('hermann/hermann_lib')
|