Skip to content

Commit

Permalink
Merge pull request bkeepers#121 from rsempe/master
Browse files Browse the repository at this point in the history
File.exists? is now deprecated in Ruby, use File.exist? instead
  • Loading branch information
bkeepers committed Jun 17, 2014
2 parents dbafa8a + bc14d47 commit 6607ce2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 6607ce2

Please sign in to comment.