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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ba96d8739fae1bd6383eefdca4c8b9ac0d92adb
4
- data.tar.gz: 729dce87ad0b0af4625c5e346d824fab9da722e2
3
+ metadata.gz: 84cc06b313ddc9f160196e61b36307ea6654d979
4
+ data.tar.gz: 181e3671a18a1d2c56cd97134cab2969ccdb4bcd
5
5
  SHA512:
6
- metadata.gz: f02d90058a7576744d706e56df923b306645505196e896b30c2eac19a5e833ddf2f803ffebc3e34640a01231e6fd4557677e7a5aec2f2d811288e768fac3d077
7
- data.tar.gz: 2f916377721b7b7c2316c5da4a23ddd697cdedc49a5e2f2e3cb1119c33a935704dd6c03c0534e574b3ca52a565cc91c88114ac43da327ec737155b7a3b699ba7
6
+ metadata.gz: 6f4d6a4787d47bd693cffa4499ff1160e2632625c1de3d89b565b4144bbbed89ac52d9340f2dd052f9aab75b3d7b505c2495b013df0858eebfffa26d58ad8ed3
7
+ data.tar.gz: e66731899aa80963b5cb478a04860680f3a428b1e581b10425da4fe1bda9f4b068d7f15ac2263ffea9609485cf4df11dffff6144124259bf5cbc9863f56e2500
data/.travis.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.8.7"
4
- - "1.9.2"
5
3
  - "1.9.3"
6
4
  - "2.0.0"
7
5
  - "2.1"
8
6
  - "2.2"
7
+ - "2.3.0"
9
8
  - "jruby"
10
- - "rbx-2"
11
9
  script: bundle exec rspec spec
10
+ before_install:
11
+ - gem install bundler
data/Gemfile CHANGED
@@ -6,7 +6,3 @@ group :development do
6
6
  gem 'pry'
7
7
  gem 'rake'
8
8
  end
9
-
10
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' && RUBY_VERSION >= '2.0'
11
- gem "rubysl", "~> 2.0", :group => :development
12
- end
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.12'
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
- Dragonfly has been tested with ruby versions 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.x, 2.2.x, jruby 1.7.8 and rubinius 2.2.
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
  ===========================
@@ -10,11 +10,14 @@ route %(
10
10
  route "root :to => 'photos#index'"
11
11
  run "rm -rf public/index.html"
12
12
 
13
- inject_into_file 'app/models/photo.rb', :after => "class Photo < ActiveRecord::Base\n" do
14
- %(
15
- attr_accessible :image rescue nil
16
- dragonfly_accessor :image
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
- spec.add_runtime_dependency("rack", [">= 1.3.0"])
25
- spec.add_runtime_dependency("multi_json", ["~> 1.0"])
26
- spec.add_runtime_dependency("addressable", ["~> 2.3"])
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
- spec.add_development_dependency("activemodel")
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
- response = http.get(url.request_uri)
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
@@ -34,7 +34,7 @@ module Dragonfly
34
34
  end
35
35
 
36
36
  def uri_escape_segment(string)
37
- Rack::Utils.escape_path(string)
37
+ URI.encode_www_form_component(string).gsub('+','%20')
38
38
  end
39
39
 
40
40
  def uri_unescape(string)
@@ -1,3 +1,3 @@
1
1
  module Dragonfly
2
- VERSION = '1.0.12'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -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 do |content, opts|
151
- content.data.should == "HELLO"
152
- end
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 do |content, opts|
158
- content.data.should == "HELLO"
159
- content.meta.should == {'d' => 3}
160
- opts.should == {:a => :b}
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 do |content, opts|
1035
- content.data.should == 'hello'
1036
- end.and_return('new/uid')
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 do |job, env|
7
- job.to_a.should == array
8
- end.and_return(double('response', :to_response => [200, {'Content-Type' => 'text/plain'}, ["OK"]]))
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) {
@@ -57,4 +57,8 @@ RSpec::Matchers.define :increase_num_tempfiles do
57
57
  puts "Num tempfiles increased: #{num_tempfiles_before} -> #{num_tempfiles_after}" if increased
58
58
  increased
59
59
  end
60
+
61
+ def supports_block_expectations?
62
+ true
63
+ end
60
64
  end
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.12
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: 2015-09-16 00:00:00.000000000 Z
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.0
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.0
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.4.6
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.