tus-server 0.2.0 → 0.9.0

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.
data/tus-server.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "tus-server"
3
- gem.version = "0.2.0"
3
+ gem.version = "0.9.0"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
7
- gem.summary = "Ruby server implementation of the Open Protocol for Resumable File Uploads."
7
+ gem.summary = "Ruby server implementation of tus.io, the open protocol for resumable file uploads."
8
8
 
9
9
  gem.homepage = "https://github.com/janko-m/tus-ruby-server"
10
10
  gem.authors = ["Janko Marohnić"]
@@ -20,4 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_development_dependency "minitest", "~> 5.8"
21
21
  gem.add_development_dependency "rack-test_app"
22
22
  gem.add_development_dependency "mongo"
23
+ gem.add_development_dependency "aws-sdk", "~> 2.0"
24
+ gem.add_development_dependency "dotenv"
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tus-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: aws-sdk
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dotenv
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description:
84
112
  email:
85
113
  - janko.marohnic@gmail.com
@@ -91,11 +119,13 @@ files:
91
119
  - README.md
92
120
  - lib/tus-server.rb
93
121
  - lib/tus/checksum.rb
94
- - lib/tus/expirator.rb
122
+ - lib/tus/errors.rb
95
123
  - lib/tus/info.rb
124
+ - lib/tus/input.rb
96
125
  - lib/tus/server.rb
97
126
  - lib/tus/storage/filesystem.rb
98
127
  - lib/tus/storage/gridfs.rb
128
+ - lib/tus/storage/s3.rb
99
129
  - tus-server.gemspec
100
130
  homepage: https://github.com/janko-m/tus-ruby-server
101
131
  licenses:
@@ -120,5 +150,6 @@ rubyforge_project:
120
150
  rubygems_version: 2.5.1
121
151
  signing_key:
122
152
  specification_version: 4
123
- summary: Ruby server implementation of the Open Protocol for Resumable File Uploads.
153
+ summary: Ruby server implementation of tus.io, the open protocol for resumable file
154
+ uploads.
124
155
  test_files: []
data/lib/tus/expirator.rb DELETED
@@ -1,58 +0,0 @@
1
- require "tus/info"
2
- require "time"
3
-
4
- module Tus
5
- class Expirator
6
- attr_reader :storage, :interval
7
-
8
- def initialize(storage, interval: 60)
9
- @storage = storage
10
- @interval = interval
11
- end
12
-
13
- def expire_files!
14
- return unless expiration_due?
15
- update_last_expiration
16
-
17
- Thread.new do
18
- thread = Thread.current
19
- thread.abort_on_exception = false
20
- thread.report_on_exception = true if thread.respond_to?(:report_on_exception) # Ruby 2.4
21
-
22
- _expire_files!
23
- end
24
- end
25
-
26
- def expiration_due?
27
- Time.now - interval > last_expiration
28
- end
29
-
30
- private
31
-
32
- def _expire_files!
33
- storage.list_files.each do |uid|
34
- next if uid == "expirator"
35
- begin
36
- info = Info.new(storage.read_info(uid))
37
- storage.delete_file(uid) if Time.now > info.expires
38
- rescue
39
- end
40
- end
41
- end
42
-
43
- def last_expiration
44
- info = storage.read_info("expirator")
45
- Time.parse(info["Last-Expiration"])
46
- rescue
47
- Time.new(0)
48
- end
49
-
50
- def update_last_expiration
51
- if storage.file_exists?("expirator")
52
- storage.update_info("expirator", {"Last-Expiration" => Time.now.httpdate})
53
- else
54
- storage.create_file("expirator", {"Last-Expiration" => Time.now.httpdate})
55
- end
56
- end
57
- end
58
- end