Skip to content

Commit

Permalink
Update File.exists? to File.exist? (#3529)
Browse files Browse the repository at this point in the history
The former was removed in more recent versions of Ruby.
  • Loading branch information
parndt committed May 22, 2023
1 parent 5cbbd14 commit 1d3222b
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -7,7 +7,7 @@ end

APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)

if File.exists?(APP_RAKEFILE)
if File.exist?(APP_RAKEFILE)
load 'rails/tasks/engine.rake'
end

Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/refinery/dummy/dummy_generator.rb
Expand Up @@ -83,7 +83,7 @@ def module_name
def application_definition
@application_definition ||= begin
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
unless options[:pretend] || !File.exists?(dummy_application_path)
unless options[:pretend] || !File.exist?(dummy_application_path)
contents = File.read(dummy_application_path)
contents[(contents.index("module #{module_name}"))..-1]
end
Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/refinery/engine/templates/Rakefile
Expand Up @@ -8,7 +8,7 @@ end
ENGINE_PATH = File.dirname(__FILE__)
APP_RAKEFILE = File.expand_path "../spec/dummy/Rakefile", __FILE__

if File.exists? APP_RAKEFILE
if File.exist? APP_RAKEFILE
load 'rails/tasks/engine.rake'
end

Expand Down
Expand Up @@ -6,7 +6,7 @@ module Refinery
end

def append_load_seed_data
create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
create_file 'db/seeds.rb' unless File.exist?(File.join(destination_root, 'db', 'seeds.rb'))
append_file 'db/seeds.rb', :verbose => true do
<<-EOH

Expand Down
2 changes: 1 addition & 1 deletion core/spec/lib/refinery/cli_spec.rb
Expand Up @@ -98,7 +98,7 @@
Array(spec_success_message).each do |message_fragment|
expect(msg).to include(message_fragment)
end
expect(File.exists?(Rails.root.join(copied_file_location))).to be_truthy
expect(File.exist?(Rails.root.join(copied_file_location))).to be_truthy
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion doc/guides/4 - Refinery Extensions/3 - Testing.md
Expand Up @@ -32,7 +32,7 @@ Add the following lines to your extension's Rakefile
ENGINE_PATH = File.dirname(*FILE*)
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", *FILE*)

load 'rails/tasks/extension.rake' if File.exists?(APP_RAKEFILE)
load 'rails/tasks/extension.rake' if File.exist?(APP_RAKEFILE)

require "refinerycms-testing"
Refinery::Testing::Railtie.load_dummy_tasks ENGINE_PATH
Expand Down
Expand Up @@ -50,7 +50,7 @@ bundle exec puma -C config/puma.rb
```

Apply executable permission:
```
```
chmod +x bin/run.docker.sh
```

Expand All @@ -68,7 +68,7 @@ done
mkdir -p /app/shared/nginx/cache/dragonfly
```
Apply executable permission:
```
```
chmod +x run.symlinks.docker.sh
```

Expand Down Expand Up @@ -186,7 +186,7 @@ threads threads_min, threads_max
environment ENV.fetch("RAILS_ENV") { "development" }
# Executed in Docker container
if File.exists?('/.dockerenv')
if File.exist?('/.dockerenv')
app_dir = File.expand_path("../..", __FILE__)
stdout_redirect "#{app_dir}/log/puma.stdout.log", "#{app_dir}/log/puma.stderr.log", true
Expand Down Expand Up @@ -462,7 +462,7 @@ if you are going only to play with the droplet for few hours.
Install the `ufw` firewall via `apt-get install ufw` and do some initial settings:
```
ufw default deny incoming
ufw allow 22
ufw allow 22
ufw allow 5000
ufw allow 80
ufw allow 443
Expand Down Expand Up @@ -686,16 +686,16 @@ We can now delete the public allow 5433 rule in ufw:
```
To Action From
-- ------ ----
[ 1] 22 ALLOW IN Anywhere
[ 2] 5000 ALLOW IN Anywhere
[ 3] 80 ALLOW IN Anywhere
[ 4] 443 ALLOW IN Anywhere
[ 5] 5433 ALLOW IN Anywhere
[ 6] 5433 ALLOW IN 172.18.0.0/16
[ 7] 22 (v6) ALLOW IN Anywhere (v6)
[ 8] 5000 (v6) ALLOW IN Anywhere (v6)
[ 9] 80 (v6) ALLOW IN Anywhere (v6)
[10] 443 (v6) ALLOW IN Anywhere (v6)
[ 1] 22 ALLOW IN Anywhere
[ 2] 5000 ALLOW IN Anywhere
[ 3] 80 ALLOW IN Anywhere
[ 4] 443 ALLOW IN Anywhere
[ 5] 5433 ALLOW IN Anywhere
[ 6] 5433 ALLOW IN 172.18.0.0/16
[ 7] 22 (v6) ALLOW IN Anywhere (v6)
[ 8] 5000 (v6) ALLOW IN Anywhere (v6)
[ 9] 80 (v6) ALLOW IN Anywhere (v6)
[10] 443 (v6) ALLOW IN Anywhere (v6)
[11] 5433 (v6) ALLOW IN Anywhere (v6)
```
- to delete 5th and 11th rules, run `ufw delete 5` and `ufw delete 11`
Expand All @@ -705,7 +705,7 @@ use the Postgres with non-docker on `5432` and Postgres from Docker via `5433` o

Restart the docker-compose again, it should start correctly.

Now we will check, if the `5433` port is available from the public. From your local machine, run: (replace IP)
Now we will check, if the `5433` port is available from the public. From your local machine, run: (replace IP)
`nmap 46.101.99.215`

You should not see `5433` port available to public.
Expand Down
2 changes: 1 addition & 1 deletion pages/lib/generators/refinery/pages/pages_generator.rb
Expand Up @@ -15,7 +15,7 @@ def generate_pages_initializer
end

def append_load_seed_data
create_file "db/seeds.rb" unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
create_file "db/seeds.rb" unless File.exist?(File.join(destination_root, 'db', 'seeds.rb'))
append_file 'db/seeds.rb', :verbose => true do
<<-EOH
Expand Down
2 changes: 1 addition & 1 deletion pages/spec/support/refinery/pages/caching_helpers.rb
Expand Up @@ -15,7 +15,7 @@ def cache_page(page)

RSpec::Matchers.define :be_cached do
match do |page|
File.exists?(cached_file_path(page))
File.exist?(cached_file_path(page))
end
end

Expand Down
2 changes: 1 addition & 1 deletion tasks/release.rake
Expand Up @@ -14,7 +14,7 @@ root = File.expand_path('../../', __FILE__)

task :clean do
package_dir = "#{root}/pkg"
mkdir_p package_dir unless File.exists?(package_dir)
mkdir_p package_dir unless File.exist?(package_dir)
rm_f gem_filename
end

Expand Down
Expand Up @@ -14,7 +14,7 @@ guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => '
end

guard 'rspec', :version => 2, :spec_paths => extensions.map{ |e| "#{e}/spec"},
:cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do
:cli => (File.read('.rspec').split("\n").join(' ') if File.exist?('.rspec')) do
extensions.each do |extension|
watch(%r{^#{extension}/spec/.+_spec\.rb$})
watch(%r{^#{extension}/app/(.+)\.rb$}) { |m| "#{extension}/spec/#{m[1]}_spec.rb" }
Expand Down

0 comments on commit 1d3222b

Please sign in to comment.