upload_cache 1.3.0 → 1.4.0

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.
Files changed (3) hide show
  1. data/lib/upload_cache.rb +15 -10
  2. data/upload_cache.gemspec +1 -1
  3. metadata +2 -2
data/lib/upload_cache.rb CHANGED
@@ -5,7 +5,7 @@ require 'tmpdir'
5
5
  require 'map'
6
6
 
7
7
  class UploadCache
8
- Version = '1.3.0'
8
+ Version = '1.4.0'
9
9
 
10
10
  Readme = <<-__
11
11
  NAME
@@ -62,7 +62,13 @@ class UploadCache
62
62
  end
63
63
 
64
64
  def url
65
- @url ||= "file:/#{ root }"
65
+ @url ||= (
66
+ if defined?(Rails.root) and Rails.root
67
+ '/system/uploads/cache'
68
+ else
69
+ "file:/#{ root }"
70
+ end
71
+ )
66
72
  end
67
73
 
68
74
  def url=(url)
@@ -70,7 +76,13 @@ class UploadCache
70
76
  end
71
77
 
72
78
  def root
73
- @root ||= Dir.tmpdir
79
+ @root ||= (
80
+ if defined?(Rails.root) and Rails.root
81
+ File.join(Rails.root, 'public', UploadCache.url)
82
+ else
83
+ Dir.tmpdir
84
+ end
85
+ )
74
86
  end
75
87
 
76
88
  def root=(root)
@@ -318,10 +330,3 @@ class UploadCache
318
330
  end
319
331
 
320
332
  Upload_cache = UploadCache unless defined?(Upload_cache)
321
-
322
- if defined?(Rails)
323
- if defined?(Rails.root) and Rails.root
324
- UploadCache.url = '/system/uploads/cache'
325
- UploadCache.root = File.join(Rails.root, 'public', UploadCache.url)
326
- end
327
- end
data/upload_cache.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "upload_cache"
6
- spec.version = "1.3.0"
6
+ spec.version = "1.4.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "upload_cache"
9
9
  spec.description = "description: upload_cache kicks the ass"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upload_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-04 00:00:00.000000000 Z
12
+ date: 2011-12-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'description: upload_cache kicks the ass'
15
15
  email: ara.t.howard@gmail.com