Permalink
Browse files

Replace exists? with #exist?.

Switch to File#exist? since File#exists? "is a deprecated name" in Ruby 2.1: https://github.com/ruby/ruby/blob/ruby_2_1/file.c#L1413
  • Loading branch information...
1 parent c60e2a4 commit 3717a785aa12f0e0e6b56121a68c72fcc630fcd7 @havenwood havenwood committed Jan 3, 2014
Showing with 7 additions and 7 deletions.
  1. +4 −4 lib/bond/m.rb
  2. +1 −1 test/bond_test.rb
  3. +2 −2 test/m_test.rb
View
@@ -82,7 +82,7 @@ def started?
# Returns nil if not found.
def find_gem_file(rubygem, file)
begin gem(rubygem); rescue Exception; end
- (dir = $:.find {|e| File.exists?(File.join(e, file)) }) && File.join(dir, file)
+ (dir = $:.find {|e| File.exist?(File.join(e, file)) }) && File.join(dir, file)
end
# Loads a completion file in Rc namespace.
@@ -94,7 +94,7 @@ def load_file(file)
# Loads completion files in given directory.
def load_dir(base_dir)
- if File.exists?(dir = File.join(base_dir, 'completions'))
+ if File.exist?(dir = File.join(base_dir, 'completions'))
Dir[dir + '/*.rb'].each {|file| load_file(file) }
true
end
@@ -129,7 +129,7 @@ def load_gem_completion(rubygem)
def load_plugin_file(rubygem)
namespace, file = rubygem.split(/\/|-/, 2)
file += '.rb' unless file[/\.rb$/]
- if (dir = $:.find {|e| File.exists?(File.join(e, namespace, 'completions', file)) })
+ if (dir = $:.find {|e| File.exist?(File.join(e, namespace, 'completions', file)) })
load_file File.join(dir, namespace, 'completions', file)
true
end
@@ -139,7 +139,7 @@ def load_completions
load_file File.join(File.dirname(__FILE__), 'completion.rb') unless config[:bare]
load_dir File.dirname(__FILE__) unless config[:bare]
load_gems *config[:gems] if config[:gems]
- load_file(File.join(home,'.bondrc')) if File.exists?(File.join(home, '.bondrc')) && !config[:bare]
+ load_file(File.join(home,'.bondrc')) if File.exist?(File.join(home, '.bondrc')) && !config[:bare]
load_dir File.join(home, '.bond') unless config[:bare]
end
end
View
@@ -62,7 +62,7 @@ def start(options={}, &block)
describe "start with :gems" do
before {
- File.stubs(:exists?).returns(true)
+ File.stubs(:exist?).returns(true)
M.stubs(:load_file)
}
View
@@ -6,8 +6,8 @@
after { $:.pop }
def mock_file_exists(file)
- File.expects(:exists?).at_least(1).returns(false).with {|e| e != file }
- File.expects(:exists?).times(1).returns(true).with {|e| e == file }
+ File.expects(:exist?).at_least(1).returns(false).with {|e| e != file }
+ File.expects(:exist?).times(1).returns(true).with {|e| e == file }
end
it "loads gem" do

0 comments on commit 3717a78

Please sign in to comment.