From 85ad8c567c11288a167e8995ebca8240c2ccfd9f Mon Sep 17 00:00:00 2001 From: Romain Sempe Date: Tue, 17 Jun 2014 15:07:49 +0200 Subject: [PATCH] File.exists? is now deprecated in Ruby, use File.exist? instead https://github.com/ruby/ruby/blob/trunk/file.c#L1462 --- lib/dotenv-rails.rb | 2 +- lib/dotenv.rb | 4 ++-- spec/dotenv_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dotenv-rails.rb b/lib/dotenv-rails.rb index ca622c98..ad6a2d88 100644 --- a/lib/dotenv-rails.rb +++ b/lib/dotenv-rails.rb @@ -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." diff --git a/lib/dotenv.rb b/lib/dotenv.rb index 6d13ec5b..3700b0df 100644 --- a/lib/dotenv.rb +++ b/lib/dotenv.rb @@ -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 @@ -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 diff --git a/spec/dotenv_spec.rb b/spec/dotenv_spec.rb index db12447a..eaeb4a6b 100644 --- a/spec/dotenv_spec.rb +++ b/spec/dotenv_spec.rb @@ -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