diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 7bab4cd54..b15d0202a 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -754,12 +754,10 @@ def system_dir # :nodoc: end # The standard directory containing system wide rake files. - if Win32.windows? - def standard_system_dir #:nodoc: + def standard_system_dir #:nodoc: + if windows? File.join(Dir.home, "Rake") - end - else - def standard_system_dir #:nodoc: + else File.join(Dir.home, ".rake") end end diff --git a/test/test_rake_application.rb b/test/test_rake_application.rb index a32d07b17..e661a3c3b 100644 --- a/test/test_rake_application.rb +++ b/test/test_rake_application.rb @@ -365,6 +365,44 @@ def @app.standard_system_dir flunk "failed to find system rakefile" end + def test_load_from_calculated_system_rakefile_on_windows + rakefile_default + def @app.windows? + true + end + + @app.instance_eval do + handle_options [] + options.silent = true + options.load_system = true + options.rakelib = [] + load_rakefile + end + + assert_equal File.join(Dir.home, "Rake"), @app.system_dir + rescue SystemExit + flunk "failed to find system rakefile" + end + + def test_load_from_calculated_system_rakefile_on_unix + rakefile_default + def @app.windows? + false + end + + @app.instance_eval do + handle_options [] + options.silent = true + options.load_system = true + options.rakelib = [] + load_rakefile + end + + assert_equal File.join(Dir.home, ".rake"), @app.system_dir + rescue SystemExit + flunk "failed to find system rakefile" + end + def test_terminal_columns old_rake_columns = ENV["RAKE_COLUMNS"]