paperclip-remote 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/lib/paperclip/remote.rb +21 -6
- metadata +58 -16
data/README.rdoc
CHANGED
data/lib/paperclip/remote.rb
CHANGED
@@ -19,21 +19,36 @@ require 'open-uri'
|
|
19
19
|
module Paperclip::Remote
|
20
20
|
|
21
21
|
def has_attached_file_with_remote(name, options = {})
|
22
|
-
has_attached_file_without_remote(name, options)
|
22
|
+
original = has_attached_file_without_remote(name, options)
|
23
|
+
return original unless attachment_definitions[name][:remote]
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
attr_reader :"#{name}_remote_url"
|
26
|
+
define_method :"#{name}_remote_url=" do |string|
|
27
|
+
url = URI(string.presence) rescue nil
|
28
|
+
url = nil unless URI::HTTP === url
|
29
|
+
instance_variable_set(:"@#{name}_remote_url", url)
|
30
|
+
end
|
31
|
+
|
32
|
+
before_validation do |record|
|
33
|
+
url = record.send(:"#{name}_remote_url")
|
34
|
+
break unless url.present?
|
26
35
|
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
begin
|
37
|
+
if Paperclip::VERSION < "3.1.4"
|
38
|
+
io = open(url.to_s)
|
30
39
|
def io.original_filename
|
31
40
|
File.basename(base_uri.path)
|
32
41
|
end
|
33
42
|
send :"#{name}=", io
|
43
|
+
else
|
44
|
+
record.send(:"#{name}_remote_url=", nil) # Reset!
|
45
|
+
send :"#{name}=", url
|
34
46
|
end
|
47
|
+
rescue OpenURI::HTTPError
|
35
48
|
end
|
36
49
|
end
|
50
|
+
|
51
|
+
original
|
37
52
|
end
|
38
53
|
|
39
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: paperclip
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rspec
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: webmock
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
|
-
name: sqlite3
|
60
|
-
requirement:
|
79
|
+
name: sqlite3
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,7 +85,28 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rails
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
69
110
|
description: Allows fetching attachments from remote locations
|
70
111
|
email: dimitrij@blacksquaremedia.com
|
71
112
|
executables: []
|
@@ -74,8 +115,8 @@ extra_rdoc_files: []
|
|
74
115
|
files:
|
75
116
|
- LICENSE
|
76
117
|
- README.rdoc
|
77
|
-
- lib/paperclip-remote.rb
|
78
118
|
- lib/paperclip/remote.rb
|
119
|
+
- lib/paperclip-remote.rb
|
79
120
|
- lib/paperclip_remote.rb
|
80
121
|
- rails/init.rb
|
81
122
|
homepage: https://github.com/bsm/paperclip-remote
|
@@ -98,8 +139,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
139
|
version: 1.3.6
|
99
140
|
requirements: []
|
100
141
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.25
|
102
143
|
signing_key:
|
103
144
|
specification_version: 3
|
104
145
|
summary: Plugin for Paperclip
|
105
146
|
test_files: []
|
147
|
+
has_rdoc:
|