aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
Commit message (Collapse)AuthorAgeFilesLines
* Revise flow to what was described in 03e44f9Kasper Timm Hansen2019-08-041-13/+9
|
* Revise credentials diffing flow to use a separate diff commandKasper Timm Hansen2019-08-041-66/+38
| | | | | | | | | | | | | | Didn't like the complicated stuff that happened on credentials:edit. It would append to .gitattributes multiple times. Though I see why it was written that way. I'm cutting off for now, but since this new flow would require each developer to run --enable perhaps this should really be: 1. Developer enrolls Rails app by running `credentials:diff --enable` 2. credentials:edit checks .gitattributes for `diff=rails_credentials` and if the current file is covered by that. 3. If so, set up the "rails_credentials" driver automatically.
* Extract diffing to separate credentials:diff commandKasper Timm Hansen2019-08-041-28/+24
|
* Do not use the same temp file in different testsyuuji.yaginuma2019-07-271-4/+5
| | | | | It causes unexpected results when running tests in parallel. Ref: https://buildkite.com/rails/rails/builds/62610#0165f6d9-b9c8-4948-9319-07b58bfbfd4f/989-998
* Prettify diff generated by git for encripted file:Edouard CHIN2019-07-261-1/+100
| | | | | | | | | | | | | | | | | | | | | | | | - @sinsoku had the idea and started implementing it few months ago but sadly didn't finish it. This PR is taking over his work. The credentials feature has changed a lot since @sinsoku opened hi PR, it was easier to just restart from scratch instead of checking out his branch. Sinsoku will get all the credit he deserves for this idea :) TL;DR on that that feature is to make the `git diff` or `git log` of encrypted files to be readable. The previous implementation was only setting up the git required configuration for the first time Rails was bootstraped, so I decided to instead provide the user a choice to opt-in for readable diff credential whenever a user types the `bin/rails credentials:edit` command. The question won't be asked in the future the user has already answered or if the user already opted in. Co-authored-by: Takumi Shotoku <insoku.listy@gmail.com>
* Allow using env var to specify pidfileBen Thorner2019-06-191-0/+23
| | | | | | | | | | | | | | | | Previously it was only possible to specify the location of the pidfile for the 'rails server' command with the '-P' flag. This adds support for specifying the pidfile using a PIDFILE env var, which can still be overridden by the '-P' flag and with the default pidfile path unchanged. The motivation for this feature comes from using Docker to run multiple instances of the same rails app. When developing a rails app with Docker, it's common to bind-mount the rails root directory in the running container, so that changes to files are shared between the container and the host. However, this doesn't work so well with the pidfile and it's necessary to (remember to) add a '-P' flag to the 'rails server' command line; being able to specify this flag using an env var would make developing with Rails+Docker a bit simpler.
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-132-2/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Merge pull request #35906 from yoones/notes-tags-registrationRafael França2019-04-151-0/+41
|\ | | | | Notes tags registration
| * Adds `register_tags`Younes SERRAJ2019-04-121-0/+41
| |
* | Remove the Amazon SES ingressGeorge Claghorn2019-04-141-25/+18
|/ | | It's unusable and not ready to ship in Rails 6.0. We'll rewrite it for 6.1.
* Rename `connection` option to `database` in `dbconsole` commandyuuji.yaginuma2019-04-021-6/+18
| | | | | | | | | | | | | | | We introduced `connection` option for specifying spec with 1acd9a6464668d4d54ab30d016829f60b70dbbeb. But now we are using the `database` to specify the same value in other commands. * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb#L11 * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/model/model_generator.rb#L17 The options provided to the users should be uniform. Since the term "database" is used in rake task etc, So I want to be able to use it in `dbconsole` command. Also I deprecated the `connection` option because I think that it would be confusing if there are multiple options to specify a same value.
* Reword test names in credentials_test.rbSharang Dashputre2019-03-251-4/+4
|
* Merge pull request #35723 from sikachu/disable-sandbox-flagGuillermo Iguaran2019-03-241-1/+1
|\ | | | | Add config.disable_sandbox option to Rails console
| * Add config.disable_sandbox option to Rails consolePrem Sichanugrist2019-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | A long-running `rails console --sandbox` could cause a database server to become out-of-memory as it's holding on to changes that happen on the database. Given that it's common for Ruby on Rails application with huge traffic to have separate write database and read database, we should allow the developers to disable this sandbox option to prevent someone from accidentally causing the Denial-of-Service on their server.
* | Add `secret_key_base` when creating new credential fileyuuji.yaginuma2019-03-231-1/+12
|/ | | | | | | | Since `secret_key_base` is expected to be included in credential file, `secret_key_base` should be included even if re-create the file. This is the same behavior as creating a new app. When env is specified, it may be unnecessary, so I added it only when not specifying env.
* Add -e/--environment option to `rails initializers`yuuji.yaginuma2019-03-161-2/+18
| | | | This allows specifying the environment as would any other rails commands.
* Properly expand the environment's name in all commandsyuuji.yaginuma2019-03-152-1/+23
| | | | | | | | | | | | | Since 3777701f1380f3814bd5313b225586dec64d4104, the environment's name is automatically expanded in console and dbconsole commands. In order to match the behavior between the commands, fixes it to have the same behavior of all the commands. This behavior is defined in `EnvironmentArgument`. Since `EnvironmentArgument` also defines the environment option, it is reused. However, since desc was not content that can be used in all comments, fixed desc to be defined for each command.
* Railities typo fixes.alkesh262019-02-012-3/+3
|
* Merge pull request #34789 from christos/fix-editing-new-environment-credentialsKasper Timm Hansen2019-01-251-0/+8
|\ | | | | Don't load app environment when editing credentials
| * Don't load app environment when editing credentialsChristos Zisopoulos2018-12-261-0/+8
| | | | | | | | This avoids missing key exceptions caused by code that tries to read the credentials before they have been added to the encrypted file, for example when editing the credentials for a new environment.
* | Revert "Remove deprecated `server` argument from the rails server command"yuuji.yaginuma2019-01-181-0/+4
| | | | | | | | | | | | This reverts commit fa791fb8e2a718b5d0430c7ca5a454678dfc192d. Reason: `server` argument was deprecated in Rails 6.0. Ref: #32058.
* | Remove deprecated `server` argument from the rails server commandRafael Mendonça França2019-01-171-4/+0
| |
* | Remove deprecated `environment` argument from the rails commandsRafael Mendonça França2019-01-172-43/+4
| |
* | Merge branch 'master' into db_system_change_commandKasper Timm Hansen2019-01-161-38/+45
|\ \
| * | Add Exim and Qmail support to Action MailboxGeorge Claghorn2019-01-121-9/+7
| | |
| * | Added Postmark ingress supportTomek Maszkowski2019-01-091-33/+42
| | |
* | | Revise wording on invalid database error messagesGannon McGibbon2019-01-091-1/+1
| | |
* | | Add rails db:system:change commandGannon McGibbon2019-01-091-0/+62
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Add `rails db:system:change` command for changing databases. ``` bin/rails db:system:change --to=postgresql force config/database.yml gsub Gemfile ``` The change command copies a template `config/database.yml` with the target database adapter into your app, and replaces your database gem with the target database gem.
* | Do not show suggestion message when not exist suggestionyuuji.yaginuma2018-12-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | **before** ``` $ ./bin/rails g g Could not find generator 'g'. Maybe you meant nil? Run `rails generate --help` for more options. ``` **after** ``` $ ./bin/rails g g Could not find generator 'g'. Run `rails generate --help` for more options. ```
* | Import Action MailboxGeorge Claghorn2018-12-251-112/+209
|/
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-212-14/+10
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Use string for arguments in server testyuuji.yaginuma2018-12-131-2/+2
| | | | | | | | | | | When actually execute from the command, the value of ARGV is passed to the server. So they are String. So let's use the same type in the test. Also, this removes the following warning in Ruby 2.6. ``` lib/rails/commands/server/server_command.rb:195: warning: deprecated Object#=~ is called on Integer; it always returns nil ```
* Support environment specific credentials file. (#33521)Wojciech Wnętrzak2018-09-191-5/+21
| | | | | | For `production` environment look first for `config/credentials/production.yml.enc` file that can be decrypted by `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key` master key. Edit given environment credentials file by command `rails credentials:edit --environment production`. Default behavior can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.
* Fix `rails routes -c` for controller name consists of multiple word.Yoshiyuki Kinjo2018-08-201-22/+64
|
* Move 'rails initializers' command to Rails::CommandAnnie-Claude Côté2018-08-161-0/+32
|
* Adds Rails:Command for `dev:cache` that has the same behaviour as the rake taskAnnie-Claude Côté2018-08-131-0/+65
|
* Merge pull request #32381 from q-centrix/update-codeclimate-configsRichard Schneeman2018-07-251-5/+2
|\ | | | | Turn on performance based cops
| * Turn on performance based copsDillon Welch2018-07-231-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* | Merge pull request #33229 from ↵Matthew Draper2018-07-253-4/+4
|\ \ | |/ |/| | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * Show rails instead of bin/rails on USAGE instructionsAlberto Almagro2018-07-061-2/+2
| | | | | | | | | | With this commit, rails commands usage instructions display now +rails+ instead of +bin/rails+ within their recommendations.
| * Recommend use of rails over bin/railsAlberto Almagro2018-07-062-2/+2
| | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | Allow to explicitly specify whether to output Rails' log to stdoutMarkus Doits2018-07-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before Rails' logger output is mirrored to std out if: * environment is development and * the process is not daemonized It was not possible to change that behaviour, e.g. to disable log output in that case or enable it in other cases. Now you can explicitly disable or enable output with the new command line switch `--log-to-stdout`, regardless of any other circumstances. ``` // enable output in production rails server -e production --log-to-stdout // disable output in development rails server -e development --no-log-to-stdout ``` Enabling output when daemonized still makes no sense (since tty is detached), but this is ignored for now. If the command line flag is not specified, old behaviour still applies, so this change is completely backward compatible.
* | Don't show unneeded deprecation warning on server restart.Kasper Timm Hansen2018-07-071-3/+2
|/ | | | | | | | | | | | | | | | | If booting a server via `rails s -u puma`, we'd convert the option to a `using` positional. When using `rails restart` our `restart_command` would the option converted to the using positional and put that in the restart command. Thus we'd show users deprecation warnings for our own code. Fix that by converting a passed positional to an option instead. Also: fix initialize method signature. The local_options are an array, not a hash. But don't even bother assigning defaults as Thor passes them in.
* Make NotesCommand tests more performant by getting rid of unecessary mapAnnie-Claude Côté2018-07-051-12/+12
| | | | | | | * Get rid of map and replace it with a multiplication of "\n" to generate document with multiple line preceding the annotation * Reduce number from 1000 to 100 since it achieves the same goal * Only keep one test for the multiple lines document since it's unecessary to test multiple times * Update some language in tests names to make it clearer what we are testing
* Merge pull request #33220 from anniecodes/notes-commandKasper Timm Hansen2018-07-051-0/+128
|\ | | | | Adds `Rails::Command::NotesCommand` and makes `rake notes` use it under the hood
| * Adds support to register directories and extensions to NotesCommandAnnie-Claude Côté2018-07-041-0/+44
| | | | | | | | | | * Require the application and environnement in the notes command in order to load the config files * Adds tests for both register_directories and register_extensions added to a config file
| * Adds a Rails::Command for NotesAnnie-Claude Côté2018-07-041-0/+84
| | | | | | | | | | | | | | | | * It is called with `rails notes` * It defaults to displaying [OPTIMIZE, FIXME and TODO] annotations * It accepts custom annotations by using `rails notes -a CUSTOM_ANNOTATION OTHER_ANNOTATION` * It defaults to look for annotations in [app config db lib test] as dictated by SourceAnnotationExtractor * It supports ENV["SOURCE_ANNOTATION_DIRECTORIES"] but adds a deprecation warning and recommends using register_directories instead
* | Add an assertion that `credentials:edit` works when `RAILS_MASTER_KEY` env ↵yuuji.yaginuma2018-06-241-1/+1
|/ | | | is specified
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-12/+12
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Deprecate support for using `HOST` environment to specify server IP (#32540)Yuji Yaginuma2018-04-161-1/+15
| | | | | | | | | | | | At SuSE, `$HOST` is set by default and is equal to `$HOSTNAME`. https://www.suse.com/documentation/sled11/book_sle_admin/data/sec_adm_variables.html Therefore, by default, it binds to hostname instead of `localhost`. This seems not to be appropriate as default behavior. In order to avoid the name of the environment variable being used, I changed the environment variable from `HOST` to `BINDING`. Fixes #29516.