aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Expectations firstAkira Matsuda2014-08-281-5/+5
|
* Reset RACK_ENV after modified in a test caseAkira Matsuda2014-08-281-0/+1
|
* Remove mocha usageRafael Mendonça França2014-07-231-2/+5
|
* Stop using mocha on dbconsole_testRafael Mendonça França2014-07-151-44/+68
|
* Stop using mocha on console_testRafael Mendonça França2014-07-071-15/+40
|
* Isolate debugger related codeDavid Rodríguez de Dios2014-04-101-13/+19
|
* Keep debugger support only for rubies < 2.0.0David Rodríguez de Dios2014-04-081-3/+3
|
* Ensure Active Record connection consistencyschneems2014-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently Active Record can be configured via the environment variable `DATABASE_URL` or by manually injecting a hash of values which is what Rails does, reading in `database.yml` and setting Active Record appropriately. Active Record expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot rip out this functionality without deprecating. This presents a problem though when both config is set, and a `DATABASE_URL` is present. Currently the `DATABASE_URL` should "win" and none of the values in `database.yml` are used. This is somewhat unexpected to me if I were to set values such as `pool` in the `production:` group of `database.yml` they are ignored. There are many ways that active record initiates a connection today: - Stand Alone (without rails) - `rake db:<tasks>` - ActiveRecord.establish_connection - With Rails - `rake db:<tasks>` - `rails <server> | <console>` - `rails dbconsole` We should make all of these behave exactly the same way. The best way to do this is to put all of this logic in one place so it is guaranteed to be used. Here is my prosed matrix of how this behavior should work: ``` No database.yml No DATABASE_URL => Error ``` ``` database.yml present No DATABASE_URL => Use database.yml configuration ``` ``` No database.yml DATABASE_URL present => use DATABASE_URL configuration ``` ``` database.yml present DATABASE_URL present => Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url` sub key "wins". If other paramaters `adapter` or `database` are specified in YAML, they are discarded as the `url` sub key "wins". ``` ### Implementation Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge all connection information before returning. This is achieved through a utility class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`. To understand the exact behavior of this class, it is best to review the behavior in activerecord/test/cases/connection_adapters/connection_handler_test.rb though it should match the above proposal.
* Fix DB Console tests schneems2013-12-211-20/+22
| | | | | | | | | | | The build is broken: https://travis-ci.org/rails/rails/builds/15824530 This commit fixes it. The problem: Sqlite expects the `database` part to be an absolute path. That prompted this change to be committed to master: https://github.com/rails/rails/commit/fbb79b517f3127ba620fedd01849f9628b78d6ce This change provides correct behavior. Unfortunately tests were introduced in https://github.com/rails/rails/commit/971d5107cd4cd08c22a85d34546f4ba03ed5c925 that were relying on the incorrect behavior. We can avoid the fix by changing to another database url such as `mysql` or `postgresql` In addition to fixing the failure, the assertions are changed so that the "expected" value comes before "actual" value.
* fixed rails dbconsole to support ENV['DATABASE_URL'].Huiming Teo2013-12-161-27/+67
|
* Make logging to stdout work again with implicit `development` envMarc Schütz2013-10-131-12/+48
|
* Only output Server logs in Developmentschneems2013-09-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now when you start a server via `rails s`, the logger gets extended so that it logs to the file system and also to stdout. This extension behavior is not "intelligent" and if the default logger is already set to output to stdout, then the contents will be received twice. To capture logs in accordance with http://www.12factor.net/logs some platforms require the logs to be sent to standard out. If a logger is set to stdout, and the server is started using `rails server` instead of another method (i.e. `thin start` etc.) then the app will produce double logs. This PR fixes the issue by only extending the logger to standard out in the development environment. So that in production you don't get double logs like this: ``` ActionView::Template::Error (wrong number of arguments (5 for 4)): 1: <% lang_index = 0 %> 2: <div class="row"> 3: <ul class="nav nav-tabs nav-stacked span2" data-tabs="tabs" id="repo-tabs"> 4: <% repos.group_by(&:language).each do |lang, repos| %> 5: <% unless lang == nil %> 6: <li><a href="#<%= "#{lang.parameterize}#{lang.hash}" %>" data-toggle="tab"><%= lang %></a></li> 7: <% end -%> app/views/shared/_repos.html.erb:4:in `_app_views_shared__repos_html_erb___1685450633638247395_70300668607000' app/views/pages/index.html.erb:13:in `_app_views_pages_index_html_erb__2084723628308867770_70300687584880' ActionView::Template::Error (wrong number of arguments (5 for 4)): 1: <% lang_index = 0 %> 2: <div class="row"> 3: <ul class="nav nav-tabs nav-stacked span2" data-tabs="tabs" id="repo-tabs"> 4: <% repos.group_by(&:language).each do |lang, repos| %> 5: <% unless lang == nil %> 6: <li><a href="#<%= "#{lang.parameterize}#{lang.hash}" %>" data-toggle="tab"><%= lang %></a></li> 7: <% end -%> app/views/shared/_repos.html.erb:4:in `_app_views_shared__repos_html_erb___1685450633638247395_70300668607000' app/views/pages/index.html.erb:13:in `_app_views_pages_index_html_erb__2084723628308867770_70300687584880' ``` ATP Railties. Opened against master in favor of #10999