carrierwave_direct 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +6 -4
- data/Changelog.md +30 -0
- data/README.md +7 -7
- data/carrierwave_direct.gemspec +3 -2
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/5.1.gemfile +1 -1
- data/gemfiles/5.2.gemfile +13 -0
- data/lib/carrierwave_direct/action_view_extensions/form_helper.rb +1 -1
- data/lib/carrierwave_direct/form_builder.rb +30 -14
- data/lib/carrierwave_direct/mount.rb +1 -11
- data/lib/carrierwave_direct/policies/aws4_hmac_sha256.rb +93 -0
- data/lib/carrierwave_direct/policies/aws_base64_sha1.rb +57 -0
- data/lib/carrierwave_direct/policies/base.rb +21 -0
- data/lib/carrierwave_direct/test/helpers.rb +1 -1
- data/lib/carrierwave_direct/uploader.rb +42 -77
- data/lib/carrierwave_direct/validations/active_model.rb +2 -2
- data/lib/carrierwave_direct/version.rb +1 -1
- data/spec/form_builder_spec.rb +11 -8
- data/spec/mount_spec.rb +2 -2
- data/spec/orm/activerecord_spec.rb +5 -5
- data/spec/policies/aws4_hmac_sha256_spec.rb +243 -0
- data/spec/policies/aws_base64_sha1_spec.rb +229 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/carrier_wave_config.rb +1 -0
- data/spec/test/helpers_spec.rb +3 -3
- data/spec/uploader_spec.rb +19 -37
- metadata +33 -14
- data/lib/carrierwave_direct/uploader/direct_url.rb +0 -15
- data/spec/uploader/direct_url_spec.rb +0 -26
@@ -1,15 +0,0 @@
|
|
1
|
-
module CarrierWaveDirect
|
2
|
-
module Uploader
|
3
|
-
module DirectUrl
|
4
|
-
|
5
|
-
def direct_fog_url(options = {})
|
6
|
-
if options[:with_path]
|
7
|
-
url
|
8
|
-
else
|
9
|
-
CarrierWave::Storage::Fog::File.new(self, CarrierWave::Storage::Fog.new(self), nil).public_url
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'data/sample_data'
|
5
|
-
|
6
|
-
describe CarrierWaveDirect::Uploader::DirectUrl do
|
7
|
-
|
8
|
-
let(:subject) { DirectUploader.new }
|
9
|
-
|
10
|
-
let(:mounted_subject) { DirectUploader.new(mounted_model, sample(:mounted_as)) }
|
11
|
-
|
12
|
-
describe "#direct_fog_url" do
|
13
|
-
it "should return the result from CarrierWave::Storage::Fog::File#public_url" do
|
14
|
-
expect(subject.direct_fog_url).to eq CarrierWave::Storage::Fog::File.new(
|
15
|
-
subject, nil, nil
|
16
|
-
).public_url
|
17
|
-
end
|
18
|
-
|
19
|
-
context ":with_path => true" do
|
20
|
-
it "should return the full url set by carrierwave" do
|
21
|
-
allow(subject).to receive(:url).and_return("url")
|
22
|
-
expect(subject.direct_fog_url(:with_path => true)).to eq "url"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|