filestore 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/filestore.rb +3 -3
- data/lib/memory_meta.rb +1 -1
- data/test/tc_filestore.rb +5 -4
- data/test/tc_multitenant.rb +3 -3
- metadata +2 -2
data/lib/filestore.rb
CHANGED
@@ -96,9 +96,9 @@ module FileStore
|
|
96
96
|
Logger.instance.logger.info "Using file id #{id}"
|
97
97
|
dstPath = File.join(dir, id)
|
98
98
|
Logger.instance.logger.info "Created destination path #{dstPath}"
|
99
|
-
|
100
|
-
shouldMove ? Logger.instance.logger.info("Moving file")
|
101
|
-
|
99
|
+
|
100
|
+
shouldMove ? (Logger.instance.logger.info("Moving file"); FileUtils.mv(file, dstPath)) :
|
101
|
+
(Logger.instance.logger.info("Copying file"); FileUtils.copy_file(file, dstPath))
|
102
102
|
rescue Exception => e
|
103
103
|
raise FileStoreException, "Couldn't add file #{file} to store.", e.backtrace
|
104
104
|
end
|
data/lib/memory_meta.rb
CHANGED
data/test/tc_filestore.rb
CHANGED
@@ -11,21 +11,22 @@ require_relative '../lib/memory_meta.rb'
|
|
11
11
|
|
12
12
|
include FileStore
|
13
13
|
|
14
|
-
basePath = "/
|
15
|
-
testFile =
|
14
|
+
basePath = "#{Dir.getwd}/store_test"
|
15
|
+
testFile = $*[0]
|
16
16
|
|
17
17
|
begin
|
18
|
+
puts "Using file: #{testFile}"
|
18
19
|
mm = MemoryMetaManager.new(File.join(basePath, "meta.yaml"))
|
19
20
|
sfs = SimpleFileStore.new(mm, basePath)
|
20
|
-
id = sfs.add(testFile, {:
|
21
|
+
id = sfs.add(testFile, {:original_file => testFile}, false)
|
21
22
|
|
22
23
|
puts id
|
23
24
|
puts "Enter something to finish"
|
24
25
|
enter = gets
|
25
26
|
|
26
27
|
sfs.remove(id)
|
27
|
-
sfs.shutdown
|
28
28
|
rescue Exception => e
|
29
29
|
puts e
|
30
|
+
ensure
|
30
31
|
sfs.shutdown if not sfs.nil?
|
31
32
|
end
|
data/test/tc_multitenant.rb
CHANGED
@@ -11,13 +11,13 @@ require 'fileutils'
|
|
11
11
|
|
12
12
|
include FileStore
|
13
13
|
|
14
|
-
basePath = "/
|
15
|
-
testFile = "/
|
14
|
+
basePath = "#{Dir.getwd}/multi_store_test"
|
15
|
+
testFile = "#{Dir.getwd}/testfile.txt"
|
16
16
|
|
17
17
|
begin
|
18
18
|
MultiTenantFileStore.instance.set_root_path basePath
|
19
19
|
tenant = MultiTenantFileStore.instance.create_tenant_store
|
20
|
-
MultiTenantFileStore.instance.add_to_tenant tenant, testFile, { :
|
20
|
+
MultiTenantFileStore.instance.add_to_tenant tenant, testFile, { :original_file => testFile }
|
21
21
|
|
22
22
|
puts MultiTenantFileStore.instance.stores
|
23
23
|
MultiTenantFileStore.instance.shutdown
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filestore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuidtools
|