Skip to content

Commit

Permalink
Force deletion of temp directories
Browse files Browse the repository at this point in the history
If they’re there, we want them gone.
  • Loading branch information
pat committed Jul 7, 2024
1 parent c0e8399 commit 4d962e5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/thinking_sphinx/commands/clear_real_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def call
Dir["#{index.path}.*"].each { |path| FileUtils.rm path }
end

FileUtils.rm_r(binlog_path) if File.exist?(binlog_path)
FileUtils.rm_rf(binlog_path) if File.exist?(binlog_path)
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/thinking_sphinx/commands/clear_sql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def call
Dir["#{index.path}.*"].each { |path| FileUtils.rm path }
end

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

private
Expand Down
2 changes: 1 addition & 1 deletion lib/thinking_sphinx/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.clear
config.indices_location,
config.searchd.binlog_path
].each do |path|
FileUtils.rm_r(path) if File.exist?(path)
FileUtils.rm_rf(path) if File.exist?(path)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/thinking_sphinx/commands/clear_real_time_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
allow(Dir).to receive(:[]).with('/path/to/my/index/parts.*').
and_return(['parts.a', 'parts.b'])

allow(FileUtils).to receive_messages :rm_r => true,
allow(FileUtils).to receive_messages :rm_rf => true,
:rm => true
allow(File).to receive_messages :exist? => true
end
Expand All @@ -30,7 +30,7 @@
end

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

command.call
end
Expand Down
4 changes: 2 additions & 2 deletions spec/thinking_sphinx/commands/clear_sql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
allow(Dir).to receive(:[]).with('/path/to/indices/ts-*.tmp').
and_return(['/path/to/indices/ts-foo.tmp'])

allow(FileUtils).to receive_messages :rm_r => true, :rm => true
allow(FileUtils).to receive_messages :rm_rf => true, :rm => true
allow(File).to receive_messages :exist? => true
end

Expand All @@ -45,7 +45,7 @@
end

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

command.call
end
Expand Down

0 comments on commit 4d962e5

Please sign in to comment.