Use require_relative introduced in Ruby 1.9.2

The new `require_relative` command is much shorter and easier to read
then the previous:

    -require File.expand_path('../config/application', __FILE__)
    +require_relative 'config/application'
This commit is contained in:
Maikel Linke
2016-07-20 16:07:35 +10:00
parent 984641e46c
commit e57c06c610
8 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -1,4 +1,4 @@
require File.expand_path('../boot', __FILE__)
require_relative 'boot'
require 'rails/all'

View File

@@ -1,5 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
require_relative 'application'
# Initialize the rails application
Openfoodnetwork::Application.initialize!

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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'

View File

@@ -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