file-manager 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/file-manager.gemspec +1 -1
- data/lib/file_manager_factory.rb +5 -3
- data/lib/memory_file_manager.rb +17 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d897a0755f65ea57fef0f1312de6611944210ca4
|
4
|
+
data.tar.gz: 99d9c13372811865c9a35f2a84172bfc3e1213a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db417873de14c8c194eaafd02a733505c2b9d145874be4c46bd3c65fc596eafc7b4472ba653fb9dd7fbf3aab53161a33508b98750f08284424819d920d0eb0c5
|
7
|
+
data.tar.gz: 4378b9431785d4913820cfa629ee590dcaf64e55578a4e0d89e4b9ba418e1dd2e587d15bfb4bb754ad0fae9e5a6bb88009099c62b1e260d2db1f7800a705eed1
|
data/file-manager.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "file-manager"
|
6
|
-
spec.version = '0.0.
|
6
|
+
spec.version = '0.0.8'
|
7
7
|
spec.authors = ["Francisco Barroso / Marlus Saraiva"]
|
8
8
|
spec.email = ["franciscobarroso@grupofortes.com.br"]
|
9
9
|
spec.description = 'File manager, access S3 or local'
|
data/lib/file_manager_factory.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 's3_file_manager'
|
2
2
|
require 'local_file_manager'
|
3
|
+
require 'memory_file_manager'
|
3
4
|
|
4
5
|
class FileManagerFactory
|
5
6
|
FILE_MANAGERS = {
|
6
|
-
'S3'
|
7
|
-
'local'
|
7
|
+
'S3' => ::S3FileManager,
|
8
|
+
'local' => ::LocalFileManager,
|
9
|
+
'memory' => ::MemoryFileManager
|
8
10
|
}
|
9
11
|
|
10
12
|
def initialize(file_managers_config)
|
@@ -15,4 +17,4 @@ class FileManagerFactory
|
|
15
17
|
config = @file_managers_config[name]
|
16
18
|
FILE_MANAGERS[config[:type]].new config
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class MemoryFileManager
|
2
|
+
attr_accessor :options
|
3
|
+
|
4
|
+
def initialize(options)
|
5
|
+
@options = options
|
6
|
+
@data = {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def read_file file_name
|
10
|
+
@data["#{file_name}"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def save_file(file_name, file_contents, write_options = {})
|
14
|
+
@data["#{file_name}"] = file_contents.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Barroso / Marlus Saraiva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- file-manager.gemspec
|
69
69
|
- lib/file_manager_factory.rb
|
70
70
|
- lib/local_file_manager.rb
|
71
|
+
- lib/memory_file_manager.rb
|
71
72
|
- lib/s3_file_manager.rb
|
72
73
|
homepage: https://github.com/fortesinformatica/file-manager
|
73
74
|
licenses: []
|