1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

prefer __dir__ over __FILE__ in File.expand_path

Thinking .. relative to files is not natural, we are used
to think "parent of a directory", and we have __dir__
nowadays.
This commit is contained in:
Xavier Noria 2016-08-11 00:51:05 +02:00
parent a1623fc667
commit 432222fae1
6 changed files with 18 additions and 6 deletions

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
exit Minitest.run(ARGV)

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
exit Minitest.run(ARGV)

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
exit Minitest.run(ARGV)

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
exit Minitest.run(ARGV)

View file

@ -1,6 +1,8 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
module Minitest
def self.plugin_active_record_options(opts, options)
opts.separator ""

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
exit Minitest.run(ARGV)