em-fs 0.1.0 → 0.1.1

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGQzZDIyMzlkZGEzZGVjZjUwNzEyM2IyMmU2N2Y4YTJkMjZlNGIwOQ==
5
+ data.tar.gz: !binary |-
6
+ YjE3MmY1NTI3YTc0NTE3MGIwM2VmY2M0YTZmZmUxYTY4ZTUwYWU4Yg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YjdjYjdkZjQ0ZGJjMzUzM2MwMjRkOWEyOGM5OGUzZWM2NzBjOGE5Y2Q4NGFh
10
+ NjFlYTA4OThkNTFlYTExY2NmMmQ2OWE2MjdjOWJjMDllNzU2NGNmOTVkYTE2
11
+ ZDRmYjZjOTJkNDJlYzM2Y2RhYTUwNjk3MDlkODM3ODk2NTZmN2M=
12
+ data.tar.gz: !binary |-
13
+ MThhMjNjYTc0NTI2OWI3MjQyZGQ3ZmY4ODc0YWQ5NThlYjExZmYyY2Q1OWQy
14
+ MTRhNTUzMzE0ZTc4ZDg1NDc1ZDVhZWMzZDk4ODJjOTAyNjYwNTdjNmUwZDEz
15
+ MjI0NWJmNmQ0ZjlkNDRmZThlYzEyZjMzNzJiMjU4Y2Q3NDIwYTI=
@@ -6,9 +6,15 @@ module EventMachine
6
6
 
7
7
  def initialize pattern
8
8
  @weight = nil
9
+ @type = nil
10
+ @finished_callbacks = []
9
11
  parse pattern
10
12
  end
11
13
 
14
+ def finish &block
15
+ @finished_callbacks << block
16
+ end
17
+
12
18
  def parse pattern
13
19
  root = []
14
20
 
@@ -34,13 +40,24 @@ module EventMachine
34
40
 
35
41
  def each options = {}, &block
36
42
  options = {
37
- depth: :inf
43
+ depth: :inf,
44
+ type: :all
38
45
  }.merge options
46
+
39
47
  EM::SystemCommand.execute find_command(options) do |on|
48
+ stats = []
40
49
  on.stdout.line do |line|
41
- block.call File::Stat.parse line
50
+ stat = File::Stat.parse(line)
51
+ stats << stat
52
+ block.call(stat) if block
53
+ end
54
+ on.success do
55
+ @finished_callbacks.each do |callback|
56
+ callback.call(stats)
57
+ end
42
58
  end
43
59
  end
60
+ self
44
61
  end
45
62
 
46
63
  def each_entry options = {}, &block
@@ -64,7 +81,8 @@ module EventMachine
64
81
  private
65
82
  def find_command options = {}
66
83
  options = {
67
- depth: (@weight || :inf)
84
+ depth: (@weight || :inf),
85
+ type: (@type || :all)
68
86
  }.merge options
69
87
 
70
88
  builder = EM::SystemCommand::Builder.new 'find'
@@ -72,6 +90,7 @@ module EventMachine
72
90
  builder << [ :path, @path ] unless @path == "*" or @path == ''
73
91
  builder << [ :name, @name ] unless @name == "*"
74
92
  builder << [ :maxdepth, options[:depth] ] unless options[:depth] == :inf
93
+ builder << [ :type, options[:type] ] unless options[:type] == :all
75
94
  builder << [ :printf, FORMAT ]
76
95
  builder.to_s.gsub(/-+(\w)/, "-\\1")
77
96
  end
@@ -1,7 +1,6 @@
1
1
  module EventMachine
2
2
  class File
3
3
  class Stat
4
-
5
4
  STAT_REGEX = /(\d+) (\d+) '([\w\/ ]+)' (\d+) (\d+) (\d+) '(.+)' (\d+) (\d+) ([\d.]+) ([\d.]+) ([\d.]+)/.freeze
6
5
 
7
6
  # access rights octal
@@ -36,6 +35,15 @@ module EventMachine
36
35
  S_IFREG = 0b00100000 # regular file
37
36
  S_IFSOCK = 0b01000000 # socket
38
37
  S_UNKNOWN = 0b10000000 # unknown
38
+ TYPE_MAPPING = {
39
+ 'block device' => S_IFBLK,
40
+ 'character device' => S_IFCHR,
41
+ 'directory' => S_IFDIR,
42
+ 'FIFO/pipe' => S_IFIFO,
43
+ 'symlink' => S_IFLNK,
44
+ 'regular file' => S_IFREG,
45
+ 'socket' => S_IFSOCK
46
+ }
39
47
 
40
48
  # Mode Flags
41
49
  S_IRUSR = 0b100000000
@@ -57,22 +65,11 @@ module EventMachine
57
65
  # @return [EM::File::Stat] The file stat object.
58
66
  def parse str
59
67
  if m = str.match(STAT_REGEX)
60
- ftype = case m[3]
61
- when 'block device' then S_IFBLK
62
- when 'character device' then S_IFCHR
63
- when 'directory' then S_IFDIR
64
- when 'FIFO/pipe' then S_IFIFO
65
- when 'symlink' then S_IFLNK
66
- when 'regular file' then S_IFREG
67
- when 'socket' then S_IFSOCK
68
- else
69
- S_UNKNOWN
70
- end
71
68
  EM::File::Stat.new path: m[7],
72
69
  atime: Time.at(Integer(m[10].split('.')[0], 10)),
73
70
  ctime: Time.at(Integer(m[12].split('.')[0], 10)),
74
71
  dev: Integer(m[2], 10),
75
- ftype: ftype,
72
+ ftype: (TYPE_MAPPING[m[3]] || S_UNKNOWN),
76
73
  gid: Integer(m[4], 10),
77
74
  ino: Integer(m[6], 10),
78
75
  mode: Integer(m[1], 8),
@@ -117,17 +114,27 @@ module EventMachine
117
114
  end
118
115
 
119
116
  def executable?
120
- return true if Process::UID.rid == 0
121
- return @mode & S_IXUSR != 0 if rowned?
122
- return @mode & S_IXGRP != 0 if rgrpowned?
123
- @mode & S_IXOTH != 0
117
+ if Process::UID.rid == 0
118
+ true
119
+ elsif rowned?
120
+ @mode & S_IXUSR != 0
121
+ elsif rgrpowned?
122
+ @mode & S_IXGRP != 0
123
+ else
124
+ @mode & S_IXOTH != 0
125
+ end
124
126
  end
125
127
 
126
128
  def executable_real?
127
- return true if Process::UID.rid == 0
128
- return @mode & S_IXUSR != 0 if rowned?
129
- return @mode & S_IXGRP != 0 if rgrpowned?
130
- @mode & S_IXOTH != 0
129
+ if Process::UID.rid == 0
130
+ true
131
+ elsif rowned?
132
+ @mode & S_IXUSR != 0
133
+ elsif rgrpowned?
134
+ @mode & S_IXGRP != 0
135
+ else
136
+ @mode & S_IXOTH != 0
137
+ end
131
138
  end
132
139
 
133
140
  def file?
@@ -159,17 +166,27 @@ module EventMachine
159
166
  end
160
167
 
161
168
  def readable?
162
- return true if Process::UID.eid == 0
163
- return @mode & S_IRUSR != 0 if owned?
164
- return @mode & S_IRGRP != 0 if grpowned?
165
- @mode & S_IROTH != 0
169
+ if Process::UID.eid == 0
170
+ return true
171
+ elsif owned?
172
+ return @mode & S_IRUSR != 0
173
+ elsif grpowned?
174
+ return @mode & S_IRGRP != 0
175
+ else
176
+ @mode & S_IROTH != 0
177
+ end
166
178
  end
167
179
 
168
180
  def readable_real?
169
- return true if Process::UID.rid == 0
170
- return @mode & S_IRUSR != 0 if rowned?
171
- return @mode & S_IRGRP != 0 if rgrpowned?
172
- @mode & S_IROTH != 0
181
+ if Process::UID.rid == 0
182
+ true
183
+ elsif rowned?
184
+ @mode & S_IRUSR != 0
185
+ elsif rgrpowned?
186
+ @mode & S_IRGRP != 0
187
+ else
188
+ @mode & S_IROTH != 0
189
+ end
173
190
  end
174
191
 
175
192
  def socket?
@@ -189,23 +206,32 @@ module EventMachine
189
206
  end
190
207
 
191
208
  def writable?
192
- return true if Process::UID.rid == 0
193
- return @mode & S_IWUSR != 0 if owned?
194
- return @mode & S_IWGRP != 0 if grpowned?
195
- @mode & S_IWOTH != 0
209
+ if Process::UID.rid == 0
210
+ true
211
+ elsif owned?
212
+ @mode & S_IWUSR != 0
213
+ elsif grpowned?
214
+ @mode & S_IWGRP != 0
215
+ else
216
+ @mode & S_IWOTH != 0
217
+ end
196
218
  end
197
219
 
198
220
  def writable_real?
199
- return true if Process::UID.rid == 0
200
- return @mode & S_IWUSR != 0 if rowned?
201
- return @mode & S_IWGRP != 0 if rgrpowned?
202
- @mode & S_IWOTH != 0
221
+ if Process::UID.rid == 0
222
+ true
223
+ elsif rowned?
224
+ @mode & S_IWUSR != 0
225
+ elsif rgrpowned?
226
+ @mode & S_IWGRP != 0
227
+ else
228
+ @mode & S_IWOTH != 0
229
+ end
203
230
  end
204
231
 
205
232
  def zero?
206
233
  @size == 0
207
234
  end
208
-
209
235
  end
210
236
  end
211
237
  end
@@ -3,7 +3,7 @@ module EventMachine
3
3
  class FS
4
4
  class Command < EM::SystemCommand
5
5
 
6
- PROGRESS_REGEXP = /([A-Za-z0-9\.\-\/]+)\n[ ]+(\d+)/.freeze
6
+ PROGRESS_REGEXP = /([A-Za-z0-9\.,\-\/]+)\n[ ]+([^ ]+)/.freeze
7
7
 
8
8
  ##
9
9
  # Invokes `#execute` of super-class and adds a progress matcher.
@@ -11,7 +11,7 @@ module EventMachine
11
11
  super &block
12
12
 
13
13
  stdout.match PROGRESS_REGEXP, match: :last, in: :output do |file, bytes|
14
- receive_progress file, bytes.to_i
14
+ receive_progress file, bytes.gsub(/[^\d]/,'').to_i
15
15
  end
16
16
 
17
17
  self
@@ -49,10 +49,6 @@ module EventMachine
49
49
  def progress_callbacks
50
50
  @progress_callbacks ||= []
51
51
  end
52
-
53
- def progress_regexp
54
- @progress_regexp ||= /([A-Za-z0-9\.\-\/]+)\n[ ]+(\d+)/.freeze
55
- end
56
52
  end
57
53
  end
58
54
  end
data/lib/em-fs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  class FS
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -2,17 +2,6 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe EM::Dir::Glob do
5
- before :all do
6
- dirs = [ 'a', 'b/a', 'b/b', 'c/a/a', 'c/a/b' ].map { |p|
7
- File.join(SPEC_ROOT, 'data', p)
8
- }
9
- files = [ 'a/x', 'b/x', 'b/a/x', 'b/a/y', 'b/a/z' ].map { |p|
10
- File.join(SPEC_ROOT, 'data', p)
11
- }
12
- FileUtils.touch files
13
- FileUtils.mkdir_p dirs
14
- end
15
-
16
5
  describe '#find_command' do
17
6
  it 'should parse relative pattern' do
18
7
  cmd = EM::Dir['./*.rb'].send :find_command
@@ -25,6 +14,32 @@ describe EM::Dir::Glob do
25
14
  end
26
15
  end
27
16
 
17
+ describe '#finish' do
18
+ it 'is called with an array of the matched file stat' do
19
+ @testEntries = []
20
+ pattern = File.join(SPEC_ROOT, 'data', '**', '*')
21
+ EM.run do
22
+ cmd = EM::Dir[pattern].each(depth: 1)
23
+ cmd.finish do |entries|
24
+ @testEntries = entries
25
+ EM.stop_event_loop
26
+ end
27
+ end
28
+ @testEntries.each do |stat|
29
+ stat.should be_a EM::File::Stat
30
+ end
31
+ @testEntries.map(&:path).should =~ [
32
+ 'data',
33
+ 'data/b',
34
+ 'data/c',
35
+ 'data/test2',
36
+ 'data/test',
37
+ 'data/a',
38
+ 'data/test3'
39
+ ].map {|e| File.join(SPEC_ROOT, e)}
40
+ end
41
+ end
42
+
28
43
  describe '#each' do
29
44
  context 'with depth = 0' do
30
45
  before :all do
@@ -34,23 +49,22 @@ describe EM::Dir::Glob do
34
49
  cmd = EM::Dir[pattern].each depth: 1 do |entry|
35
50
  @entries << entry.path
36
51
  end
37
-
38
- cmd.exit do
52
+ cmd.finish do
39
53
  EM.stop_event_loop
40
54
  end
41
55
  end
42
56
  end
43
57
 
44
58
  it 'should execute the block for each entry' do
45
- @entries.should == [
46
- "/home/arthur/projects/em-fs/spec/data",
47
- "/home/arthur/projects/em-fs/spec/data/b",
48
- "/home/arthur/projects/em-fs/spec/data/c",
49
- "/home/arthur/projects/em-fs/spec/data/test2",
50
- "/home/arthur/projects/em-fs/spec/data/test",
51
- "/home/arthur/projects/em-fs/spec/data/a",
52
- "/home/arthur/projects/em-fs/spec/data/test3"
53
- ]
59
+ @entries.should =~ [
60
+ "data",
61
+ "data/b",
62
+ "data/c",
63
+ "data/test2",
64
+ "data/test",
65
+ "data/a",
66
+ "data/test3"
67
+ ].map {|e| File.join(SPEC_ROOT, e)}
54
68
  end
55
69
  end
56
70
 
@@ -62,28 +76,27 @@ describe EM::Dir::Glob do
62
76
  cmd = EM::Dir[pattern].each depth: 2 do |entry|
63
77
  @entries << entry.path
64
78
  end
65
-
66
- cmd.exit do
79
+ cmd.finish do
67
80
  EM.stop_event_loop
68
81
  end
69
82
  end
70
83
  end
71
84
 
72
85
  it 'should execute the block for each entry and directory´s entry' do
73
- @entries.should == [
74
- "/home/arthur/projects/em-fs/spec/data",
75
- "/home/arthur/projects/em-fs/spec/data/b",
76
- "/home/arthur/projects/em-fs/spec/data/b/b",
77
- "/home/arthur/projects/em-fs/spec/data/b/x",
78
- "/home/arthur/projects/em-fs/spec/data/b/a",
79
- "/home/arthur/projects/em-fs/spec/data/c",
80
- "/home/arthur/projects/em-fs/spec/data/c/a",
81
- "/home/arthur/projects/em-fs/spec/data/test2",
82
- "/home/arthur/projects/em-fs/spec/data/test",
83
- "/home/arthur/projects/em-fs/spec/data/a",
84
- "/home/arthur/projects/em-fs/spec/data/a/x",
85
- "/home/arthur/projects/em-fs/spec/data/test3"
86
- ]
86
+ @entries.should =~ [
87
+ "data",
88
+ "data/b",
89
+ "data/b/b",
90
+ "data/b/x",
91
+ "data/b/a",
92
+ "data/c",
93
+ "data/c/a",
94
+ "data/test2",
95
+ "data/test",
96
+ "data/a",
97
+ "data/a/x",
98
+ "data/test3"
99
+ ].map {|e| File.join(SPEC_ROOT, e)}
87
100
  end
88
101
  end
89
102
 
@@ -95,33 +108,32 @@ describe EM::Dir::Glob do
95
108
  cmd = EM::Dir[pattern].each depth: :inf do |entry|
96
109
  @entries << entry.path
97
110
  end
98
-
99
- cmd.exit do
111
+ cmd.finish do
100
112
  EM.stop_event_loop
101
113
  end
102
114
  end
103
115
  end
104
116
 
105
117
  it 'should execute the block for each entry in tree' do
106
- @entries.should == [
107
- "/home/arthur/projects/em-fs/spec/data",
108
- "/home/arthur/projects/em-fs/spec/data/b",
109
- "/home/arthur/projects/em-fs/spec/data/b/b",
110
- "/home/arthur/projects/em-fs/spec/data/b/x",
111
- "/home/arthur/projects/em-fs/spec/data/b/a",
112
- "/home/arthur/projects/em-fs/spec/data/b/a/x",
113
- "/home/arthur/projects/em-fs/spec/data/b/a/z",
114
- "/home/arthur/projects/em-fs/spec/data/b/a/y",
115
- "/home/arthur/projects/em-fs/spec/data/c",
116
- "/home/arthur/projects/em-fs/spec/data/c/a",
117
- "/home/arthur/projects/em-fs/spec/data/c/a/b",
118
- "/home/arthur/projects/em-fs/spec/data/c/a/a",
119
- "/home/arthur/projects/em-fs/spec/data/test2",
120
- "/home/arthur/projects/em-fs/spec/data/test",
121
- "/home/arthur/projects/em-fs/spec/data/a",
122
- "/home/arthur/projects/em-fs/spec/data/a/x",
123
- "/home/arthur/projects/em-fs/spec/data/test3"
124
- ]
118
+ @entries.should =~ [
119
+ "data",
120
+ "data/b",
121
+ "data/b/b",
122
+ "data/b/x",
123
+ "data/b/a",
124
+ "data/b/a/x",
125
+ "data/b/a/z",
126
+ "data/b/a/y",
127
+ "data/c",
128
+ "data/c/a",
129
+ "data/c/a/b",
130
+ "data/c/a/a",
131
+ "data/test2",
132
+ "data/test",
133
+ "data/a",
134
+ "data/a/x",
135
+ "data/test3"
136
+ ].map {|e| File.join(SPEC_ROOT, e)}
125
137
  end
126
138
  end
127
139
  end
@@ -134,15 +146,14 @@ describe EM::Dir::Glob do
134
146
  cmd = EM::Dir[pattern].each_entry do |entry|
135
147
  @entries << entry
136
148
  end
137
-
138
- cmd.exit do
149
+ cmd.finish do
139
150
  EM.stop_event_loop
140
151
  end
141
152
  end
142
153
  end
143
154
 
144
155
  it 'should execute a block with file name for each entry' do
145
- @entries.should == [ "data", "b", "c", "test2", "test", "a", "test3" ]
156
+ @entries.should =~ [ "data", "b", "c", "test2", "test", "a", "test3" ]
146
157
  end
147
158
  end
148
159
 
@@ -154,33 +165,32 @@ describe EM::Dir::Glob do
154
165
  cmd = EM::Dir[pattern].each_path do |path|
155
166
  @entries << path
156
167
  end
157
-
158
- cmd.exit do
168
+ cmd.finish do
159
169
  EM.stop_event_loop
160
170
  end
161
171
  end
162
172
  end
163
173
 
164
174
  it 'should execute a block with full path for each entry' do
165
- @entries.should == [
166
- "/home/arthur/projects/em-fs/spec/data",
167
- "/home/arthur/projects/em-fs/spec/data/b",
168
- "/home/arthur/projects/em-fs/spec/data/b/b",
169
- "/home/arthur/projects/em-fs/spec/data/b/x",
170
- "/home/arthur/projects/em-fs/spec/data/b/a",
171
- "/home/arthur/projects/em-fs/spec/data/b/a/x",
172
- "/home/arthur/projects/em-fs/spec/data/b/a/z",
173
- "/home/arthur/projects/em-fs/spec/data/b/a/y",
174
- "/home/arthur/projects/em-fs/spec/data/c",
175
- "/home/arthur/projects/em-fs/spec/data/c/a",
176
- "/home/arthur/projects/em-fs/spec/data/c/a/b",
177
- "/home/arthur/projects/em-fs/spec/data/c/a/a",
178
- "/home/arthur/projects/em-fs/spec/data/test2",
179
- "/home/arthur/projects/em-fs/spec/data/test",
180
- "/home/arthur/projects/em-fs/spec/data/a",
181
- "/home/arthur/projects/em-fs/spec/data/a/x",
182
- "/home/arthur/projects/em-fs/spec/data/test3"
183
- ]
175
+ @entries.should =~ [
176
+ "data",
177
+ "data/b",
178
+ "data/b/b",
179
+ "data/b/x",
180
+ "data/b/a",
181
+ "data/b/a/x",
182
+ "data/b/a/z",
183
+ "data/b/a/y",
184
+ "data/c",
185
+ "data/c/a",
186
+ "data/c/a/b",
187
+ "data/c/a/a",
188
+ "data/test2",
189
+ "data/test",
190
+ "data/a",
191
+ "data/a/x",
192
+ "data/test3"
193
+ ].map {|e| File.join(SPEC_ROOT, e)}
184
194
  end
185
195
  end
186
196
  end
@@ -4,7 +4,7 @@ describe EM::File::Stat do
4
4
  describe '.parse' do
5
5
  context 'parsed stat' do
6
6
  subject do
7
- EM::File::Stat.parse "644 2050 'regular file' 100 1 2623327 '/home/arthur/test' 218759168 1000 1340357826 1340357846 1340357846"
7
+ EM::File::Stat.parse "644 2050 'regular file' #{Process::GID.eid} 1 2623327 '/home/arthur/test' 218759168 #{Process::UID.eid} 1340357826 1340357846 1340357846"
8
8
  end
9
9
 
10
10
  its(:atime) { should == Time.at(1340357826) }
@@ -17,7 +17,7 @@ describe EM::File::Stat do
17
17
  its(:executable_real?) { should == false }
18
18
  its(:file?) { should == true }
19
19
  its(:ftype) { should == EM::File::Stat::S_IFREG }
20
- its(:gid) { should == 100 }
20
+ its(:gid) { should == Process::GID.eid }
21
21
  its(:grpowned?) { should == true }
22
22
  its(:ino) { should == 2623327 }
23
23
  its(:mode) { should == '644' }
@@ -30,7 +30,7 @@ describe EM::File::Stat do
30
30
  its(:size) { should == 218759168 }
31
31
  its(:socket?) { should == false }
32
32
  its(:symlink?) { should == false }
33
- its(:uid) { should == 1000 }
33
+ its(:uid) { should == Process::UID.eid }
34
34
  its(:world_readable?) { should == 420 }
35
35
  its(:world_writable?) { should == nil }
36
36
  its(:writable?) { should == true }
@@ -401,8 +401,8 @@ describe EM::FileUtils do
401
401
  it 'should invoke `chown`' do
402
402
  EM.run do
403
403
  @dir = File.join(SPEC_ROOT, 'data', 'test')
404
- cmd = EM::FileUtils.chown 'arthur', 'users', '/usr/bin/test'
405
- cmd.command.should == 'chown arthur:users /usr/bin/test'
404
+ cmd = EM::FileUtils.chown 'nobody', 'users', '/usr/bin/test'
405
+ cmd.command.should == 'chown nobody:users /usr/bin/test'
406
406
  EM.stop_event_loop
407
407
  end
408
408
  end
@@ -412,8 +412,8 @@ describe EM::FileUtils do
412
412
  it 'should invoke `chown -r`' do
413
413
  EM.run do
414
414
  @dir = File.join(SPEC_ROOT, 'data', 'test')
415
- cmd = EM::FileUtils.chown_R 'arthur', 'users', '/usr/bin/test'
416
- cmd.command.should == 'chown -R arthur:users /usr/bin/test'
415
+ cmd = EM::FileUtils.chown_R 'nobody', 'users', '/usr/bin/test'
416
+ cmd.command.should == 'chown -R nobody:users /usr/bin/test'
417
417
  EM.stop_event_loop
418
418
  end
419
419
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe EM::FS::RsyncCommand do
4
4
  context 'copying one file' do
5
- before :all do
5
+ before :each do
6
6
  @source = File.join SPEC_ROOT, 'data', 'test'
7
7
  @target = File.join SPEC_ROOT, 'data', 'test.copy'
8
8
  @progress_updates = {}
@@ -20,7 +20,7 @@ describe EM::FS::RsyncCommand do
20
20
  end
21
21
  end
22
22
 
23
- after :all do
23
+ after :each do
24
24
  FileUtils.rm_rf @target
25
25
  end
26
26
 
@@ -35,7 +35,7 @@ describe EM::FS::RsyncCommand do
35
35
  end
36
36
 
37
37
  context 'copying multiple files' do
38
- before :all do
38
+ before :each do
39
39
  @source1 = File.join SPEC_ROOT, 'data', 'test'
40
40
  @source2 = File.join SPEC_ROOT, 'data', 'test2'
41
41
  @source3 = File.join SPEC_ROOT, 'data', 'test3'
@@ -55,7 +55,7 @@ describe EM::FS::RsyncCommand do
55
55
  end
56
56
  end
57
57
 
58
- after :all do
58
+ after :each do
59
59
  FileUtils.rm_rf @target
60
60
  end
61
61
 
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,8 @@ EventMachine.instance_eval do
12
12
  end
13
13
  end unless EM.respond_to?(:assertions)
14
14
 
15
+ system("cd #{SPEC_ROOT}/data; mkdir -p a b/a b/b c/a/{a,b}")
16
+ system("cd #{SPEC_ROOT}/data; touch {a,b}/x b/a/{x,y,z}")
15
17
  unless File.exists?(File.join(SPEC_ROOT, 'data', 'test')) and
16
18
  File.exists?(File.join(SPEC_ROOT, 'data', 'test2')) and
17
19
  File.exists?(File.join(SPEC_ROOT, 'data', 'test3'))
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-fs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Arthur Leonard Andersen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: guard
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: guard-rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: eventmachine
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: em-systemcommand
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -145,33 +132,26 @@ files:
145
132
  - spec/spec_helper.rb
146
133
  homepage: http://github.com/leoc/em-fs
147
134
  licenses: []
135
+ metadata: {}
148
136
  post_install_message:
149
137
  rdoc_options: []
150
138
  require_paths:
151
139
  - lib
152
140
  required_ruby_version: !ruby/object:Gem::Requirement
153
- none: false
154
141
  requirements:
155
142
  - - ! '>='
156
143
  - !ruby/object:Gem::Version
157
144
  version: '0'
158
- segments:
159
- - 0
160
- hash: 4225417122368326630
161
145
  required_rubygems_version: !ruby/object:Gem::Requirement
162
- none: false
163
146
  requirements:
164
147
  - - ! '>='
165
148
  - !ruby/object:Gem::Version
166
149
  version: '0'
167
- segments:
168
- - 0
169
- hash: 4225417122368326630
170
150
  requirements: []
171
151
  rubyforge_project:
172
- rubygems_version: 1.8.24
152
+ rubygems_version: 2.2.2
173
153
  signing_key:
174
- specification_version: 3
154
+ specification_version: 4
175
155
  summary: Invoke filesystem calls without blocking.
176
156
  test_files:
177
157
  - spec/dir/glob_spec.rb