amfetamine 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 0.3.1
2
+ - memcached_instance Dalli::Client configuration setting changes (it should now start with "memcached://")
3
+
1
4
  0.3.0
2
5
  - Caching is now turned off by default in Rails development/test modes
3
6
  - Add `class_name` and `foreign_key` options to relationships, which allows mapping resources to local Amfetamine classes with different names
data/README.md CHANGED
@@ -47,15 +47,22 @@ Create an initializer, note that you can also do this on a per object basis:
47
47
  ```ruby
48
48
  #config/initializers/amfetamine_config.rb
49
49
  Amfetamine::Config.configure do |config|
50
- config.memcached_instance = [HOST:PORT, OPTION1,OPTION2] || HOST:PORT
50
+ config.memcached_instance = "memcached://user:pass@host:port:weight", options_hash # See [Dalli::Client](https://github.com/mperham/dalli/blob/master/lib/dalli/client.rb)
51
51
  config.rest_client = REST_CLIENT
52
52
 
53
53
  # Optional
54
54
  config.resource_suffix = '.json' # The suffix to the path
55
- config.base_uri = 'http://bla.bla/bla/' # If you either need a path or domain infront of your URI, you can do it here. Its advised to use httparty for this.
55
+ config.base_uri = 'http://bla.bla/bla/' # If you either need a path or domain infront of your URI, you can do it here. It's advised to use httparty for this.
56
56
  end
57
57
  ```
58
58
 
59
+ On Heroku your `memcached_instance` variable can look like this (with the memcached addon enabled):
60
+
61
+ ```ruby
62
+ config.memcached_instance = "memcached://#{ENV['MEMCACHE_USERNAME']}:#{ENV['MEMCACHE_PASSWORD']}@#{ENV['MEMCACHE_SERVERS']}:11211"
63
+ ```
64
+
65
+
59
66
  ### 3)
60
67
  Configure your object:
61
68
 
@@ -63,7 +70,7 @@ Configure your object:
63
70
  class Banana < Amfetamine::Base
64
71
  # Right now methods are set dynamically, the older syntax is deprecated. Will move to an or/or situation.
65
72
  # OPTIONAL: Per object configuration
66
- amfetamine_configure memcached_instance: 'localhost:11211',
73
+ amfetamine_configure memcached_instance: 'memcached://localhost:11211',
67
74
  rest_client: BananaRestclient
68
75
 
69
76
  end
data/amfetamine.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "pry"
33
33
 
34
34
  # Runtime dependencies
35
- s.add_runtime_dependency "dalli"
35
+ s.add_runtime_dependency "dalli", ['>= 2.2.1']
36
36
  s.add_runtime_dependency "activesupport" # For helper methods
37
37
  s.add_runtime_dependency "activemodel" # For validations and AM like behaviour
38
38
  s.add_runtime_dependency "json"
@@ -7,9 +7,8 @@ module Amfetamine
7
7
  base.send(:include,ClassAndInstanceMethods)
8
8
  end
9
9
 
10
-
11
- def initialize(server, options={})
12
- @cache_server ||= Dalli::Client.new(server, options)
10
+ def initialize(servers, options={})
11
+ @cache_server ||= Dalli::Client.new(servers, options)
13
12
  end
14
13
 
15
14
  def cache_server
@@ -54,13 +53,10 @@ module Amfetamine
54
53
 
55
54
  module CacheServer
56
55
  private
56
+
57
57
  def cache_server
58
58
  Amfetamine::Config.memcached_instance
59
59
  end
60
-
61
-
62
-
63
60
  end
64
61
  end
65
62
  end
66
-
@@ -9,9 +9,8 @@ module Amfetamine
9
9
  @base_uri ||= ""
10
10
  end
11
11
 
12
- def memcached_instance=(value, options={})
13
- raise ConfigurationInvalid, 'Invalid value for memcached_instance' if !value.is_a?(String)
14
- @memcached_instance ||= Dalli::Client.new(value, options)
12
+ def memcached_instance=(servers, options={})
13
+ @memcached_instance ||= Dalli::Client.new(servers, options)
15
14
  end
16
15
 
17
16
  def rest_client=(value)
@@ -1,3 +1,3 @@
1
1
  module Amfetamine
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amfetamine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -195,7 +195,7 @@ dependencies:
195
195
  requirements:
196
196
  - - ! '>='
197
197
  - !ruby/object:Gem::Version
198
- version: '0'
198
+ version: 2.2.1
199
199
  type: :runtime
200
200
  prerelease: false
201
201
  version_requirements: !ruby/object:Gem::Requirement
@@ -203,7 +203,7 @@ dependencies:
203
203
  requirements:
204
204
  - - ! '>='
205
205
  - !ruby/object:Gem::Version
206
- version: '0'
206
+ version: 2.2.1
207
207
  - !ruby/object:Gem::Dependency
208
208
  name: activesupport
209
209
  requirement: !ruby/object:Gem::Requirement
@@ -333,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
333
  version: '0'
334
334
  segments:
335
335
  - 0
336
- hash: 4163932578961634705
336
+ hash: 764523330913255459
337
337
  required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  none: false
339
339
  requirements:
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  version: '0'
343
343
  segments:
344
344
  - 0
345
- hash: 4163932578961634705
345
+ hash: 764523330913255459
346
346
  requirements: []
347
347
  rubyforge_project: amfetamine
348
348
  rubygems_version: 1.8.24