s3fsr 1.6 → 1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/s3fsr.rb +23 -3
  2. metadata +3 -3
data/lib/s3fsr.rb CHANGED
@@ -58,8 +58,8 @@ class SBaseDir
58
58
  get_contents << SFile.new(self, AWS::S3::S3Object.find(child_key, bucket))
59
59
  end
60
60
  def create_dir child_key
61
- AWS::S3::S3Object.store(child_key, S3SYNC_DIR_CONTENTS, bucket)
62
- get_contents << SFakeDir.new(self, child_key)
61
+ AWS::S3::S3Object.store(child_key + '/', '', bucket)
62
+ get_contents << SPrefixDir.new(self, child_key + '/')
63
63
  end
64
64
  def delete
65
65
  AWS::S3::S3Object.delete @key, bucket
@@ -99,7 +99,7 @@ class SBaseDir
99
99
  end
100
100
  end
101
101
  s3_bucket.common_prefix_cache.reject { |p| p == '/' }.each do |prefix|
102
- hidden = SFakeDir.new(self, prefix[0..-2])
102
+ hidden = SPrefixDir.new(self, prefix)
103
103
  @data << hidden unless @data.find { |i| i.name == hidden.name }
104
104
  end
105
105
  break unless s3_bucket.object_cache.length > 0 && s3_bucket.object_cache.length % 1000 == 0
@@ -110,6 +110,26 @@ class SBaseDir
110
110
  end
111
111
  end
112
112
 
113
+ # for either non-existent or aws console-created fake directories that end with /
114
+ class SPrefixDir < SBaseDir
115
+ def initialize(parent, key)
116
+ @parent = parent
117
+ @key = key
118
+ @data = nil
119
+ end
120
+ def name
121
+ @key.split('/')[-1]
122
+ end
123
+ def bucket
124
+ @parent.bucket
125
+ end
126
+ private
127
+ def prefix
128
+ @key
129
+ end
130
+ end
131
+
132
+ # for s3sync/s3organizer fake directories
113
133
  class SFakeDir < SBaseDir
114
134
  def initialize(parent, key)
115
135
  @parent = parent
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3fsr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 6
9
- version: "1.6"
8
+ - 7
9
+ version: "1.7"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephen Haberman