filestore 0.0.6 → 0.0.7

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/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") : Logger.instance.logger.info("Copying file")
101
- shouldMove ? (FileUtils.mv(file, dstPath)) : (FileUtils.copy_file(file, dstPath))
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
@@ -86,7 +86,7 @@ module FileStore
86
86
  #
87
87
  def shutdown
88
88
  begin
89
- File.open(@file, "w+") do |fh|
89
+ File.open(@file, "wb+") do |fh|
90
90
  YAML.dump({:current => @data, :removed => @removed}, fh)
91
91
  end
92
92
 
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 = "/Users/thomas/Documents/DEV/ruby/FileStoreGEM/test/store_test"
15
- testFile = "/Users/thomas/Documents/DEV/ruby/FileStoreGEM/test/testfile.txt"
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, {:hugo => 'boss'}, false)
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
@@ -11,13 +11,13 @@ require 'fileutils'
11
11
 
12
12
  include FileStore
13
13
 
14
- basePath = "/Users/thomas/Documents/DEV/ruby/FileStoreRepo/test/multi_store_test"
15
- testFile = "/Users/thomas/Documents/DEV/ruby/FileStoreRepo/test/testfile.txt"
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, { :hugo => "boss" }
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.6
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: 2012-11-27 00:00:00.000000000 Z
12
+ date: 2013-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uuidtools