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

Update Deprecated File.exists? to File.exist? #831

Merged
merged 6 commits into from
Oct 29, 2024
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 config/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def destination_root
end

def extension_uses_rspec?
File.exists?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
File.exist?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
end

def add_options!(opt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def destination_root
end

def extension_uses_rspec?
File.exists?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
File.exist?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
end

def add_options!(opt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def destination_root
end

def extension_uses_rspec?
File.exists?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
File.exist?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
end

def add_options!(opt)
Expand Down
44 changes: 24 additions & 20 deletions lib/generators/instance/instance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,32 @@ def manifest

protected

def banner
"Usage: #{$0} /path/to/trusty_cms/app [options]"
end
def banner
"Usage: #{$0} /path/to/trusty_cms/app [options]"
end

def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
opt.on("-r", "--ruby=path", String,
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
opt.on("-d", "--database=name", String,
"Preconfigure for selected database (options: #{DATABASES.join(", ")}).",
"Default: sqlite3") { |v| options[:db] = v }
end
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
opt.on(
"-r", "--ruby=path", String,
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
"Default: #{DEFAULT_SHEBANG}"
) { |v| options[:shebang] = v }
opt.on(
"-d", "--database=name", String,
"Preconfigure for selected database (options: #{DATABASES.join(", ")}).",
"Default: sqlite3"
) { |v| options[:db] = v }
end

def mysql_socket_location
RUBY_PLATFORM =~ /mswin32/ ? MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } : nil
end
def mysql_socket_location
RUBY_PLATFORM =~ /mswin32/ ? MYSQL_SOCKET_LOCATIONS.find { |f| File.exist?(f) } : nil
end

private

def radiant_root(filename = '')
File.join("..", "..", "..", "..", filename)
end
end
def radiant_root(filename = '')
File.join("..", "..", "..", "..", filename)
end
end
2 changes: 1 addition & 1 deletion lib/generators/trusty_cms/templates/boot.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
6 changes: 3 additions & 3 deletions lib/tasks/framework.rake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ unless File.directory? "#{Rails.root}/app"
task :javascripts do
FileUtils.mkdir_p("#{Rails.root}/public/javascripts/admin/")
copy_javascripts = proc do |project_dir, scripts|
scripts.reject! { |s| File.basename(s) == 'overrides.js' } if File.exists?(project_dir + 'overrides.js')
scripts.reject! { |s| File.basename(s) == 'overrides.js' } if File.exist?(project_dir + 'overrides.js')
FileUtils.cp(scripts, project_dir)
end
copy_javascripts[Rails.root + '/public/javascripts/', Dir["#{File.dirname(__FILE__)}/../../public/javascripts/*.js"]]
Expand Down Expand Up @@ -228,7 +228,7 @@ the new files: #{warning}"
project_dir = Rails.root + '/public/stylesheets/admin/'

copy_stylesheets = proc do |project_dir, styles|
styles.reject! { |s| File.basename(s) == 'overrides.css' } if File.exists?(project_dir + 'overrides.css')
styles.reject! { |s| File.basename(s) == 'overrides.css' } if File.exist?(project_dir + 'overrides.css')
FileUtils.cp(styles, project_dir)
end
copy_stylesheets[Rails.root + '/public/stylesheets/admin/', Dir["#{File.dirname(__FILE__)}/../../public/stylesheets/admin/*.css"]]
Expand All @@ -237,7 +237,7 @@ the new files: #{warning}"
desc 'Update admin sass files from your current trusty install'
task :sass do
copy_sass = proc do |project_dir, sass_files|
sass_files.reject! { |s| File.basename(s) == 'overrides.sass' } if File.exists?(project_dir + 'overrides.sass') || File.exists?(project_dir + '../overrides.css')
sass_files.reject! { |s| File.basename(s) == 'overrides.sass' } if File.exist?(project_dir + 'overrides.sass') || File.exist?(project_dir + '../overrides.css')
sass_files.reject! { |s| File.directory?(s) }
FileUtils.mkpath(project_dir)
FileUtils.cp(sass_files, project_dir)
Expand Down
2 changes: 1 addition & 1 deletion lib/trusty_cms/available_locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module TrustyCms::AvailableLocales
def self.locales
available_locales = {}
TrustyCms.configuration.i18n.load_path.each do |path|
if File.exists?(path) && path !~ /_available_tags/
if File.exist?(path) && path !~ /_available_tags/
locale_yaml = YAML.load_file(path)
stem = File.basename(path, '.yml')
if locale_yaml[stem] && lang = locale_yaml[stem]['this_file_language']
Expand Down
2 changes: 1 addition & 1 deletion lib/trusty_cms/task_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def cache_files(dir, files, cache_file)
end.join("\n\n")

cache_path = File.join(dir, cache_file)
File.delete(cache_path) if File.exists?(cache_path)
File.delete(cache_path) if File.exist?(cache_path)
File.open(cache_path, 'w+') { |f| f.write(cache_content) }
end

Expand Down
2 changes: 1 addition & 1 deletion lib/trusty_cms/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TrustyCms
VERSION = '7.0.1'.freeze
VERSION = '7.0.2'.freeze
end

Loading