morlock 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/morlock/rails.rb CHANGED
@@ -3,8 +3,8 @@ require 'morlock/base'
3
3
 
4
4
  class Morlock
5
5
  class MorlockRailtie < ::Rails::Railtie
6
- config.after_initialize do
7
- if defined?(ActiveSupport::Cache::MemCacheStore) && Rails.cache.is_a?(ActiveSupport::Cache::MemCacheStore) && Rails.cache.instance_variable_get(:@data)
6
+ def self.setup_for_mem_cache_store
7
+ if Rails.cache.instance_variable_get(:@data)
8
8
  Rails.module_eval do
9
9
  class << self
10
10
  def morlock
@@ -12,9 +12,26 @@ class Morlock
12
12
  end
13
13
  end
14
14
  end
15
+ end
16
+ end
17
+
18
+ def self.setup_for_dalli_store
19
+ self.setup_for_mem_cache_store
20
+ end
21
+
22
+ def self.detect_memcache_gem
23
+ if defined?(ActiveSupport::Cache::MemCacheStore) && Rails.cache.is_a?(ActiveSupport::Cache::MemCacheStore)
24
+ setup_for_mem_cache_store
25
+ elsif defined?(ActiveSupport::Cache::DalliStore) && Rails.cache.is_a?(ActiveSupport::Cache::DalliStore)
26
+ setup_for_dalli_store
15
27
  else
16
28
  Rails.logger.warn "WARNING: Morlock detected that you are not using the Rails ActiveSupport::Cache::MemCacheStore. Rails.morlock will not be setup."
17
29
  end
30
+
31
+ end
32
+
33
+ config.after_initialize do
34
+ detect_memcache_gem
18
35
  end
19
36
  end
20
37
  end
@@ -1,3 +1,3 @@
1
1
  class Morlock
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morlock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-07 00:00:00.000000000 Z
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70321470471640 !ruby/object:Gem::Requirement
16
+ requirement: &70342324414200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70321470471640
24
+ version_requirements: *70342324414200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rr
27
- requirement: &70321470471160 !ruby/object:Gem::Requirement
27
+ requirement: &70342324413700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70321470471160
35
+ version_requirements: *70342324413700
36
36
  description: ''
37
37
  email:
38
38
  - pair+andrew+chris@mavenlink.com