em-pg-sequel 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/README.md CHANGED
@@ -10,12 +10,10 @@ Usage
10
10
  require "em-pg-sequel"
11
11
  EM.synchrony do
12
12
  url = "postgres://postgres:postgres@localhost:5432/test"
13
- db = Sequel.connect(url, pool_class: EM::PG::Sequel::ConnectionPool)
13
+ db = Sequel.connect(url, pool_class: EM::PG::ConnectionPool)
14
14
 
15
15
  puts db[:test].all.inspect
16
16
 
17
17
  EM.stop
18
18
  end
19
- ```
20
-
21
- Right now em-pg-client doesn't support this adapter, you should use [my patched fork](https://github.com/fl00r/ruby-em-pg-client).
19
+ ```
data/em-pg-sequel.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "em-pg-sequel"
7
- gem.version = "0.0.1"
7
+ gem.version = "0.0.2"
8
8
  gem.authors = ["Petr Yanovich"]
9
9
  gem.email = ["fl00r@yandex.ru"]
10
10
  gem.description = %q{Sequel adapter for ruby-em-pg-client}
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
- gem.add_dependency "pg"
19
+ gem.add_dependency "em-synchrony"
20
20
  gem.add_dependency "em-pg-client"
21
21
 
22
22
  gem.add_development_dependency "em-synchrony"
data/lib/em-pg-sequel.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'em-synchrony'
1
2
  require 'em-synchrony/pg'
2
3
  require 'sequel'
3
4
  require 'em-pg-sequel/connection_pool'
@@ -29,8 +30,21 @@ module EM::PG
29
30
  end
30
31
  end
31
32
 
32
- PGconn = PG::EM::Client
33
+ module PG::EM
34
+ class SyncClient < Client
35
+ # Dirty hack
36
+ # To avoid patching ruby-em-pg-client and to support Sequel API
37
+ # we should execute async_client asynchronously for em-pg and synchronously for sequel
38
+ def async_exec(*args)
39
+ if block_given?
40
+ super
41
+ else
42
+ exec(*args)
43
+ end
44
+ end
45
+ end
46
+ end
33
47
 
34
- require 'sequel/adapters/postgres'
48
+ PGconn = PG::EM::SyncClient
35
49
 
36
- # Sequel::Postgres::CONVERTED_EXCEPTIONS << ::EM::PG::Error
50
+ require 'sequel/adapters/postgres'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-pg-sequel
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:
@@ -12,7 +12,7 @@ cert_chain: []
12
12
  date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: pg
15
+ name: em-synchrony
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements: