carrierwave-webdav 0.4.2 → 0.4.3
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/.travis.yml +1 -1
- data/lib/carrierwave/storage/webdav.rb +12 -4
- data/lib/carrierwave/webdav/version.rb +1 -1
- data/spec/lib/webdav_spec.rb +29 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 104e3949932f6d0d79ecc6e963ec20e22933ce97
|
4
|
+
data.tar.gz: 3ef2f1fb1586bf186c5a9c44e7e1721beae7bffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172a6e8b9adb899ecdb5fecaeb67e99518554ac49bab2e644b1f9266d8f1147f0a9c74e150f49511b4c096361756ed31d103de63ea42c5ce4aa56cabe378c491
|
7
|
+
data.tar.gz: 2099b07cfcbf6264bfb83e780ce874c6aace8ad37eff9692b8346eeefc0fe163678813b45e78b32df44da29ec0034f55a58b93d2ea50dd6a405e0177ffa590ff
|
data/.travis.yml
CHANGED
@@ -56,7 +56,7 @@ module CarrierWave
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def read
|
59
|
-
res = HTTParty.get(
|
59
|
+
res = HTTParty.get(read_url, options)
|
60
60
|
if res.code != 200
|
61
61
|
raise CarrierWave::IntegrityError.new("Can't download a file: #{res.inspect}")
|
62
62
|
end
|
@@ -64,7 +64,7 @@ module CarrierWave
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def headers
|
67
|
-
res = HTTParty.head(
|
67
|
+
res = HTTParty.head(read_url, options)
|
68
68
|
if res.code != 200
|
69
69
|
raise CarrierWave::IntegrityError.new("Can't headers for a file: #{res.inspect}")
|
70
70
|
end
|
@@ -100,7 +100,11 @@ module CarrierWave
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def url
|
103
|
-
|
103
|
+
if host = uploader.asset_host
|
104
|
+
host.respond_to?(:call) ? host.call(self) : [host, path].join('/')
|
105
|
+
else
|
106
|
+
read_url
|
107
|
+
end
|
104
108
|
end
|
105
109
|
|
106
110
|
alias :content_length :length
|
@@ -109,8 +113,12 @@ module CarrierWave
|
|
109
113
|
|
110
114
|
private
|
111
115
|
|
116
|
+
def read_url
|
117
|
+
"#{server}/#{path}"
|
118
|
+
end
|
119
|
+
|
112
120
|
def write_url
|
113
|
-
@write_server ? "#{@write_server}/#{path}" :
|
121
|
+
@write_server ? "#{@write_server}/#{path}" : read_url
|
114
122
|
end
|
115
123
|
|
116
124
|
def mkcol
|
data/spec/lib/webdav_spec.rb
CHANGED
@@ -91,4 +91,33 @@ describe CarrierWave::Storage::WebDAV do
|
|
91
91
|
expect(@file.read).to eq(webdav_file.read)
|
92
92
|
end
|
93
93
|
|
94
|
+
describe 'File#url' do
|
95
|
+
let(:root) { Pathname.new(@file.path).dirname }
|
96
|
+
let(:path) { @uploader.path.sub(root.to_path, '') }
|
97
|
+
|
98
|
+
before do
|
99
|
+
CarrierWave.configure do |config|
|
100
|
+
config.asset_host = host
|
101
|
+
config.root = root
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when asset_host is set' do
|
106
|
+
let(:host) { 'http://asset.host' }
|
107
|
+
|
108
|
+
it 'path contains asset_host' do
|
109
|
+
@uploader.cache!(@file)
|
110
|
+
expect(@uploader.url).to eq [host, path].join
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'when asset_host is not set' do
|
115
|
+
let(:host) { nil }
|
116
|
+
|
117
|
+
it 'path does not contain asset_host' do
|
118
|
+
@uploader.cache!(@file)
|
119
|
+
expect(@uploader.url).to eq path
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
94
123
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-webdav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Qinix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.5.1
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: WebDAV support for CarrierWave
|
@@ -89,3 +89,4 @@ test_files:
|
|
89
89
|
- spec/lib/webdav_spec.rb
|
90
90
|
- spec/spec_helper.rb
|
91
91
|
- spec/supports/helpers.rb
|
92
|
+
has_rdoc:
|