diff --git a/Rakefile b/Rakefile index 9ed55e022e..b462be57e6 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require_relative 'config/application' Openfoodnetwork::Application.load_tasks diff --git a/config/application.rb b/config/application.rb index 6ffee13160..a763f54718 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' diff --git a/config/environment.rb b/config/environment.rb index 9f6b854161..f3522b8759 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the rails application -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the rails application Openfoodnetwork::Application.initialize! diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index bfa57a07dd..ee8c698c7b 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -5,8 +5,8 @@ namespace :openfoodnetwork do desc 'load sample data' task :load_sample_data => :environment do - require File.expand_path('../../../spec/factories', __FILE__) - require File.expand_path('../../../spec/support/spree/init', __FILE__) + require_relative '../../spec/factories' + require_relative '../../spec/support/spree/init' task_name = "openfoodnetwork:dev:load_sample_data" # -- Shipping / payment information diff --git a/script/delayed_job b/script/delayed_job index edf195985f..cecd9acddd 100755 --- a/script/delayed_job +++ b/script/delayed_job @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) +require_relative '../config/environment' require 'delayed/command' Delayed::Command.new(ARGV).daemonize diff --git a/script/rails b/script/rails index f8da2cffd4..dc40bb7e84 100755 --- a/script/rails +++ b/script/rails @@ -2,5 +2,5 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +require_relative '../config/boot' require 'rails/commands' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f4c5b73fac..c7a7f8e790 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,7 @@ Knapsack.tracker.config({enable_time_offset_warning: false}) unless ENV['CI'] Knapsack::Adapters::RSpecAdapter.bind ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) +require_relative "../config/environment" require 'rspec/rails' require 'capybara' require 'database_cleaner' diff --git a/test/test_helper.rb b/test/test_helper.rb index 8bf1192ffe..7d57a78563 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,5 @@ ENV["RAILS_ENV"] = "test" -require File.expand_path('../../config/environment', __FILE__) +require_relative '../config/environment' require 'rails/test_help' class ActiveSupport::TestCase