amee 4.3.0 → 4.3.1

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/CHANGELOG.txt CHANGED
@@ -1,5 +1,11 @@
1
1
  = Changelog
2
2
 
3
+ == 4.3.1
4
+ * Bugfix to make caching Rails 3 compatible
5
+
6
+ == 4.3.0
7
+ * Numerous fixes for compatibility with Ruby 1.9.2 and Rails 3.1
8
+
3
9
  == 4.2.0 (also 3.2.0/3.2.1 for Rails 2)
4
10
  * Add algorithm details to ItemDefinitions
5
11
  * Bugfix when using AMEE::Rails.connection from locations other than Rails.root
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.0
1
+ 4.3.1
data/amee.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "amee"
8
- s.version = "4.3.0"
8
+ s.version = "4.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Smith", "James Hetherington", "Andrew Hill", "Andrew Berkeley"]
12
- s.date = "2011-12-23"
12
+ s.date = "2012-01-04"
13
13
  s.email = "james@floppy.org.uk"
14
14
  s.executables = ["ameesh"]
15
15
  s.extra_rdoc_files = [
@@ -298,9 +298,8 @@ module AMEE
298
298
  def cache_key(path)
299
299
  # We have to make sure cache keys don't get too long for the filesystem,
300
300
  # so we cut them off if they're too long and add a digest for uniqueness.
301
- newpath = path.gsub(/[^0-9a-z\/]/i, '')
302
- newpath = (newpath.length < 255) ? newpath : newpath.first(192)+Digest::MD5.hexdigest(newpath)
303
- (@server+newpath)
301
+ newpath = @server + path.gsub(/[^0-9a-z\/]/i, '').gsub(/\//i, '_')
302
+ newpath = (newpath.length < 255) ? newpath : newpath.first(218)+Digest::MD5.hexdigest(newpath)
304
303
  end
305
304
 
306
305
  public
data/spec/cache_spec.rb CHANGED
@@ -76,10 +76,25 @@ describe AMEE::Connection do
76
76
  i = c.item :label => 'biodiesel'
77
77
  end
78
78
 
79
- it "removes special characters from cache keys" do
79
+ it "removes special characters from cache keys, include slashes" do
80
80
  setup_connection
81
- @connection.send(:cache_key, "/%cache/$4/%20test").should eql 'server.example.com/cache/4/20test'
81
+ @connection.send(:cache_key, "/%cache/$4/%20test").should eql 'server.example.com_cache_4_20test'
82
82
  end
83
+
84
+ it "trims cache keys to correct length for filenames, allowing for lock extension" do
85
+ setup_connection
86
+ step = '/123456789'
87
+ test_str = step
88
+ # test lots of string lengths
89
+ while (test_str.length < 300)
90
+ key = @connection.send(:cache_key, test_str)
91
+ key.starts_with?(@connection.server).should be_true
92
+ key.length.should <= 250
93
+ # next
94
+ test_str += step
95
+ end
96
+ end
97
+
83
98
 
84
99
  describe 'and automatic invalidation' do
85
100
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
8
  - 3
9
- - 0
10
- version: 4.3.0
9
+ - 1
10
+ version: 4.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-12-23 00:00:00 Z
21
+ date: 2012-01-04 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  requirement: &id001 !ruby/object:Gem::Requirement