exel-s3 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8936d6a5957afc15092d755de27ebfdc8f8b5538
4
- data.tar.gz: 73473d824eeb3851f0bc58700805abe63bb682d3
3
+ metadata.gz: a4a51332e89651de73f2713f7cdb409c91290199
4
+ data.tar.gz: 60e49619e30c0cf1997aff639cf7fa3c81f45011
5
5
  SHA512:
6
- metadata.gz: 8e8fda44139bedd03056d12abbf883d96e9ca29812754983554699cf397dbd6b629fd51c18d255c30303dc3caa6198b09a28e4f0d9ca4007d10f63877c2c186a
7
- data.tar.gz: 4e14a6f528fe780dc68be98ccaae651ad0ebf56e6da467784973d12a98e90b148fb0364d3f6da403f750ac86dbf3e7e38bef2fa8147f47142a7f9746094b4744
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
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in exel-s3.gemspec
4
4
  gemspec
5
-
6
- gem 'exel', git: 'https://github.com/47colborne/exel'
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # EXEL::S3
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/exel-s3.svg)](https://badge.fury.io/rb/exel-s3)
3
4
  [![Build Status](https://snap-ci.com/47colborne/exel-s3/branch/master/build_image)](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
@@ -19,6 +19,8 @@ module EXEL
19
19
  obj.get(response_target: file)
20
20
  file.set_encoding(Encoding::UTF_8)
21
21
  file
22
+ rescue Aws::S3::Errors::NoSuchKey => e
23
+ raise EXEL::Error::JobTermination, "Aws::S3::Errors::NoSuchKey: #{e.message}"
22
24
  end
23
25
 
24
26
  def get_object(filename)
@@ -1,5 +1,5 @@
1
1
  module EXEL
2
2
  module S3
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'.freeze
4
4
  end
5
5
  end
@@ -1,14 +1,14 @@
1
1
  module EXEL
2
2
  module S3
3
3
  describe S3Provider do
4
- describe '#get_object' do
5
- before do
6
- EXEL.configure do |config|
7
- config.aws = OpenStruct.new
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
- it 'downloads the file from s3' do
37
- file = double(:file)
38
- s3_object = double(:s3_object)
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
- expect(subject).to receive(:get_object).with('abc.txt').and_return(s3_object)
41
- expect(Tempfile).to receive(:new).with('abc.txt', encoding: Encoding::ASCII_8BIT).and_return(file)
42
- expect(s3_object).to receive(:get).with(hash_including(response_target: file)).and_return(file)
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.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: 2015-12-15 00:00:00.000000000 Z
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