Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.exists? is now deprecated in Ruby, use File.exist? instead #121

Merged
merged 1 commit into from
Jun 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/dotenv-rails.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'dotenv/railtie'

env_file = ".env.#{Rails.env}"
if File.exists?(env_file) && !defined?(Dotenv::Deployment)
if File.exist?(env_file) && !defined?(Dotenv::Deployment)
warn "Auto-loading of `#{env_file}` will be removed in 1.0. See " +
"https://github.com/bkeepers/dotenv-deployment if you would like to " +
"continue using this feature."
Expand Down
4 changes: 2 additions & 2 deletions lib/dotenv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Dotenv
def self.load(*filenames)
with(*filenames) { |f| Environment.new(f).apply if File.exists?(f) }
with(*filenames) { |f| Environment.new(f).apply if File.exist?(f) }
end

# same as `load`, but raises Errno::ENOENT if any files don't exist
Expand All @@ -13,7 +13,7 @@ def self.load!(*filenames)

# same as `load`, but will override existing values in `ENV`
def self.overload(*filenames)
with(*filenames) { |f| Environment.new(f).apply! if File.exists?(f) }
with(*filenames) { |f| Environment.new(f).apply! if File.exist?(f) }
end

protected
Expand Down
2 changes: 1 addition & 1 deletion spec/dotenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

it 'expands the path' do
expected = expand("~/.env")
allow(File).to receive(:exists?){ |arg| arg == expected }
allow(File).to receive(:exist?){ |arg| arg == expected }
expect(Dotenv::Environment).to receive(:new).with(expected).
and_return(double(:apply => {}, :apply! => {}))
subject
Expand Down