summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-03-25 11:06:55 +0100
committerAzul <azul@riseup.net>2016-05-02 08:31:16 -0300
commit00fba5114ae2c6176c88ff0ea152576c5bff657d (patch)
treeba3c7c7410d1f0ec6830ff1244fd016a5c090df7
parent636421bf386e813cb6a87a7499fdedc975b75900 (diff)
upgrade: {File,Dir}.exists? -> exist?
exists? is deprecated in ruby 2.1
-rw-r--r--app/controllers/controller_extension/json_file.rb2
-rw-r--r--config/application.rb2
-rw-r--r--config/initializers/customization.rb2
-rw-r--r--lib/extensions/couchrest.rb2
-rw-r--r--lib/gemfile_tools.rb4
-rw-r--r--lib/tasks/i18n.rake2
6 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/controller_extension/json_file.rb b/app/controllers/controller_extension/json_file.rb
index 6be919a..5b5e55e 100644
--- a/app/controllers/controller_extension/json_file.rb
+++ b/app/controllers/controller_extension/json_file.rb
@@ -12,7 +12,7 @@ module ControllerExtension::JsonFile
end
def fetch_file
- if File.exists?(@filename)
+ if File.exist?(@filename)
@file = File.new(@filename)
else
not_found
diff --git a/config/application.rb b/config/application.rb
index 4a70b04..0e00356 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -13,7 +13,7 @@ Bundler.require(*Rails.groups)
APP_CONFIG = ["defaults.yml", "config.yml"].inject({}) {|config, file|
filepath = File.expand_path(file, File.dirname(__FILE__))
- if File.exists?(filepath) && settings = YAML.load_file(filepath)[Rails.env]
+ if File.exist?(filepath) && settings = YAML.load_file(filepath)[Rails.env]
config.merge(settings)
else
config
diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb
index aaa2939..9f537e9 100644
--- a/config/initializers/customization.rb
+++ b/config/initializers/customization.rb
@@ -26,7 +26,7 @@ Rails.application.config.assets.paths.unshift "#{customization_directory}/styles
#
# Copy files to public
#
-if !defined?(RAKE) && Dir.exists?("#{customization_directory}/public")
+if !defined?(RAKE) && Dir.exist?("#{customization_directory}/public")
require 'fileutils'
FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public", :preserve => true)
end
diff --git a/lib/extensions/couchrest.rb b/lib/extensions/couchrest.rb
index 6967980..4578926 100644
--- a/lib/extensions/couchrest.rb
+++ b/lib/extensions/couchrest.rb
@@ -69,7 +69,7 @@ module CouchRest
def prepare_directory(dir = '')
dir = Rails.root + 'tmp' + 'designs' + dir
- Dir.mkdir(dir) unless Dir.exists?(dir)
+ Dir.mkdir(dir) unless Dir.exist?(dir)
return dir
end
diff --git a/lib/gemfile_tools.rb b/lib/gemfile_tools.rb
index dce2448..d1c00dc 100644
--- a/lib/gemfile_tools.rb
+++ b/lib/gemfile_tools.rb
@@ -68,7 +68,7 @@ def local_config
empty_hash.default_proc = proc{|h, k| h.key?(k.to_s) ? h[k.to_s] : nil}
["defaults.yml", "config.yml"].inject(empty_hash.dup) {|config, file|
filepath = File.join(File.expand_path("../../config", __FILE__), file)
- if File.exists?(filepath)
+ if File.exist?(filepath)
new_config = YAML.load_file(filepath)
['development', 'test','production'].each do |env|
config[env] ||= empty_hash.dup
@@ -87,7 +87,7 @@ end
# or nil if not actually a gem directory
#
def gem_info(gem_dir)
- if Dir.exists?(gem_dir)
+ if Dir.exist?(gem_dir)
gemspec = Dir["#{gem_dir}/*.gemspec"]
if gemspec.any?
gem_name = File.basename(gemspec.first).sub(/\.gemspec$/,'')
diff --git a/lib/tasks/i18n.rake b/lib/tasks/i18n.rake
index 6ffbb23..1034211 100644
--- a/lib/tasks/i18n.rake
+++ b/lib/tasks/i18n.rake
@@ -63,7 +63,7 @@ namespace :i18n do
desc "pull translations from transifex"
task :download do
Dir.chdir('config/') do
- if !File.exists?('transifex.netrc')
+ if !File.exist?('transifex.netrc')
puts "In order to download translations, you need a config/transifex.netrc file."
puts "For example:"
puts "machine www.transifex.com login yourusername password yourpassword"