Skip to content

Commit 4d962e5

Browse files
committed
Force deletion of temp directories
If they’re there, we want them gone.
1 parent c0e8399 commit 4d962e5

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

lib/thinking_sphinx/commands/clear_real_time.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def call
77
Dir["#{index.path}.*"].each { |path| FileUtils.rm path }
88
end
99

10-
FileUtils.rm_r(binlog_path) if File.exist?(binlog_path)
10+
FileUtils.rm_rf(binlog_path) if File.exist?(binlog_path)
1111
end
1212

1313
private

lib/thinking_sphinx/commands/clear_sql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def call
77
Dir["#{index.path}.*"].each { |path| FileUtils.rm path }
88
end
99

10-
FileUtils.rm_r Dir["#{configuration.indices_location}/ts-*.tmp"]
10+
FileUtils.rm_rf Dir["#{configuration.indices_location}/ts-*.tmp"]
1111
end
1212

1313
private

lib/thinking_sphinx/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def self.clear
4242
config.indices_location,
4343
config.searchd.binlog_path
4444
].each do |path|
45-
FileUtils.rm_r(path) if File.exist?(path)
45+
FileUtils.rm_rf(path) if File.exist?(path)
4646
end
4747
end
4848

spec/thinking_sphinx/commands/clear_real_time_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
allow(Dir).to receive(:[]).with('/path/to/my/index/parts.*').
1818
and_return(['parts.a', 'parts.b'])
1919

20-
allow(FileUtils).to receive_messages :rm_r => true,
20+
allow(FileUtils).to receive_messages :rm_rf => true,
2121
:rm => true
2222
allow(File).to receive_messages :exist? => true
2323
end
@@ -30,7 +30,7 @@
3030
end
3131

3232
it "removes the directory for the binlog files" do
33-
expect(FileUtils).to receive(:rm_r).with('/path/to/binlog')
33+
expect(FileUtils).to receive(:rm_rf).with('/path/to/binlog')
3434

3535
command.call
3636
end

spec/thinking_sphinx/commands/clear_sql_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
allow(Dir).to receive(:[]).with('/path/to/indices/ts-*.tmp').
2525
and_return(['/path/to/indices/ts-foo.tmp'])
2626

27-
allow(FileUtils).to receive_messages :rm_r => true, :rm => true
27+
allow(FileUtils).to receive_messages :rm_rf => true, :rm => true
2828
allow(File).to receive_messages :exist? => true
2929
end
3030

@@ -45,7 +45,7 @@
4545
end
4646

4747
it "removes any indexing guard files" do
48-
expect(FileUtils).to receive(:rm_r).with(["/path/to/indices/ts-foo.tmp"])
48+
expect(FileUtils).to receive(:rm_rf).with(["/path/to/indices/ts-foo.tmp"])
4949

5050
command.call
5151
end

0 commit comments

Comments
 (0)