Skip to content

Commit

Permalink
Update for compatibility to ROM v.1.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalez committed Jan 16, 2016
1 parent bcb8277 commit 965fabc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ before_install:
- ./bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic scholars --partitions 3 --replication-factor 1
- cd ../
rvm:
- '1.9.3'
- '2.0'
- '2.1'
- '2.2'
- '2.3.0'
- ruby-head
- rbx-2 --1.9
- rbx-2 --2.1
- jruby-1.7-19mode
- jruby-1.7-21mode
- jruby-9.0.0.0
- rbx-2
- jruby-9000
- jruby-head
matrix:
allow_failures:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Compatibility

Compatible to [ROM][rom] 0.9+, [Apache Kafka][kafka] 0.8+.

Tested under [rubies compatible to MRI 1.9.3+][rubies].
Tested under [rubies supported by ROM][rubies].

Uses [RSpec][rspec] 3.0+ for testing and [hexx-suit][hexx-suit] for dev/test tools collection.

Expand Down
3 changes: 2 additions & 1 deletion lib/rom/kafka/connection/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class Consumer < Connection
# How long to block until the server sends data.
# NOTE: This is only enforced if min_bytes is > 0.
#
def initialize(opts) # @todo: refactor usinng factory method Connection.build_consumer
# @todo: refactor usinng factory method Connection.build_consumer
def initialize(opts)
super # takes declared attributes from options
args = opts.values_at(:client_id, :brokers, :topic, :partition, :offset)
@connection = DRIVER.consumer_for_partition(*args, attributes)
Expand Down
6 changes: 3 additions & 3 deletions rom-kafka.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |gem|
gem.name = "rom-kafka"
gem.version = "0.0.1"
gem.version = "0.0.2"
gem.author = ["Andrew Kozin"]
gem.email = ["[email protected]"]
gem.summary = "Kafka support for Ruby Object Mapper"
Expand All @@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = "~> 1.9", ">= 1.9.3"

gem.add_runtime_dependency "rom", "~> 1.0"
gem.add_runtime_dependency "poseidon", "~> 0.0", ">= 0.0.5"
gem.add_runtime_dependency "attributes_dsl", ">= 0.0.2"
gem.add_runtime_dependency "poseidon", "0.0.5"
gem.add_runtime_dependency "attributes_dsl", ">= 0.1.1"

gem.add_development_dependency "hexx-rspec", "~> 0.5"
gem.add_development_dependency "inflecto", "~> 0.0", ">= 0.0.2"
Expand Down
23 changes: 9 additions & 14 deletions spec/shared/scholars_topic.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
shared_examples :scholars_topic do
let!(:rom) do
env = ROM::Environment.new
env.use :auto_registration

setup = env.setup(
:kafka, "localhost:9092",
options = {
client_id: "admin",
# use the number of partition as a key
partitioner: -> key, total { key.to_i % total }
)
partitioner: proc { |key, total| key.to_i % total }
}
ROM.container(:kafka, "localhost:9092", options) do |config|
config.use(:macros)

setup.relation(:scholars)
setup.commands(:scholars) do
define(:create)
config.relation(:scholars)
config.commands(:scholars) do
define(:create)
end
end

setup.finalize
setup.env
end

let(:scholars) { rom.relation(:scholars) }
Expand Down

0 comments on commit 965fabc

Please sign in to comment.