arproxy 0.1.3 → 0.2.0

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: 191862b3b6b33176695a8d12e0111c25f966dfd7
4
- data.tar.gz: 8862e8f9fd12c7d3d25d40572f4377a798a0a8e7
3
+ metadata.gz: aff4b1e2e9d04fb1cd291d380c0f0e05b078478e
4
+ data.tar.gz: 3ded9580916768e26579b8603fbbc4a229a80bb6
5
5
  SHA512:
6
- metadata.gz: 40fbee48d349461d7306ec13905eb262d1f52d48cb8cdad2cd15dd29e3be0cf6525c3e3848d176109dddd1b138a80c7c0edb40f2a69a1d9b55d2369a392af40b
7
- data.tar.gz: 590181c81ca59b274aa493dafa309e78e8cac06838d329cce93029820d338aa1a2f0fc8756985119660804af34852e13a6ac2563fd0505dbe747e907c8f69f35
6
+ metadata.gz: e0e68d2d7ded1a965e908ba10b5b8dca9d55c1a7fe033363a26b942e44da76b05d5d48e437eaab400ef458be8ff2f47ab29cbb28b4d2b1b0a68ceb097ee25ddd
7
+ data.tar.gz: cd75029e902d7a3b86d11915587004f3c30f746b52b38298eff9bfbd4ea638870bd5121ee4522911ecb1f996300416744fedf8d33b4f4cef4131eaa318735782
@@ -4,6 +4,7 @@ require "arproxy/base"
4
4
  require "arproxy/config"
5
5
  require "arproxy/proxy_chain"
6
6
  require "arproxy/error"
7
+ require "arproxy/plugin"
7
8
 
8
9
  module Arproxy
9
10
 
@@ -12,6 +12,11 @@ module Arproxy
12
12
  @proxies << [proxy_class, options]
13
13
  end
14
14
 
15
+ def plugin(name, *options)
16
+ plugin_class = Plugin.get(name)
17
+ use(plugin_class, *options)
18
+ end
19
+
15
20
  def adapter_class
16
21
  raise Arproxy::Error, "config.adapter must be set" unless @adapter
17
22
  case @adapter
@@ -0,0 +1,28 @@
1
+ module Arproxy
2
+ module Plugin
3
+ class << self
4
+ def register(name, klass)
5
+ name = name.to_s
6
+ @plugins ||= {}
7
+
8
+ if @plugins.has_key?(name)
9
+ raise Arproxy::Error, "Plugin has already been registered: #{name}"
10
+ end
11
+
12
+ @plugins[name] = klass
13
+ end
14
+
15
+ def get(name)
16
+ name = name.to_s
17
+ require "arproxy/plugin/#{name}"
18
+ plugin = @plugins[name]
19
+
20
+ unless plugin
21
+ raise Arproxy::Error, "Plugin is not found: #{name}"
22
+ end
23
+
24
+ plugin
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Arproxy
2
- VERSION = '0.1.3'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Naruta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  description: Arproxy is a proxy between ActiveRecord and database adapter
@@ -30,13 +30,14 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - lib/arproxy.rb
33
34
  - lib/arproxy/base.rb
34
35
  - lib/arproxy/chain_tail.rb
35
36
  - lib/arproxy/config.rb
36
37
  - lib/arproxy/error.rb
38
+ - lib/arproxy/plugin.rb
37
39
  - lib/arproxy/proxy_chain.rb
38
40
  - lib/arproxy/version.rb
39
- - lib/arproxy.rb
40
41
  homepage: https://github.com/cookpad/arproxy
41
42
  licenses: []
42
43
  metadata: {}
@@ -46,17 +47,17 @@ require_paths:
46
47
  - lib
47
48
  required_ruby_version: !ruby/object:Gem::Requirement
48
49
  requirements:
49
- - - '>='
50
+ - - ">="
50
51
  - !ruby/object:Gem::Version
51
52
  version: '0'
52
53
  required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - '>='
55
+ - - ">="
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  requirements: []
58
59
  rubyforge_project:
59
- rubygems_version: 2.0.2
60
+ rubygems_version: 2.4.5
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Proxy between ActiveRecord and DB adapter