exel 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/exel/providers/local_file_provider.rb +7 -6
- data/lib/exel/remote_value.rb +11 -0
- data/lib/exel/version.rb +1 -1
- data/spec/exel/providers/local_file_provider_spec.rb +16 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546280a360b5092ca3cca1b0e0ae670560c60fb87e0c143b04405f9a5a3de9f9
|
4
|
+
data.tar.gz: 1b4b4f78ae5797c82f12abdd61057f915d1f06f53e775b4b1f502b06e1bea463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0117f598e372c74606421159b405fdd4aa4fa1be3d2d658741ed4163b8c223cc3f75ce68ab0e67adbd495cd53a72b47b8411cf74135b067f2c430f00a3ff70da
|
7
|
+
data.tar.gz: 7a40ed7071070e4799681b750595c78b07326d72859f3824b9e411d94a782147fc94101b0c9466795270b41126a0ad0bbdb3a137185db7ae0ef825a90f3f5f5d
|
data/Gemfile.lock
CHANGED
@@ -6,16 +6,17 @@ module EXEL
|
|
6
6
|
# just works with local files.
|
7
7
|
class LocalFileProvider
|
8
8
|
def upload(file)
|
9
|
-
"file://#{file
|
9
|
+
RemoteValue.new(URI("file://#{File.absolute_path(file)}"))
|
10
10
|
end
|
11
11
|
|
12
|
-
def download(
|
13
|
-
|
14
|
-
|
12
|
+
def download(remote_value)
|
13
|
+
scheme = remote_value.uri.scheme
|
14
|
+
raise "Unsupported URI scheme '#{scheme}'" unless scheme == 'file'
|
15
|
+
File.open(remote_value.uri.path)
|
15
16
|
end
|
16
17
|
|
17
|
-
def self.remote?(
|
18
|
-
|
18
|
+
def self.remote?(value)
|
19
|
+
value.is_a?(RemoteValue)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
data/lib/exel/version.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe EXEL::Providers::LocalFileProvider do
|
4
|
-
let(:file) {
|
4
|
+
let(:file) { File.open(File.expand_path('../../../fixtures/sample.csv', __FILE__)) }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
6
|
+
it 'can upload/download a file' do
|
7
|
+
remote_value = subject.upload(file)
|
8
|
+
expect(remote_value.uri.path).to eq(file.path)
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
expect(subject.download('file:///path/to/file')).to eq(file)
|
16
|
-
end
|
10
|
+
restored_file = subject.download(remote_value)
|
11
|
+
expect(restored_file.path).to eq(file.path)
|
12
|
+
end
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
14
|
+
it 'doesn`t accept URIs for schemes other than file://' do
|
15
|
+
expect { subject.download(RemoteValue.new(URI('s3://bucket/file'))) }.to raise_error "Unsupported URI scheme 's3'"
|
21
16
|
end
|
22
17
|
|
23
18
|
describe '.remote?' do
|
24
|
-
it 'returns true for
|
25
|
-
expect(EXEL::Providers::LocalFileProvider.remote?('file:///path/to/file')).to be_truthy
|
19
|
+
it 'returns true for remote values' do
|
20
|
+
expect(EXEL::Providers::LocalFileProvider.remote?(RemoteValue.new(URI('file:///path/to/file')))).to be_truthy
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns false for file:// URIs' do
|
24
|
+
expect(EXEL::Providers::LocalFileProvider.remote?('file:///path/to/file')).to be_falsey
|
25
|
+
expect(EXEL::Providers::LocalFileProvider.remote?(URI('file:///path/to/file'))).to be_falsey
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns false for anything else' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yroo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/exel/processors/split_processor.rb
|
194
194
|
- lib/exel/providers/local_file_provider.rb
|
195
195
|
- lib/exel/providers/threaded_async_provider.rb
|
196
|
+
- lib/exel/remote_value.rb
|
196
197
|
- lib/exel/sequence_node.rb
|
197
198
|
- lib/exel/value.rb
|
198
199
|
- lib/exel/version.rb
|