refile-fog 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +5 -1
- data/README.md +1 -1
- data/Rakefile +3 -0
- data/lib/refile/fog.rb +13 -13
- data/lib/refile/fog/version.rb +1 -1
- data/refile-fog.gemspec +0 -6
- metadata +5 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d7e47dc9b33995b814dce970e2a57ac2a053153
|
4
|
+
data.tar.gz: 415af08edcfd7c8f54ab0e7f75af7886235a5dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdf60d83cbb8a3022e0ca333742b6d3bccccedf635c44dada7589986578afd6b077373d7f1861ebc3b81843a1e3b392b4ed705103ad35fe9acf7513d25d47eb
|
7
|
+
data.tar.gz: bf8db1a9c7b8c04a53e28293d03546496a170ff493d8926b87874c21288cf2e8dee2cca44483c88cdbdaeccbb11d3003094b11e805e80ff370056ebd6eb17735
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Refile::Fog
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/refile/refile-fog.svg)](https://travis-ci.org/refile/refile-fog)
|
4
4
|
|
5
5
|
A backend for [Refile](https://github.com/elabs/refile) which provides storage
|
6
6
|
in multiple cloud storage services via the [Fog](https://github.com/fog/fog)
|
data/Rakefile
CHANGED
data/lib/refile/fog.rb
CHANGED
@@ -5,7 +5,9 @@ require "refile/fog/version"
|
|
5
5
|
module Refile
|
6
6
|
module Fog
|
7
7
|
class Backend
|
8
|
-
|
8
|
+
extend Refile::BackendMacros
|
9
|
+
|
10
|
+
attr_reader :directory, :max_size
|
9
11
|
|
10
12
|
def initialize(directory:, max_size: nil, prefix: nil, hasher: Refile::RandomHasher.new, connection: nil, **options)
|
11
13
|
@connection = connection || ::Fog::Storage.new(options)
|
@@ -16,9 +18,7 @@ module Refile
|
|
16
18
|
@directory = @connection.directories.new(key: directory)
|
17
19
|
end
|
18
20
|
|
19
|
-
def upload(uploadable)
|
20
|
-
Refile.verify_uploadable(uploadable, @max_size)
|
21
|
-
|
21
|
+
verify_uploadable def upload(uploadable)
|
22
22
|
id = @hasher.hash(uploadable)
|
23
23
|
|
24
24
|
@directory.files.create(key: path(id), body: uploadable.read)
|
@@ -26,45 +26,45 @@ module Refile
|
|
26
26
|
Refile::File.new(self, id)
|
27
27
|
end
|
28
28
|
|
29
|
-
def get(id)
|
29
|
+
verify_id def get(id)
|
30
30
|
Refile::File.new(self, id)
|
31
31
|
end
|
32
32
|
|
33
|
-
def delete(id)
|
33
|
+
verify_id def delete(id)
|
34
34
|
file = head(id)
|
35
35
|
file.destroy if file
|
36
36
|
end
|
37
37
|
|
38
|
-
def open(id)
|
38
|
+
verify_id def open(id)
|
39
39
|
StringIO.new(read(id))
|
40
40
|
end
|
41
41
|
|
42
|
-
def read(id)
|
42
|
+
verify_id def read(id)
|
43
43
|
file = @directory.files.get(path(id))
|
44
44
|
file.body if file
|
45
45
|
end
|
46
46
|
|
47
|
-
def size(id)
|
47
|
+
verify_id def size(id)
|
48
48
|
file = head(id)
|
49
49
|
file.content_length if file
|
50
50
|
end
|
51
51
|
|
52
|
-
def exists?(id)
|
52
|
+
verify_id def exists?(id)
|
53
53
|
!!head(id)
|
54
54
|
end
|
55
55
|
|
56
|
-
def head(id)
|
56
|
+
verify_id def head(id)
|
57
57
|
@directory.files.head(path(id))
|
58
58
|
end
|
59
59
|
|
60
60
|
def clear!(confirm = nil)
|
61
|
-
raise
|
61
|
+
raise Refile::Confirm unless confirm == :confirm
|
62
62
|
@directory.files.select { |f| f.key.start_with?(@prefix.to_s) }.each(&:destroy)
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
66
66
|
|
67
|
-
def path(id)
|
67
|
+
verify_id def path(id)
|
68
68
|
::File.join(*@prefix, id)
|
69
69
|
end
|
70
70
|
end
|
data/lib/refile/fog/version.rb
CHANGED
data/refile-fog.gemspec
CHANGED
@@ -17,12 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
|
21
20
|
spec.add_dependency "refile"
|
22
21
|
spec.add_dependency "fog"
|
23
|
-
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
-
spec.add_development_dependency "pry"
|
28
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refile-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Nicklas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: refile
|
@@ -38,62 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.7'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.7'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
41
|
description:
|
98
42
|
email:
|
99
43
|
- jonas.nicklas@gmail.com
|
@@ -102,6 +46,7 @@ extensions: []
|
|
102
46
|
extra_rdoc_files: []
|
103
47
|
files:
|
104
48
|
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
105
50
|
- Gemfile
|
106
51
|
- LICENSE.txt
|
107
52
|
- README.md
|
@@ -130,9 +75,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
75
|
version: '0'
|
131
76
|
requirements: []
|
132
77
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.4.
|
78
|
+
rubygems_version: 2.4.5.1
|
134
79
|
signing_key:
|
135
80
|
specification_version: 4
|
136
81
|
summary: Fog backend for Refile
|
137
82
|
test_files:
|
138
83
|
- spec/refile/fog_spec.rb
|
84
|
+
has_rdoc:
|