1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/generators
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
..
actions_test.rb WIP inline option 2020-01-09 15:49:58 -06:00
api_app_generator_test.rb Both update_config_files and update_bin_files are public methods 2020-10-07 11:25:26 +09:00
app_generator_test.rb Both update_config_files and update_bin_files are public methods 2020-10-07 11:25:26 +09:00
application_record_generator_test.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
argv_scrubber_test.rb Refactor railsrc file location to be xdg compliant (#39411) 2020-10-21 01:21:07 -04:00
assets_generator_test.rb Make Webpacker the default JavaScript compiler for Rails 6 (#33079) 2018-09-30 22:31:21 -07:00
benchmark_generator_test.rb Fix the environment.rb file path in the benchmark generator template 2020-02-03 17:36:56 +05:30
channel_generator_test.rb Add channel test generator 2019-01-13 21:54:31 -05:00
controller_generator_test.rb Module#const_set is a public method 2020-09-15 17:19:37 +09:00
create_migration_test.rb Add config.generators.after_generate for processing to generated files 2020-05-08 21:06:04 +09:00
db_system_change_generator_test.rb Update pg gem required version to 1.1 2020-04-27 16:27:40 +09:00
generated_attribute_test.rb Fix test name that no longer raises exception 2020-06-02 10:01:30 +02:00
generator_generator_test.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
generator_test.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
generators_test_helper.rb The abstract parent class file generated via generator should not be pluralized 2020-08-02 22:25:57 +05:30
helper_generator_test.rb Enable Style/RedundantBegin cop to avoid newly adding redundant begin block 2018-12-21 06:12:42 +09:00
integration_test_generator_test.rb Remove redundant suffixes on generated integration tests. 2018-12-12 12:12:51 -05:00
job_generator_test.rb Fix duplicated suffix for JobGenerator 2018-04-22 12:09:04 +09:00
mailer_generator_test.rb Module#const_set is a public method 2020-09-15 17:19:37 +09:00
migration_generator_test.rb The abstract parent class file generated via generator should not be pluralized 2020-08-02 22:25:57 +05:30
model_generator_test.rb ✂️ [ci skip] 2020-09-16 09:52:10 +09:00
named_base_test.rb Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
namespaced_generators_test.rb Address to rubocop offences 2019-07-31 17:48:14 +09:00
orm_test.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
plugin_generator_test.rb Fix backtraces for generated plugin tests 2020-10-07 15:40:56 -05:00
plugin_test_helper.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
plugin_test_runner_test.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
resource_generator_test.rb Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
scaffold_controller_generator_test.rb Module#const_set is a public method 2020-09-15 17:19:37 +09:00
scaffold_generator_test.rb The abstract parent class file generated via generator should not be pluralized 2020-08-02 22:25:57 +05:30
shared_generator_tests.rb Use ES module syntax for application.js.tt and docs 2020-06-16 15:12:12 -04:00
system_test_generator_test.rb Remove redundant suffixes on generated system tests. 2018-12-11 18:09:16 -05:00
task_generator_test.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
test_runner_in_engine_test.rb Show rails instead of bin/rails on USAGE instructions 2018-07-06 22:46:54 +02:00