defile 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/app/helpers/attachment_helper.rb +5 -3
- data/defile.gemspec +2 -2
- data/lib/defile/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f8e6a20f25348f1671c4c4ddf10037c5475ed0
|
4
|
+
data.tar.gz: 41055eb0985810b48bae73e1c92e543e4560aed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ea3bc0c3924d79115bca1dde4e1a0c5d45112fd8ee5c595f6ae9fede5545f65faca5f5d31e05608d4fe9ec67b15d4dab5b104edb8247309df9e5c7f624349ed
|
7
|
+
data.tar.gz: 0a1be257941f800934bbdaf3b94e16639a9a521cc4f5f704821093091b41ca65cbc7d1e2300e60a0904def58f95df2647aca65bbc1a429281fa67560ac54fac7
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Defile
|
2
2
|
|
3
|
+
[](https://travis-ci.org/elabs/defile)
|
4
|
+
|
3
5
|
Defile is a modern file upload library for Ruby applications. It is simple, yet
|
4
6
|
powerful. Defile is an attempt by CarrierWave's original author to fix the
|
5
7
|
design mistakes and overengineering in CarrierWave.
|
@@ -210,8 +212,16 @@ application. It cannot generate URLs to your files. This means that you should
|
|
210
212
|
**always** put a CDN or other HTTP cache in front of your application. Serving
|
211
213
|
files through your app takes a lot of resources and you want it to happen rarely.
|
212
214
|
|
213
|
-
|
214
|
-
|
215
|
+
Setting this up is actually quite simple, you can use the same CDN you would use
|
216
|
+
for your application's static assets. [This blog post](http://www.happybearsoftware.com/use-cloudfront-and-the-rails-asset-pipeline-to-speed-up-your-app.html)
|
217
|
+
explains how to set this up (bonus: faster static assets!). Once you've set this
|
218
|
+
up, simply configure Defile to use your CDN:
|
219
|
+
|
220
|
+
``` ruby
|
221
|
+
Defile.host = "//your-dist-url.cloudfront.net"
|
222
|
+
```
|
223
|
+
|
224
|
+
Using a [procol-relative URL](http://www.paulirish.com/2010/the-protocol-relative-url/) for `Defile.host` is recommended.
|
215
225
|
|
216
226
|
### Mounting
|
217
227
|
|
@@ -323,7 +333,7 @@ simply include it like this:
|
|
323
333
|
//= require defile
|
324
334
|
```
|
325
335
|
|
326
|
-
Otherwise you can grab a copy [here](https://raw.githubusercontent.com/
|
336
|
+
Otherwise you can grab a copy [here](https://raw.githubusercontent.com/elabs/defile/master/app/assets/javascripts/defile.js).
|
327
337
|
|
328
338
|
Now mark the field for direct upload:
|
329
339
|
|
@@ -12,11 +12,13 @@ module AttachmentHelper
|
|
12
12
|
|
13
13
|
def attachment_image_tag(record, name, *args, fallback: nil, format: nil, **options)
|
14
14
|
file = record.send(name)
|
15
|
+
classes = ["attachment", record.class.model_name.singular, name, *options[:class]]
|
15
16
|
|
16
17
|
if file
|
17
|
-
image_tag(attachment_url(record, name, *args, format: format), options)
|
18
|
+
image_tag(attachment_url(record, name, *args, format: format), options.merge(class: classes))
|
18
19
|
elsif fallback
|
19
|
-
|
20
|
+
classes << "fallback"
|
21
|
+
image_tag(fallback, options.merge(class: classes))
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
@@ -44,7 +46,7 @@ module AttachmentHelper
|
|
44
46
|
options[:data][:as] = signature.as
|
45
47
|
end
|
46
48
|
end
|
47
|
-
hidden_field(object_name, :"#{method}_cache_id", options) +
|
49
|
+
hidden_field(object_name, :"#{method}_cache_id", options.slice(:object)) +
|
48
50
|
file_field(object_name, method, options)
|
49
51
|
end
|
50
52
|
end
|
data/defile.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "capybara"
|
28
28
|
spec.add_development_dependency "pry"
|
29
29
|
spec.add_development_dependency "aws-sdk"
|
30
|
-
spec.add_development_dependency "rack-test"
|
31
|
-
spec.add_development_dependency "rails"
|
30
|
+
spec.add_development_dependency "rack-test", "~> 0.6.2"
|
31
|
+
spec.add_development_dependency "rails", "~> 4.1.8"
|
32
32
|
spec.add_development_dependency "sqlite3"
|
33
33
|
spec.add_development_dependency "selenium-webdriver"
|
34
34
|
end
|
data/lib/defile/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Nicklas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,30 +126,30 @@ dependencies:
|
|
126
126
|
name: rack-test
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.6.2
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.6.2
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rails
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 4.1.8
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 4.1.8
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: sqlite3
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|