aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
Commit message (Collapse)AuthorAgeFilesLines
* Allow to pass a connection to the `dbconsole` commandRobin Dupret2017-07-161-2/+14
| | | | | | | | | | | Since 0a4f6009, it's possible to specify a 3-level database configuration to gather connections by environment. The `dbconsole` command will try to look for a database configuration which points to the current environment but with such flavour, the environment key is flushed out so let's add the ability to specify the connection and pick `primary` by default to be consistent with Active Record.
* * Don't eagerly require Rails' minitest plugin.Kasper Timm Hansen2017-07-101-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making the Rails minitest behave like a standard minitest plugin we're much more likely to not break when people use other minitest plugins. Like minitest-focus and pride. To do this, we need to behave like minitest: require files up front and then perform the plugin behavior via the at_exit hook. This also saves us a fair bit of wrangling with test file loading. Finally, since the environment and warnings options have to be applied as early as possible, and since minitest loads plugins at_exit, they have to be moved to the test command. * Don't expect the root method. It's likely this worked because we eagerly loaded the Rails minitest plugin and that somehow defined a root method on `Rails`. * Assign a backtrace to failed exceptions. Otherwise Minitest pukes when attempting to filter the backtrace (which Rails' backtrace cleaner then removes). Means the exception message test has to be revised too. This is likely caused by the rails minitest plugin now being loaded for these tests and assigning a default backtrace cleaner.
* Load environment file in `dbconsole` commandyuuji.yaginuma2017-07-091-0/+1
| | | | | | | | | Currently the environment file is not loaded in `dbconsole` command. Therefore, for example, if use encrypted secrets values in database.yml, `read_encrypted_secrets` will not be true, so the value can not be used correctly. Fixes #29717
* Add `rails secrets:show` commandyuuji.yaginuma2017-07-071-0/+4
| | | | | | | | | | | When secrets confirmed with the `secrets:edit` command, `secrets.yml.enc` will change without updating the secrets. Therefore, even if only want to check secrets, the difference will come out. This is a little inconvenient. In order to solve this problem, added the `secrets:show` command. If just want to check secrets, no difference will occur use this command.
* [Railties] require => require_relativeAkira Matsuda2017-07-019-14/+14
|
* Add the `<app_root>/test` dir to the `$LOAD_PATH` as a string:Edouard CHIN2017-06-161-1/+1
| | | | - [Rails <= 5.0](https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/commands/test.rb#L6) used to add the `<app_root>/test` as a string; this behaviour changed in rails 5.1, it's appending a `Pathname` object
* Access EDITOR through Ruby's cross-platform ENV.Kasper Timm Hansen2017-06-111-2/+2
| | | | | Fix the mistake of not using Ruby's ENV hash from the get go and get windows support.
* Merge pull request #29146 from y-yagi/fix_29138Kasper Timm Hansen2017-05-281-2/+9
|\ | | | | Correctly set user_supplied_options when there is no whitespace in option specification
| * Correctly set user_supplied_options when there is no whitespace in option ↵yuuji.yaginuma2017-05-241-2/+9
| | | | | | | | | | | | | | | | | | | | specification Current `user_supplied_options` method can not set the value correctly if there is no space between option and value (e.g., `-p9000`). This makes it possible to set the value correctly in the case like the above. Fixes #29138
* | Reorder first secrets edit flow.Kasper Timm Hansen2017-05-251-4/+16
| | | | | | | | | | | | Setup config/secrets.yml.enc with template contents for people to edit. Then generate encryption key and encrypt the initial secrets.
* | Remove needless waiting message.Kasper Timm Hansen2017-05-231-1/+0
|/ | | | | Needed back when we attempted to wait for editors, but now we expect users to pass a -w flag to their $EDITOR.
* Update system test runner docseileencodes2017-05-141-8/+9
| | | | | | | | | It wasn't clear that system tests don't run with the rest of the test suite and are part of a separate command. This documents the `test:system` command as well as update the Rails runner help documentation to make it clearer that system tests are run via their own command by default.
* Allow irb options to be passed from `rails console` commandyuuji.yaginuma2017-05-081-2/+14
| | | | Fixes #28988
* CLI arg `--port` has precedence over env `PORT`.koshigoe2017-05-011-2/+3
|
* Use appropriate type to `header` optionyuuji.yaginuma2017-04-051-1/+1
| | | | | The `header` option checks only whether it is specified or not. https://github.com/rails/rails/blob/e8c33349bfabca28996ac74d344d69c7aaffec50/railties/lib/rails/commands/dbconsole/dbconsole_command.rb#L52
* Do not show hidden namespaces in destroy commnad helpyuuji.yaginuma2017-03-271-0/+3
|
* Merge pull request #28527 from rst/fix_runner_argv_28515Rafael França2017-03-221-2/+3
|\ | | | | Correctly reset ARGV for "rails runner `CODE' arg arg arg..."
| * Correctly reset ARGV for "rails runner `CODE' arg arg arg..."Robert Thau2017-03-221-2/+3
| | | | | | | | | | | | The code itself should not be in the ARGV vector. Fixes #28515
* | CLI arg "host" has precedence over ENV var "host"Jon Moss2017-03-211-2/+4
|/ | | | | | | This is a regression from when the server command switched to its own argument parser, as opposed to Rack's. Rack's argument parser, when provided with a "host" argument, gives that value precedence over environment variables.
* Make destroy command work within enginesyuuji.yaginuma2017-03-141-2/+2
| | | | | Instead of calling methods of Rails.application directly, we need to use a method that is considered for the rails engine.
* Merge pull request #28182 from y-yagi/show_correct_rails_commandsKasper Timm Hansen2017-03-096-17/+29
|\ | | | | Show correct commands in help
| * Show correct commands in helpyuuji.yaginuma2017-03-036-17/+29
| | | | | | | | | | Currently rails' help shows only namespace. However, the secrets command needs to specify command. Therefore, I fixed the command to display in help.
* | [ci skip] Document read_encrypted_secrets config.Kasper Timm Hansen2017-03-091-0/+8
| | | | | | | | | | | | Mostly just that it's there. Closes #28193.
* | Convert `ENV["EDITOR"]` to string before checkyuuji.yaginuma2017-03-021-1/+1
| | | | | | | | | | | | In order to avoid `NoMethodError` when it is nil. Follow up to 82f7dc6178f86e5e2dd82f9e528475a6acee6cd8
* | Put it to me straight: just say it.Kasper Timm Hansen2017-03-011-3/+3
| | | | | | | | Prefer Thor's say method to Kernel's plain puts.
* | Tell users how to assign a $EDITOR.Kasper Timm Hansen2017-03-011-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case there's no $EDITOR assigned users would see a cryptic: ``` % EDITOR= bin/rails secrets:edit Waiting for secrets file to be saved. Abort with Ctrl-C. sh: /var/folders/wd/xnncwqp96rj0v1y2nms64mq80000gn/T/secrets.yml.enc: Permission denied New secrets encrypted and saved. ``` That error is misleading, so give a hint in this easily detectable case. Fixes #28143.
* | `HOST` must be all capital lettersyuuji.yaginuma2017-03-011-1/+1
| | | | | | | | Ref: https://github.com/rails/rails/blob/master/railties/lib/rails/commands/server/server_command.rb#L194
* | Set correct host except development environmentyuuji.yaginuma2017-02-271-3/+7
|/ | | | | | | | Currently `localhost` is used for the default host in all environments. But up to Rails 5.0, `0.0.0.0` is used except for development. So fixed to use the same value as 5.0. Fixes #28184
* Merge pull request #28137 from schneems/schneems/fix-default-puma-portRichard Schneeman2017-02-241-11/+44
|\ | | | | [close #24435] Send user_supplied_options to server
| * [close #24435] Send user_supplied_options to serverschneems2017-02-241-11/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when Puma gets a `:Port` it doesn't know if it is Rails' default port or if it is one that is specified by a user. Because of this it assumes that the port passed in is always a user defined port and therefor 3000 always "wins" even if you specify `port` inside of the `config/puma.rb` file when booting your server with `rails s`. The fix is to record the options that are explicitly passed in from the user and pass those to the Puma server (or all servers really). Puma then has enough information to know when `:Port` is the default and when it is user defined. I went ahead and did this for all values rails server exposes as server side options for completeness. The hardest thing was converting the input say `-p` or `--port` into the appropriate "name", in this case `Port`. There may be a more straightforward way to do this with Thor, but I'm not an expert here. Move logic for parsing user options to method Better variable name for iteration Explicitly test `--port` user input ✂️ Update array if environment variables are used
* | does not show hidden namespaces in generator's helpyuuji.yaginuma2017-02-241-0/+3
|/
* Yank the intricate immediately-exiting editor recognition.Kasper Timm Hansen2017-02-231-16/+2
| | | | | | | | | | | | | | Most editors support a wait flag of some kind which prevents their process from exiting until the file or window is closed. Prefer people to assign that themselves than us mucking around with File mtimes or other such things. Example of an editor config: ``` export EDITOR="atom --wait" ```
* Revert "Revert "Add encrypted secrets""Kasper Timm Hansen2017-02-232-0/+102
|
* Revert "Add encrypted secrets" (#28127)David Heinemeier Hansson2017-02-232-102/+0
|
* Add encrypted secrets (#28038)Kasper Timm Hansen2017-02-232-0/+102
|
* Prevent multiple values being set to `run_via`yuuji.yaginuma2017-02-181-1/+1
| | | | | When executing the test via rake, since `rake` is set for `run_via`, `ruby` should not be set. Related 2cb6c27310452da11b93d729c3b760ce988106e1
* make all rails commands work in engineyuuji.yaginuma2017-01-092-16/+8
| | | | | | | | Currently, all rails commands can be executed in engine, but `server`, `console`, `dbconsole` and `runner` do not work. This make all rails commands work in engine. Related to #22588
* Remove needless `ActiveSupport::Deprecation.silence`Ryuta Kamizono2016-12-311-3/+1
|
* Merge branch 'master' into fix_26964Kasper Timm Hansen2016-12-293-4/+6
|\
| * Privatize unneededly protected methods in RailtiesAkira Matsuda2016-12-251-3/+3
| |
| * `ARGV.shift` before calling Rails generatorsJon Moss2016-12-171-0/+2
| | | | | | | | | | | | Gems like rspec-rails depend on `ARGV` being shifted, and `scaffold` (for example) not being the first item in `ARGV`. This should allow rspec-rails to be passing on Rails master.
| * use appropriate type for `rc` optionyuuji.yaginuma2016-12-141-1/+1
| | | | | | | | | | | | | | | | This fixes the following warning. ``` Expected boolean default value for '--rc'; got "~/.railsrc" (string) ```
* | use Thor option parser in server commands parseyuuji.yaginuma2016-12-241-54/+67
|/ | | | | | | | | | The `ServerCommand` inherits Thor, but currently does not use Thor option parser. Therefore, if leave the argument of Thor as it is, it becomes an error by the argument checking of Thor. To avoid it, to use the Thor option parser instead of reimplementing it. Fixes #26964
* use `Gem.win_platform?` to check windows Ruby platformsyuuji.yaginuma2016-11-301-1/+1
| | | | | `Gem.win_platform?` check if it is Windows more accurately. Ref: https://github.com/ruby/ruby/blob/ruby_2_2/lib/rubygems.rb#L945..L952
* Pass `rails runner` args onto file again.Kasper Timm Hansen2016-11-201-1/+2
| | | | | | | | | When making the new command insfrastructure I had missed that `bin/rails runner some_file.rb some args` would pass the extra args onto the file in `ARGV`. Now fixed by allowing the command to take extra args again, and make sure to remove the file name from `ARGV`.
* remove unused requireyuuji.yaginuma2016-11-051-3/+0
| | | | YAML and ERB were removed at 971d510
* Hide commands from API site.Kasper Timm Hansen2016-10-2813-17/+17
| | | | | They're just barren on the site and confure more than guide, instead rely on the built in --help to guide users.
* Use `on_load` to trigger commandline processing codeAaron Patterson2016-10-211-5/+0
| | | | We need to use on_load so that plugins will get the same functionality
* Prevent the test framework from being loaded in production modeAaron Patterson2016-10-211-0/+5
| | | | | | | | | | | | The test framework should not be autoloaded in production mode. Before this commit, the testing railtie would extend AS::TestCase. This caused AS::TestCase to be preloaded regardless of the environment in which we were running. This commit just moves the code that adds line filtering support in to the test command where we actually execute the test runner. That allows us to maintain the line runner feature but only load the minimal amount of code we need.
* remove `mongrel` once againyuuji.yaginuma2016-09-291-1/+1
| | | | `mongrel` was removed in #26408. But have back accidentally in #26414.