1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails
Nick Wolf 7cc2b57b8d
Refactor railsrc file location to be xdg compliant (#39411)
* Refactor railsrc file location to be xdg compliant

The XDG Base Directory Specification (which is currently used by
FOSS projects such as Git, Tmux, Pry, Rspec) provides a default
location for various file formats, including config/rc files.

This comment refactors app_generator.rb to load railsrc from
XDG_CONFIG_HOME if both XDG_CONFIG_HOME is set and rails/railrc
exists within the XDG_CONFIG_HOME location.

To maintain backwards compatibility it defaults back to ~/.railsrc
if either XDG_CONFIG_HOME is not set or there is no rails/railsrc.

* Refactor default_rc_file based on jonathanhefner PR feedback

* Update generators/rails/app/USAGE to explain railsrc XDG compliance

* Refactor default_rc_file based on sinsoku PR feedback

* Add test for ARGVScrubber.default_rc_file method

fileutils is required because tmpdir does not allow you to create a new
temp directory with a set title 'inside' another temporary directory, a
file is created for railsrc because tempfile creates a custom and unique
name preventing the specification of a file called 'railsrc'

Currently this test is failing because the ARGVScrubber class seems to
be loading directly from the gem (which still has the previous code)
rather than from the file itself. (loading the code in a pry session
and using show-method ARGVScrubber.default_rc_file reveals it is coming
from
gems/railties-6.0.3.3/lib/rails/generators/rails/app/app_generator.rb:536
instead of
railties/lib/rails/generators/rails/app/app_generator.rb

* Switch to double quote strings

* Add file deletion for argv_scrubber test

* Refactor test_xdg_config_no_custom_rc with jonathanhefner feedback

* Add Changelog for railsrc xdg-specification compliance

* Apply backtick and whitespace refactoring suggestsions from jonathanhefner

* Apply jonathanhefner suggested Changelog refactoring

[Rafael Mendonça França + Nick Wolf + Jonathan Hefner]
2020-10-21 01:21:07 -04:00
..
api
application Add an ActiveSupport option to allow setting a digest class 2020-09-23 17:47:35 +02:00
command Address to false negative for Performance/DeletePrefix,DeleteSuffix 2020-06-14 13:04:47 +09:00
commands Prefer bin/rails for the credentials command 2020-09-02 21:03:56 +01:00
console
engine This kind of wrapper should better not be able to call private methods 2020-10-07 11:12:02 +09:00
generators Refactor railsrc file location to be xdg compliant (#39411) 2020-10-21 01:21:07 -04:00
plugin
rack
railtie require "active_support/core_ext/symbol/starts_ends_with" for Ruby 2.6 2020-05-25 05:24:44 +09:00
tasks Combine and deprecate rails db:structure:{dump,load} tasks into rails db:schema:{dump,load} 2020-08-03 19:08:41 +03:00
templates
test_unit ✂️ [ci skip] 2020-09-16 09:52:10 +09:00
all.rb
app_loader.rb
app_updater.rb
application.rb Load Rails tasks for each new Rake::Application 2020-09-06 14:40:14 -05:00
application_controller.rb
autoloaders.rb
backtrace_cleaner.rb
cli.rb
code_statistics.rb attr_reader methods are public methods 2020-10-07 11:12:01 +09:00
code_statistics_calculator.rb Auto-correct for delete_prefix/delete_suffix 2020-06-05 12:40:39 +09:00
command.rb
commands.rb
configuration.rb Get rid of unnecessary meta programming 2020-10-07 11:12:02 +09:00
dev_caching.rb
engine.rb fix wording in rail/engine class 2020-05-14 08:51:27 +01:00
gem_version.rb
generators.rb Address to false negative for Performance/DeletePrefix,DeleteSuffix 2020-06-14 13:04:47 +09:00
info.rb Remove assumption that a primary config exists 2020-06-04 15:08:59 -04:00
info_controller.rb Use URI::DEFAULT_PARSER rather than instantiate a new one 2020-06-29 23:06:34 +02:00
initializable.rb
mailers_controller.rb
paths.rb
rack.rb
railtie.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
ruby_version_check.rb
secrets.rb
source_annotation_extractor.rb Prefer no allocation start/end_with? over String#[] == 2020-05-29 10:20:13 +09:00
tasks.rb
test_help.rb
version.rb
welcome_controller.rb