bteitelb-paperclip 2.3.1.6 → 2.3.1.7
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/Rakefile +5 -1
- data/lib/paperclip.rb +1 -1
- data/lib/paperclip/attachment.rb +8 -0
- data/lib/paperclip/upfile.rb +3 -2
- metadata +42 -2
data/Rakefile
CHANGED
|
@@ -76,7 +76,11 @@ spec = Gem::Specification.new do |s|
|
|
|
76
76
|
s.rdoc_options << '--line-numbers' << '--inline-source'
|
|
77
77
|
s.requirements << "ImageMagick"
|
|
78
78
|
s.add_development_dependency 'thoughtbot-shoulda'
|
|
79
|
-
s.add_development_dependency 'mocha'
|
|
79
|
+
s.add_development_dependency 'jferris-mocha', '= 0.9.5.0.1241126838'
|
|
80
|
+
s.add_development_dependency 'aws-s3'
|
|
81
|
+
s.add_development_dependency 'sqlite3-ruby'
|
|
82
|
+
s.add_development_dependency 'activerecord'
|
|
83
|
+
s.add_development_dependency 'activesupport'
|
|
80
84
|
end
|
|
81
85
|
|
|
82
86
|
desc "Print a list of the files to be put into the gem"
|
data/lib/paperclip.rb
CHANGED
|
@@ -45,7 +45,7 @@ end
|
|
|
45
45
|
# documentation for Paperclip::ClassMethods for more useful information.
|
|
46
46
|
module Paperclip
|
|
47
47
|
|
|
48
|
-
VERSION = "2.3.1"
|
|
48
|
+
VERSION = "2.3.1.1"
|
|
49
49
|
|
|
50
50
|
class << self
|
|
51
51
|
# Provides configurability to Paperclip. There are a number of options available, such as:
|
data/lib/paperclip/attachment.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
module Paperclip
|
|
3
|
+
require 'mime/types'
|
|
4
|
+
|
|
3
5
|
# The Attachment class manages the files for a given attachment. It saves
|
|
4
6
|
# when the model saves, deletes when the model is destroyed, and processes
|
|
5
7
|
# the file upon assignment.
|
|
@@ -79,6 +81,12 @@ module Paperclip
|
|
|
79
81
|
|
|
80
82
|
@queued_for_write[:original] = uploaded_file.to_tempfile
|
|
81
83
|
instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^A-Za-z\d\.\-_]+/, '_'))
|
|
84
|
+
|
|
85
|
+
# Fix content type when it's application/octet-stream
|
|
86
|
+
# Useful for SWFUpload which resets all content types to this
|
|
87
|
+
if uploaded_file.content_type.to_s.strip == 'application/octet-stream'
|
|
88
|
+
uploaded_file.content_type = MIME::Types.type_for(uploaded_file.original_filename.strip).to_s
|
|
89
|
+
end
|
|
82
90
|
instance_write(:content_type, uploaded_file.content_type.to_s.strip)
|
|
83
91
|
instance_write(:file_size, uploaded_file.size.to_i)
|
|
84
92
|
instance_write(:updated_at, Time.now)
|
data/lib/paperclip/upfile.rb
CHANGED
|
@@ -8,12 +8,13 @@ module Paperclip
|
|
|
8
8
|
def content_type
|
|
9
9
|
type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase
|
|
10
10
|
case type
|
|
11
|
-
when %r"
|
|
11
|
+
when %r"jp(e|g|eg)" then "image/jpeg"
|
|
12
12
|
when %r"tiff?" then "image/tiff"
|
|
13
13
|
when %r"png", "gif", "bmp" then "image/#{type}"
|
|
14
14
|
when "txt" then "text/plain"
|
|
15
15
|
when %r"html?" then "text/html"
|
|
16
|
-
when "
|
|
16
|
+
when "js" then "application/js"
|
|
17
|
+
when "csv", "xml", "css" then "text/#{type}"
|
|
17
18
|
else "application/x-#{type}"
|
|
18
19
|
end
|
|
19
20
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bteitelb-paperclip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.1.
|
|
4
|
+
version: 2.3.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Yurek
|
|
@@ -23,7 +23,47 @@ dependencies:
|
|
|
23
23
|
version: "0"
|
|
24
24
|
version:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
|
-
name: mocha
|
|
26
|
+
name: jferris-mocha
|
|
27
|
+
type: :development
|
|
28
|
+
version_requirement:
|
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.9.5.0.1241126838
|
|
34
|
+
version:
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: aws-s3
|
|
37
|
+
type: :development
|
|
38
|
+
version_requirement:
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0"
|
|
44
|
+
version:
|
|
45
|
+
- !ruby/object:Gem::Dependency
|
|
46
|
+
name: sqlite3-ruby
|
|
47
|
+
type: :development
|
|
48
|
+
version_requirement:
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: "0"
|
|
54
|
+
version:
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: activerecord
|
|
57
|
+
type: :development
|
|
58
|
+
version_requirement:
|
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: "0"
|
|
64
|
+
version:
|
|
65
|
+
- !ruby/object:Gem::Dependency
|
|
66
|
+
name: activesupport
|
|
27
67
|
type: :development
|
|
28
68
|
version_requirement:
|
|
29
69
|
version_requirements: !ruby/object:Gem::Requirement
|