dragonfly 1.0.12 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dragonfly might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/Gemfile +0 -4
- data/History.md +12 -0
- data/README.md +6 -2
- data/dev/rails_template.rb +8 -6
- data/dragonfly.gemspec +16 -21
- data/lib/dragonfly/job/fetch_url.rb +9 -1
- data/lib/dragonfly/utils.rb +1 -1
- data/lib/dragonfly/version.rb +1 -1
- data/spec/dragonfly/app_spec.rb +8 -8
- data/spec/dragonfly/job/fetch_url_spec.rb +6 -0
- data/spec/dragonfly/model/model_spec.rb +4 -3
- data/spec/functional/urls_spec.rb +4 -3
- data/spec/support/simple_matchers.rb +4 -0
- metadata +6 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84cc06b313ddc9f160196e61b36307ea6654d979
|
4
|
+
data.tar.gz: 181e3671a18a1d2c56cd97134cab2969ccdb4bcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f4d6a4787d47bd693cffa4499ff1160e2632625c1de3d89b565b4144bbbed89ac52d9340f2dd052f9aab75b3d7b505c2495b013df0858eebfffa26d58ad8ed3
|
7
|
+
data.tar.gz: e66731899aa80963b5cb478a04860680f3a428b1e581b10425da4fe1bda9f4b068d7f15ac2263ffea9609485cf4df11dffff6144124259bf5cbc9863f56e2500
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
1.1.0 (2016-10-24)
|
2
|
+
===================
|
3
|
+
Fixes
|
4
|
+
-----
|
5
|
+
- Fetch a URL with basic auth if it's present in the URI (Ben Pickles)
|
6
|
+
- Fix rack version problem for older rubies (rack 2.0 only works for ruby >= 2.2.2)
|
7
|
+
- Updated deprecated syntax in tests for WebMock, RSpec
|
8
|
+
|
9
|
+
Changes
|
10
|
+
--------
|
11
|
+
- Dropped official support for Ruby <= 1.9.2 and Rubinius
|
12
|
+
|
1
13
|
1.0.12 (2015-09-16)
|
2
14
|
===================
|
3
15
|
Features
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Installation
|
|
44
44
|
|
45
45
|
or in your Gemfile
|
46
46
|
```ruby
|
47
|
-
gem 'dragonfly', '~> 1.0
|
47
|
+
gem 'dragonfly', '~> 1.1.0'
|
48
48
|
```
|
49
49
|
|
50
50
|
Require with
|
@@ -73,13 +73,17 @@ Issues
|
|
73
73
|
======
|
74
74
|
Please use the <a href="http://github.com/markevans/dragonfly/issues">github issue tracker</a> if you have any issues.
|
75
75
|
|
76
|
+
Known Issues
|
77
|
+
============
|
78
|
+
There are known issues when using with json gem version 1.5.2 which can potentially cause an "incorrect sha" error for files with non-ascii characters in the name. Please see https://github.com/markevans/dragonfly/issues/387 for more information.
|
79
|
+
|
76
80
|
Suggestions/Questions
|
77
81
|
=====================
|
78
82
|
<a href="http://groups.google.com/group/dragonfly-users">Google group dragonfly-users</a>
|
79
83
|
|
80
84
|
Ruby Versions
|
81
85
|
=============
|
82
|
-
|
86
|
+
See [Travis-CI](https://travis-ci.org/markevans/dragonfly) for tested versions.
|
83
87
|
|
84
88
|
Upgrading from v0.9 to v1.0
|
85
89
|
===========================
|
data/dev/rails_template.rb
CHANGED
@@ -10,11 +10,14 @@ route %(
|
|
10
10
|
route "root :to => 'photos#index'"
|
11
11
|
run "rm -rf public/index.html"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
possible_base_classes = ['ActiveRecord::Base', 'ApplicationRecord']
|
14
|
+
possible_base_classes.each do |base_class|
|
15
|
+
inject_into_file 'app/models/photo.rb', :after => "class Photo < #{base_class}\n" do
|
16
|
+
%(
|
17
|
+
attr_accessible :image rescue nil
|
18
|
+
dragonfly_accessor :image
|
19
|
+
)
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
gsub_file 'app/views/photos/_form.html.erb', /^.*:image_.*$/, ''
|
@@ -35,4 +38,3 @@ gsub_file "app/controllers/photos_controller.rb", "permit(", "permit(:image, "
|
|
35
38
|
append_file 'app/views/photos/show.html.erb', %(
|
36
39
|
<%= image_tag @photo.image.thumb('300x300').url if @photo.image_uid? %>
|
37
40
|
)
|
38
|
-
|
data/dragonfly.gemspec
CHANGED
@@ -21,30 +21,25 @@ Gem::Specification.new do |spec|
|
|
21
21
|
"README.md"
|
22
22
|
]
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
spec.add_development_dependency("rspec", ["~> 2.5"])
|
29
|
-
spec.add_development_dependency("webmock")
|
30
|
-
if RUBY_VERSION < '1.9.3'
|
31
|
-
spec.add_development_dependency("activemodel", '~> 3.2')
|
32
|
-
spec.add_development_dependency("i18n", '~> 0.6.11')
|
24
|
+
# Rack 2.0 only works with ruby >= 2.2.2
|
25
|
+
if RUBY_VERSION < "2.2.2"
|
26
|
+
rack_version = "~> 1.3"
|
27
|
+
activemodel_version = "~> 4.2"
|
33
28
|
else
|
34
|
-
|
29
|
+
rack_version = ">= 1.3"
|
30
|
+
activemodel_version = nil
|
35
31
|
end
|
32
|
+
|
33
|
+
# Runtime dependencies
|
34
|
+
spec.add_runtime_dependency("rack", rack_version)
|
35
|
+
spec.add_runtime_dependency("multi_json", "~> 1.0")
|
36
|
+
spec.add_runtime_dependency("addressable", "~> 2.3")
|
37
|
+
|
38
|
+
# Development dependencies
|
39
|
+
spec.add_development_dependency("rspec", "~> 2.5")
|
40
|
+
spec.add_development_dependency("webmock")
|
41
|
+
spec.add_development_dependency("activemodel", activemodel_version)
|
36
42
|
if RUBY_PLATFORM == "java"
|
37
43
|
spec.add_development_dependency("jruby-openssl")
|
38
44
|
end
|
39
|
-
spec.post_install_message =<<-POST_INSTALL_MESSAGE
|
40
|
-
================================================================================
|
41
|
-
|
42
|
-
You've installed Dragonfly hooray!!
|
43
|
-
|
44
|
-
Quite a few things have changed since version 0.9.
|
45
|
-
Please check the documentation at <http://markevans.github.io/dragonfly>
|
46
|
-
and see upgrade notes at <https://github.com/markevans/dragonfly/wiki/Upgrading-from-0.9-to-1.0> if upgrading.
|
47
|
-
|
48
|
-
================================================================================
|
49
|
-
POST_INSTALL_MESSAGE
|
50
45
|
end
|
@@ -65,9 +65,17 @@ module Dragonfly
|
|
65
65
|
|
66
66
|
def get(url)
|
67
67
|
url = parse_url(url)
|
68
|
+
|
68
69
|
http = Net::HTTP.new(url.host, url.port)
|
69
70
|
http.use_ssl = true if url.scheme == 'https'
|
70
|
-
|
71
|
+
|
72
|
+
request = Net::HTTP::Get.new(url.request_uri)
|
73
|
+
|
74
|
+
if url.user || url.password
|
75
|
+
request.basic_auth(url.user, url.password)
|
76
|
+
end
|
77
|
+
|
78
|
+
http.request(request)
|
71
79
|
end
|
72
80
|
|
73
81
|
def update_from_data_uri
|
data/lib/dragonfly/utils.rb
CHANGED
data/lib/dragonfly/version.rb
CHANGED
data/spec/dragonfly/app_spec.rb
CHANGED
@@ -147,18 +147,18 @@ describe Dragonfly::App do
|
|
147
147
|
let (:app) { test_app }
|
148
148
|
|
149
149
|
it "should allow just storing content" do
|
150
|
-
app.datastore.should_receive(:write).with
|
151
|
-
content.data
|
152
|
-
|
150
|
+
app.datastore.should_receive(:write).with(
|
151
|
+
satisfy{|content| content.data == 'HELLO'},
|
152
|
+
anything
|
153
|
+
)
|
153
154
|
app.store("HELLO")
|
154
155
|
end
|
155
156
|
|
156
157
|
it "passes meta and options through too" do
|
157
|
-
app.datastore.should_receive(:write).with
|
158
|
-
content.data.
|
159
|
-
|
160
|
-
|
161
|
-
end
|
158
|
+
app.datastore.should_receive(:write).with(
|
159
|
+
satisfy{|content| content.data == 'HELLO' && content.meta == {'d' => 3} },
|
160
|
+
{a: :b}
|
161
|
+
)
|
162
162
|
app.store("HELLO", {'d' => 3}, {:a => :b})
|
163
163
|
end
|
164
164
|
end
|
@@ -30,6 +30,12 @@ describe Dragonfly::Job::FetchUrl do
|
|
30
30
|
job.data.should == "secure result!"
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'should also work with basic auth' do
|
34
|
+
stub_request(:get, 'http://example.com').with(basic_auth: ['user', 'pass']).to_return(:body => 'basic auth')
|
35
|
+
job.fetch_url!('http://user:pass@example.com')
|
36
|
+
job.data.should == 'basic auth'
|
37
|
+
end
|
38
|
+
|
33
39
|
[
|
34
40
|
"place.com",
|
35
41
|
"http://place.com",
|
@@ -1031,9 +1031,10 @@ describe "models" do
|
|
1031
1031
|
it "should return the saved stuff if assigned and retained" do
|
1032
1032
|
@item.preview_image = 'hello'
|
1033
1033
|
@item.preview_image.name = 'dog.biscuit'
|
1034
|
-
@app.datastore.should_receive(:write).with
|
1035
|
-
content.data
|
1036
|
-
|
1034
|
+
@app.datastore.should_receive(:write).with(
|
1035
|
+
satisfy{|content| content.data == 'hello' },
|
1036
|
+
anything
|
1037
|
+
).and_return('new/uid')
|
1037
1038
|
@item.preview_image.retain!
|
1038
1039
|
Dragonfly::Serializer.json_b64_decode(@item.retained_preview_image).should == {
|
1039
1040
|
'uid' => 'new/uid',
|
@@ -3,9 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe "urls" do
|
4
4
|
|
5
5
|
def job_should_match(array)
|
6
|
-
Dragonfly::Response.should_receive(:new).with
|
7
|
-
job.to_a
|
8
|
-
|
6
|
+
Dragonfly::Response.should_receive(:new).with(
|
7
|
+
satisfy{|job| job.to_a == array },
|
8
|
+
instance_of(Hash)
|
9
|
+
).and_return(double('response', :to_response => [200, {'Content-Type' => 'text/plain'}, ["OK"]]))
|
9
10
|
end
|
10
11
|
|
11
12
|
let (:app) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.3
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.3
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,16 +243,7 @@ homepage: http://github.com/markevans/dragonfly
|
|
243
243
|
licenses:
|
244
244
|
- MIT
|
245
245
|
metadata: {}
|
246
|
-
post_install_message:
|
247
|
-
================================================================================
|
248
|
-
|
249
|
-
You've installed Dragonfly hooray!!
|
250
|
-
|
251
|
-
Quite a few things have changed since version 0.9.
|
252
|
-
Please check the documentation at <http://markevans.github.io/dragonfly>
|
253
|
-
and see upgrade notes at <https://github.com/markevans/dragonfly/wiki/Upgrading-from-0.9-to-1.0> if upgrading.
|
254
|
-
|
255
|
-
================================================================================
|
246
|
+
post_install_message:
|
256
247
|
rdoc_options: []
|
257
248
|
require_paths:
|
258
249
|
- lib
|
@@ -268,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
259
|
version: '0'
|
269
260
|
requirements: []
|
270
261
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
262
|
+
rubygems_version: 2.5.1
|
272
263
|
signing_key:
|
273
264
|
specification_version: 4
|
274
265
|
summary: Ideal gem for handling attachments in Rails, Sinatra and Rack applications.
|