exel-s3 1.0.0 → 1.0.1
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/.rubocop.yml +5 -4
- data/Gemfile +0 -2
- data/README.md +1 -0
- data/exel-s3.gemspec +0 -1
- data/lib/exel/s3/s3_provider.rb +2 -0
- data/lib/exel/s3/version.rb +1 -1
- data/spec/exel/s3/s3_provider_spec.rb +24 -13
- data/spec/spec_helper.rb +7 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4a51332e89651de73f2713f7cdb409c91290199
|
4
|
+
data.tar.gz: 60e49619e30c0cf1997aff639cf7fa3c81f45011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc119e9472e9e3d51f154acd0ad85c4c378fc999aae10fcf356f81856747e65c53c36365605eae46dea82678c66c0b85ecced8b560baa1ceebab6f8516305f5d
|
7
|
+
data.tar.gz: 2ad70a38198db0c9225ec6ebeca69437f13de25625bda08847bf4d3b921f281f1b938ed522b0ca73f2e2907ce64705a916ff09d3aaec4e1f121475d8f04efa23
|
data/.rubocop.yml
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
require:
|
2
|
-
- rubocop-rspec
|
3
2
|
- rubocop/rspec/focused
|
4
3
|
|
5
4
|
inherit_from: .rubocop_todo.yml
|
6
5
|
|
7
6
|
AllCops:
|
7
|
+
TargetRubyVersion: 2.3
|
8
8
|
DisplayStyleGuide: true
|
9
|
+
DisplayCopNames: true
|
9
10
|
|
10
11
|
Metrics/LineLength:
|
11
12
|
Max: 120
|
12
13
|
|
14
|
+
Style/FrozenStringLiteralComment:
|
15
|
+
Enabled: false
|
16
|
+
|
13
17
|
Style/SpaceInsideHashLiteralBraces:
|
14
18
|
EnforcedStyle: no_space
|
15
|
-
|
16
|
-
RSpec/DescribedClass:
|
17
|
-
Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# EXEL::S3
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/exel-s3)
|
3
4
|
[](https://snap-ci.com/47colborne/exel-s3/branch/master)
|
4
5
|
|
5
6
|
This gem implements a "remote provider" for [EXEL](https://github.com/47colborne/exel) using Amazon S3. The remote provider is used when an async command is executed and a context shift occurs. Its job is to move the context to a remote storage location when the async call is initiated, and retrieve it before the async block is executed.
|
data/exel-s3.gemspec
CHANGED
@@ -30,6 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'terminal-notifier', '~> 1'
|
31
31
|
spec.add_development_dependency 'terminal-notifier-guard', '~> 1'
|
32
32
|
spec.add_development_dependency 'rubocop', '~> 0'
|
33
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1'
|
34
33
|
spec.add_development_dependency 'rubocop-rspec-focused', '~> 0'
|
35
34
|
end
|
data/lib/exel/s3/s3_provider.rb
CHANGED
data/lib/exel/s3/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module EXEL
|
2
2
|
module S3
|
3
3
|
describe S3Provider do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
config.s3_bucket = 'bucket'
|
9
|
-
end
|
4
|
+
before :all do
|
5
|
+
EXEL.configure do |config|
|
6
|
+
config.aws = OpenStruct.new
|
7
|
+
config.s3_bucket = 'bucket'
|
10
8
|
end
|
9
|
+
end
|
11
10
|
|
11
|
+
describe '#get_object' do
|
12
12
|
it 'has the correct bucket and file names' do
|
13
13
|
file_name = 'abc.txt'
|
14
14
|
s3_obj = subject.get_object(file_name)
|
@@ -33,17 +33,28 @@ module EXEL
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#download' do
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
let(:file) { double(:file) }
|
37
|
+
let(:s3_object) { double(:s3_object) }
|
38
|
+
|
39
|
+
before do
|
40
|
+
allow(subject).to receive(:get_object).with('abc.txt').and_return(s3_object)
|
41
|
+
allow(Tempfile).to receive(:new).with('abc.txt', encoding: Encoding::ASCII_8BIT).and_return(file)
|
42
|
+
end
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
expect(file).to receive(:set_encoding).with(Encoding::UTF_8)
|
44
|
+
it 'downloads the file from s3' do
|
45
|
+
allow(s3_object).to receive(:get).with(hash_including(response_target: file)).and_return(file)
|
46
|
+
allow(file).to receive(:set_encoding).with(Encoding::UTF_8)
|
44
47
|
|
45
48
|
expect(subject.download('s3://abc.txt')).to eq(file)
|
46
49
|
end
|
50
|
+
|
51
|
+
context 'when s3 object does not exist' do
|
52
|
+
it 'raises an EXEL::Error:JobTermination error' do
|
53
|
+
allow(s3_object).to receive(:get).and_raise(Aws::S3::Errors::NoSuchKey.new(nil, 'key'))
|
54
|
+
|
55
|
+
expect { subject.download('s3://abc.txt') }.to raise_error EXEL::Error::JobTermination
|
56
|
+
end
|
57
|
+
end
|
47
58
|
end
|
48
59
|
|
49
60
|
describe '.remote?' do
|
data/spec/spec_helper.rb
CHANGED
@@ -3,3 +3,10 @@ require 'exel'
|
|
3
3
|
Dir[File.expand_path('../../lib/**/*.rb', __FILE__)].each { |f| require f }
|
4
4
|
|
5
5
|
EXEL.logger = nil
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.filter_run focus: true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
|
11
|
+
config.order = 'random'
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exel-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yroo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: exel
|
@@ -164,20 +164,6 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rubocop-rspec
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '1'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
168
|
name: rubocop-rspec-focused
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|