s3_uploader 0.2.0 → 0.2.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: 4d6399ae8ff54b55635cf668b0f6b711c907fdb1
4
- data.tar.gz: b3607639a7a60dcaacdbb41963f4f7e5dddfd5bb
3
+ metadata.gz: 8b848eda8fa6b0f9875dfe9c4fab1821a8c1b794
4
+ data.tar.gz: e71958d6cdc905d5834f4a89e06442a04a3d11c0
5
5
  SHA512:
6
- metadata.gz: ebb2a6aab8ddd480ea1dc3f163f92f435f0847cca276fc41dbc937848827690d44e092e4af0ac1eb52ab86c1f3a0cd3577bf6d892417eed355b03cb34b1c5391
7
- data.tar.gz: 81301dba831306bed8f4de9d7323509a477540c8d5da8cc12ecdc4aed5380896f821110a4f5ee824bdce88555c6cb5836ef1608c99191893900e0379adbe1489
6
+ metadata.gz: 73573d90c03156f3db0bfb8963990f62e34c517120d98e16d44d8198b7945629f23844f17d2991d8b7072ec85b6d0e5278768d85193a95ce526a03e0e9212eb7
7
+ data.tar.gz: 872868c71287c74f5e27bf4c61faa597c43b47f7dd44ea58c4d14c8fb27cc89cdea93ab6da74b72bb0877a95d33f0c3f73a2c05475e6de180c922eea7ce57001
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ script: rspec spec
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # S3Uploader
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/s3_uploader.png)](http://badge.fury.io/rb/s3_uploader)
4
+ [![Build Status](https://travis-ci.org/chrishein/s3_uploader.svg?branch=master)](https://travis-ci.org/chrishein/s3_uploader)
4
5
 
5
6
  Multithreaded recursive directory uploader to S3 using [fog](https://github.com/fog/fog).
6
7
 
@@ -60,8 +60,9 @@ module S3Uploader
60
60
  end
61
61
  end
62
62
 
63
- def upload(source, bucket)
64
- raise 'Source directory is requiered' if source.to_s.empty?
63
+ def upload(source_dir, bucket)
64
+ raise 'Source directory is requiered' if source_dir.to_s.empty?
65
+ source = source_dir.dup
65
66
  source << '/' unless source.end_with?('/')
66
67
  raise 'Source must be a directory' unless File.directory?(source)
67
68
 
@@ -1,3 +1,3 @@
1
1
  module S3Uploader
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/s3_uploader.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'fog-aws'
20
20
  gem.add_dependency 'mime-types'
21
21
 
22
- gem.add_development_dependency 'rspec', '~>2.14.1'
22
+ gem.add_development_dependency 'rspec'
23
+ gem.add_development_dependency 'rspec-collection_matchers'
23
24
  gem.add_development_dependency 'rake'
24
25
  end
@@ -45,22 +45,25 @@ describe S3Uploader do
45
45
  end
46
46
 
47
47
  it 'when called with missing access keys it should raise an exception' do
48
- lambda {
48
+ expect {
49
49
  S3Uploader.upload('/tmp', 'mybucket',
50
50
  { destination_dir: 'test1/',
51
51
  s3_key: nil,
52
52
  s3_secret: nil })
53
- }.should raise_error('Missing access keys')
53
+ }.to raise_error('Missing access keys')
54
54
  end
55
55
 
56
56
  it 'when called with source not directory it should raise an exception' do
57
- lambda {
58
- S3Uploader.upload('/xzzaz1232', 'mybucket')
59
- }.should raise_error('Source must be a directory')
57
+ expect {
58
+ S3Uploader.upload('/xzzaz1232', 'mybucket', {
59
+ s3_key: '11111111111',
60
+ s3_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
61
+ })
62
+ }.to raise_error('Source must be a directory')
60
63
  end
61
64
 
62
65
  it 'should upload all files in a directory' do
63
- connection.directories.get('mybucket', prefix: 'test1/').files.empty?.should be_true
66
+ expect(connection.directories.get('mybucket', prefix: 'test1/').files.empty?).to be true
64
67
 
65
68
  S3Uploader.upload(tmp_directory, 'mybucket',
66
69
  { destination_dir: 'test1/',
@@ -73,7 +76,7 @@ describe S3Uploader do
73
76
  end
74
77
 
75
78
  it 'should still support upload_directory static method for backwards compatibility' do
76
- connection.directories.get('mybucket', prefix: 'test1/').files.empty?.should be_true
79
+ expect(connection.directories.get('mybucket', prefix: 'test1/').files.empty?).to be true
77
80
 
78
81
  S3Uploader.upload_directory(tmp_directory, 'mybucket',
79
82
  { destination_dir: 'test1/',
@@ -104,12 +107,12 @@ describe S3Uploader do
104
107
  describe 'gzip' do
105
108
 
106
109
  it "should require a gzip working directory" do
107
- lambda {
110
+ expect {
108
111
  S3Uploader.upload('/tmp', 'mybucket',
109
112
  { logger: logger,
110
113
  connection: connection,
111
114
  gzip: true })
112
- }.should raise_error('gzip_working_dir required when using gzip')
115
+ }.to raise_error('gzip_working_dir required when using gzip')
113
116
  end
114
117
 
115
118
  it 'should compress files before upload when needed' do
@@ -131,9 +134,11 @@ describe S3Uploader do
131
134
 
132
135
  it 'when called with bad gzip_working_dir it should raise an exception' do
133
136
  expect {
134
- S3Uploader.upload(tmp_directory, 'mybucket',
135
- { gzip: true,
136
- gzip_working_dir: File.join(tmp_directory, 'working_dir') })
137
+ S3Uploader.upload(tmp_directory, 'mybucket', {
138
+ s3_key: '11111111111',
139
+ s3_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
140
+ gzip: true,
141
+ gzip_working_dir: File.join(tmp_directory, 'working_dir') })
137
142
  }.to raise_error('gzip_working_dir may not be located within source-folder')
138
143
 
139
144
  expect {
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'rspec'
2
+ require 'rspec/collection_matchers'
2
3
  require 's3_uploader'
3
4
  require 'tmpdir'
4
5
  require 'open3'
5
6
 
6
7
  RSpec.configure do |config|
7
- config.color_enabled = true
8
+ config.color = true
8
9
  config.formatter = 'documentation'
9
- config.treat_symbols_as_metadata_keys_with_true_values = true
10
10
  end
11
11
 
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Hein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-aws
@@ -42,16 +42,30 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.14.1
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-collection_matchers
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
- version: 2.14.1
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +90,7 @@ extra_rdoc_files: []
76
90
  files:
77
91
  - ".gitignore"
78
92
  - ".rspec"
93
+ - ".travis.yml"
79
94
  - Gemfile
80
95
  - LICENSE
81
96
  - README.md