aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
Commit message (Collapse)AuthorAgeFilesLines
* Add tests for credentials commandyuuji.yaginuma2017-09-151-0/+19
|
* Make master key added to gitignore the same value as when creating appplicationyuuji.yaginuma2017-09-141-0/+30
| | | | | | | | | For gitignore generated by `rails new`, key with a leading slash is specified. https://github.com/rails/rails/blob/69f976b859cae7f9d050152103da018b7f5dda6d/railties/lib/rails/generators/rails/app/templates/gitignore#L11 Therefore, when executing `credentials:edit`, also need leading slack. In order to avoid such a difference, fixed to use same method for `rails new` and `credentials:edit`.
* Run in-app rails commands via fork+load where possibleMatthew Draper2017-09-041-4/+7
| | | | | While this avoids shell argument parsing, we still pass through everything in our stack.
* Fix `can't modify frozen String` error in `DBConsole`yuuji.yaginuma2017-08-291-0/+6
| | | | | | | | | Without this, `dbconsole` raises an error as follwing: ``` RuntimeError: can't modify frozen String railties/lib/rails/commands/dbconsole/dbconsole_command.rb:79:in `start' ```
* Make `restart` and `dev:cache` tasks work when customizing pid file pathyuuji.yaginuma2017-08-211-1/+1
| | | | | | | | | | Originally, it hard-coded pid file path. It can not be removed when customizing pid file path. But rake task can not get pid file path. Therefore, do not remove file in rake task, makes it possible to judge whether it is restart from the argument of the command and removes the file in server command. Fixes #29306
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-144-0/+8
|
* Properly expand the environment's nameRobin Dupret2017-07-162-0/+11
| | | | | | | | | Running the `console` and `dbconsole` commands with a regular argument as the environment's name automatically expand it to match an existing environment (e.g. dev for development). This feature wasn't available using the `--environment` (a.k.a `-e`) option.
* Deprecate environment as an argument for dbconsole and consoleRobin Dupret2017-07-162-12/+24
| | | | | | People should rather rely on the `-e` or `--environment` options to specify in which environment they want to work. This will allow us to specify the connection to pick as a regular argument in the future.
* Allow to pass a connection to the `dbconsole` commandRobin Dupret2017-07-161-0/+43
| | | | | | | | | | | 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.
* Add `rails secrets:show` commandyuuji.yaginuma2017-07-071-0/+13
| | | | | | | | | | | 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.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-024-4/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-014-0/+4
|
* Do not use UTF8 in test SecretsCommandTest#test_edit_secretsPavel Valena2017-05-301-1/+1
|
* Merge pull request #29146 from y-yagi/fix_29138Kasper Timm Hansen2017-05-281-0/+6
|\ | | | | 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-0/+6
| | | | | | | | | | | | | | | | | | | | 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-5/+2
|/ | | | | | Setup config/secrets.yml.enc with template contents for people to edit. Then generate encryption key and encrypt the initial secrets.
* CLI arg `--port` has precedence over env `PORT`.koshigoe2017-05-011-0/+12
|
* CLI arg "host" has precedence over ENV var "host"Jon Moss2017-03-211-0/+8
| | | | | | | 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.
* Add secrets edit testyuuji.yaginuma2017-03-121-0/+13
|
* Tell users how to assign a $EDITOR.Kasper Timm Hansen2017-03-011-0/+24
| | | | | | | | | | | | | | | 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.
* Set correct host except development environmentyuuji.yaginuma2017-02-271-0/+18
| | | | | | | | 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
* [close #24435] Send user_supplied_options to serverschneems2017-02-241-0/+8
| | | | | | | | | | | | | | | | | | 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
* improve server default options testyuuji.yaginuma2017-01-091-3/+3
| | | | | | | This test was added in 221b4ae. 221b4ae modified to return the same result even if `Rails::Server#default_options` is called more than once. Therefore, also use `Rails::Server#default_options` instead of `ServerCommand#default_options` in test.
* Merge branch 'master' into fix_26964Kasper Timm Hansen2016-12-291-1/+1
|\
| * "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
| |
* | use Thor option parser in server commands parseyuuji.yaginuma2016-12-241-36/+43
|/ | | | | | | | | | 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
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-9/+9
|
* Fix server command tests.Kasper Timm Hansen2016-09-251-1/+2
|
* Fix dbconsole tests.Kasper Timm Hansen2016-09-251-22/+55
|
* Fix console tests.Kasper Timm Hansen2016-09-251-6/+30
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-6/+6
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-3/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-062-50/+50
|
* applies new string literal convention in railties/testXavier Noria2016-08-063-84/+84
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use the HOST environment variable for rails server #25677Evgeny Vlasenko2016-07-051-0/+7
|
* Fix rails restart issue with PumaPrathamesh Sonpatki2016-03-301-0/+14
| | | | | | | | | | | | | | | - We need to pass the restart command to Puma so that it will use it while restarting the server. - Also made sure that all the options passed by user while starting the server are used in the generated restart command so that they will be used while restarting the server. - Besides that we need to remove the server.pid file for the previous running server because otherwise Rack complains about it's presence. - We don't care if the server.pid file does not exist. We only want to delete it if it exists. - This also requires some changes on Puma side which are being tracked here - https://github.com/puma/puma/pull/936. - Fixes #23910.
* changed default value of `caching` option to `nil`yuuji.yaginuma2016-03-211-1/+2
| | | | | | | The default is that's false, caching even if you do not specify the caching option is determined not to use, and `tmp/caching-dev.txt` will be deleted. If it is this, regardless of whether or not there is `tmp/caching-dev.txt`, be sure to order would be necessary to specify the caching option, I think that in than good to so as not to do anything by default.
* revert dev:cache to rake task, fixes #23410Scott Bronson2016-02-071-32/+0
|
* Avoid multiple default paths to server.pid fileTawan Sierek2016-01-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Fix bug (#22811) that occurs when rails server is started in daemon mode and optional path to the `server.pid` file is omitted. Store default path in a constant instead of evaluating it multiple time using `File.expand_path`. The bug in detail: The server startup procedure crashes, since it tries to open a file at `/tmp/pids/server.pid` instead of `<path to project>/tmp/pids/server.pid`. This bug was introduced in 51211a94bd when Rack was upgraded from version 1.x to 2.x. Since version 2.x, Rack does not memoize the options hash [1], and as a consequence `Rails::Server#default_options` will be evaluated multiple times. The hash returned by `Rails::Server#default_options` holds the default path to the `server.pid` file. The path is generated with the method `File.expand_path`. However, the return value of this method depends on the current working directory [2], which changes once `Process.daemon` is invoked by `Rack::Server#daemonize_app` and the process is detached from the current shell. Close #22811 [1]https://git.io/vzen2 [2]http://ruby-doc.org/core-2.1.5/File.html#method-c-expand_path
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-3/+3
|
* Clarify the need to run command twice.Kasper Timm Hansen2015-12-071-2/+2
| | | | | We had 2 pull requests erronously trying to remove the first command. Add some comments for clarity.
* Add Rails command infrastructure and encapsulate development cachingChuck Callebs2015-12-041-0/+32
|
* Use the PORT environment variable for rails serverDavid Cornu2015-08-181-0/+7
|
* Add rake dev:cache task to enable dev mode caching.Chuck Callebs2015-08-041-0/+16
| | | | | | | | | | | | | | | | Taken from @Sonopa's commits on PR #19091. Add support for dev caching via "rails s" flags. Implement suggestions from @kaspth. Remove temporary cache file if server does not have flags. Break at 80 characters in railties/CHANGELOG.md Remove ability to disable cache based on server options. Add more comprehensive options: --dev-caching / --no-dev-caching
* Refactor railties console and dbconsole commandsMehmet Emin İNAÇ2015-05-101-8/+4
| | | | fix minor convention problems
* Remove sqlite support from `rails dbconsole`Andrew White2015-04-221-6/+0
| | | | | | Support for versions of SQLite less than 3 was removed in #6011 as part of the Rails 4.0 release. Therefore there is no need to have support for it in the `rails dbconsole` command anymore.
* Revert "Merge pull request #19404 from dmathieu/remove_rack_env"Jeremy Kemper2015-03-203-19/+56
| | | | | | | Preserving RACK_ENV behavior. This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
* don't fallback to RACK_ENV when RAILS_ENV is not presentDamien Mathieu2015-03-193-56/+19
|
* Remove debugger supportRafael Mendonça França2015-01-041-22/+0
| | | | | bebugger doesn't work with Ruby 2.2 so we don't need to support it anymore