diff --git a/bin/omnibus b/bin/omnibus index 04d27928c..0756149a1 100755 --- a/bin/omnibus +++ b/bin/omnibus @@ -4,7 +4,7 @@ # https://twitter.com/mitchellh/status/283014103189053442 Signal.trap("INT") { exit 1 } -$:.push File.expand_path("../../lib", __FILE__) +$:.push File.expand_path("../lib", __dir__) $stdout.sync = true require "omnibus/cli" diff --git a/lib/omnibus.rb b/lib/omnibus.rb index 2dc7a8942..624fedda2 100644 --- a/lib/omnibus.rb +++ b/lib/omnibus.rb @@ -208,7 +208,7 @@ def project(name) # @return [Pathname] # def source_root - @source_root ||= Pathname.new(File.expand_path("../..", __FILE__)) + @source_root ||= Pathname.new(File.expand_path("..", __dir__)) end # diff --git a/lib/omnibus/generator.rb b/lib/omnibus/generator.rb index 74bb8c89a..54e47184c 100644 --- a/lib/omnibus/generator.rb +++ b/lib/omnibus/generator.rb @@ -73,7 +73,7 @@ class Generator < Thor::Group class << self # Set the source root for Thor def source_root - File.expand_path("../generator_files", __FILE__) + File.expand_path("generator_files", __dir__) end end diff --git a/omnibus.gemspec b/omnibus.gemspec index a0d202338..4a563cab0 100644 --- a/omnibus.gemspec +++ b/omnibus.gemspec @@ -1,4 +1,4 @@ -lib = File.expand_path("../lib", __FILE__) +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "omnibus/version" diff --git a/spec/support/path_helpers.rb b/spec/support/path_helpers.rb index 5ca6eae26..3bd167a68 100644 --- a/spec/support/path_helpers.rb +++ b/spec/support/path_helpers.rb @@ -6,13 +6,13 @@ def fixture_path(*pieces) end def tmp_path - File.expand_path("../../tmp", __FILE__) + File.expand_path("../tmp", __dir__) end private def fixtures_path - File.expand_path("../../fixtures", __FILE__) + File.expand_path("../fixtures", __dir__) end end end