aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
Commit message (Collapse)AuthorAgeFilesLines
...
* Apply Rafaels review fixes.Kasper Timm Hansen2016-09-251-1/+3
|
* Fix console tests.Kasper Timm Hansen2016-09-251-1/+1
|
* Remove the old command files.Kasper Timm Hansen2016-09-2513-818/+0
| | | | | Wash out your old! These adhoc scripts are replaced by the new commands.
* Per Dr. Eileen's orders :)Kasper Timm Hansen2016-09-251-1/+0
| | | | Prescribed some review fixes for myself!
* Run engine commands through command infrastructure.Kasper Timm Hansen2016-09-252-3/+16
|
* Initial command structure.Kasper Timm Hansen2016-09-2515-0/+704
|
* Revise setting of run_with_rails_extension.Kasper Timm Hansen2016-09-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | The Rails test runner supports three ways to run tests: directly, via rake, or ruby. When Running with Ruby ala `ruby -Itest test/models/post_test.rb` our test file would be evaluated first, requiring `test_helper` and then `active_support/testing/autorun` that would then require the test file (which it hadn't been before) thus reevaluating it. This caused exceptions if using Active Support's declarative syntax. Fix this by shifting around when we set the how we're run to closer mimick the require order. If we're running with `bin/rails test` the test command file is run first and we then set `run_with_rails_extension`, later we hit `active_support/testing/autorun` and do nothing — because we've been run elsewhere. If we at this point haven't set `run_with_rails_extension` we've been running with `ruby` this whole time and thus we set that. We should always trigger `Minitest.autorun` as it doesn't hurt to call it twice. Consolidate the two methods into a single one that better brings out the intent of why they're there.
* Require `active_support/testing/autorun`.Kasper Timm Hansen2016-09-251-2/+1
| | | | | | | | Revise the require in the test command to use `active_support/testing/autorun` and spare us the minitest spec syntax as detailed in 5da4d51. Also move the require to the top of the file for consistency with the rest of Rails' requires across the project.
* switch to autorun to support after_run and patch lessMichael Grosser2016-09-231-3/+1
|
* support minitest after_run for parity to regular minitestMichael Grosser2016-09-161-1/+3
| | | | see https://github.com/seattlerb/minitest/blob/f9605387e4af7d657921a83aaf0ae364f6d26a57/lib/minitest.rb#L51-L65
* improve test coverageMichael Grosser2016-09-161-2/+2
|
* Remove the word "mongrel" from documentsRyunosuke Sato2016-09-071-1/+1
| | | | | | | | | Currently mongrel is not maintained. And it couldn't be built with any Ruby versions that supported by Rails. It is reasonable to remove the word "mongrel" in order to avoid confusion from newcomer.
* refactor `CommandsTasks`yuuji.yaginuma2016-08-173-80/+104
| | | | | Extract a common method of `Rails::CommandsTasks` and `Rails::Engine::CommandsTasks` to the module.
* Add three new rubocop rulesRafael Mendonça França2016-08-162-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-101-1/+2
| | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* revises most Lint/EndAlignment offensesXavier Noria2016-08-071-3/+4
| | | | Some case expressions remain, need to think about those ones.
* Merge pull request #24260 from ↵Kasper Timm Hansen2016-08-071-1/+3
|\ | | | | | | | | y-yagi/show_error_message_when_error_raised_in_rails_runner show error message when error raised in rails runner
| * show error message when error raised in rails runneryuuji.yaginuma2016-08-031-1/+3
| |
* | Defer requiring Rake until it's needed.Kasper Timm Hansen2016-08-071-1/+8
| | | | | | | | | | | | | | | | Eagerly requiring Rake could put 100ms on to the Rails boot time. Shimmy that down to 0 by requiring Rake when no native Rails command exists and we try to run a Rake task. Or when printing all the Rake commands through `rails help`. Fixes #25029
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-065-36/+36
| |
* | remove redundant curlies from hash argumentsXavier Noria2016-08-061-4/+2
| |
* | applies new string literal convention in railties/libXavier Noria2016-08-0612-94/+94
|/ | | | | 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/+1
|
* Fixes #25219Vipul A M2016-07-011-0/+12
| | | | Add handling of cleaning up backtrace from IRB console in case of errors
* Fix rails restart issue with PumaPrathamesh Sonpatki2016-03-301-1/+6
| | | | | | | | | | | | | | | - 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.
* show correct command name in help of rails runneryuuji.yaginuma2016-03-261-3/+4
| | | | | | If use rails together with `spring`, `spring` is rewrite `$0` in the interior command name. Therefore, for `$0` correct command name does not appear, `$0` has been modified so that it does not use.
* changed default value of `caching` option to `nil`yuuji.yaginuma2016-03-211-1/+1
| | | | | | | 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.
* Share dev caching implementation between task and server.Kasper Timm Hansen2016-03-151-14/+3
| | | | | Lets have the server and the Rake task go through the same ropes, so we can share all the file lookup, adding, and deleting code.
* Delete CTRL-C message as is duplicates PumaSam Ruby2016-03-011-2/+0
|
* revert dev:cache to rake task, fixes #23410Scott Bronson2016-02-071-21/+0
|
* :warning: assigned but unused variable - errAkira Matsuda2016-02-021-2/+2
|
* Avoid multiple default paths to server.pid fileTawan Sierek2016-01-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge pull request #22933 from schneems/schneems/fix-broadcastRichard Schneeman2016-01-061-2/+4
|\ | | | | [close #22917] Don't output to `STDOUT` twice
| * [close #22917] Don't output to `STDOUT` twiceschneems2016-01-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When `rails console` or `rails server` are used along with a logger set to output to `STDOUT` then the contents will show up twice. This happens because the logger is extended with `ActiveSupportLogger.broadcast` with a destination of STDOUT even if it is already outputting to `STDOUT`. Previously PR #22592 attempted to fix this issue, but it ended up causing NoMethodErrors. A better approach than relying on adding a method and flow control is to inspect the log destination directly. For this `ActiveSupport::Logger.logger_outputs_to?` was introduced ```ruby logger = Logger.new(STDOUT) ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) # => true ``` To accomplish this we must look inside of an instance variable of standard lib's Logger `@logdev`. There is a related Ruby proposal to expose this method in a standard way: https://bugs.ruby-lang.org/issues/11955
* | Provide a better error message if a user mistypes the name of script with runnerStephen Blackstone2016-01-051-1/+7
|/ | | | Add tests for detecting bad options for runner
* Merge branch 'rails-rake-proxy'Kasper Timm Hansen2015-12-132-5/+55
|\
| * Implement Rake proxy for Rails' command line interface.Dharam Gollapudi2015-12-132-0/+56
|/ | | | | | | Allows any Rake task to be run through `bin/rails` such as `bin/rails db:migrate`, `bin/rails notes` etc. The Rake tasks are appended to Rails' help output, and blend in as standard commands.
* Fixed typo in mysql client parameterKent Sibilev2015-12-091-1/+1
|
* Ditch `Commands` namespace for base command.Kasper Timm Hansen2015-12-062-74/+2
| | | | | | | Reading `Rails::Commands::Command` feels excessive. Especially if users can subclass command to write their own commands — which I'd like to aim for. Switch to `Rails::Command` before we get too far into things.
* Invert command and commands tasks reference.Kasper Timm Hansen2015-12-062-4/+5
| | | | | | | We should first attempt to run commands through Rails command, and then fall back to trying the commands tasks. Because eventually the commands tasks should be their own commands.
* Remove "run with rake" suggestion.Kasper Timm Hansen2015-12-061-22/+0
| | | | | | | | | When attempting to run a `rake` task with `bin/rails`, Rails would see check that a Rake task existed and ask users if they meant to run it with rake. We don't need that anymore, as the goal is to have `rails` be a valid way to run rake tasks.
* Add class level `run` to Rails command.Kasper Timm Hansen2015-12-062-22/+15
| | | | | | | | | | | | The class level version is responsible for changing a task name to command name, then finding a command and run it if there is one. The instance level `run` then makes sure arguments have been parsed into `@options` and runs the command by sending it. `Rails::Commands::Command.run` returns true to make it work within `Rails::CommandsTask`, but won't in the future when it handles all option parsing.
* Replace `-> {}` with a proc.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | When `parse_options_for` was called for a command that hadn't set up any option parsing with `options_for`, the `call` method would be sent to `-> {}`, which didn't like to be passed two arguments. Switch to `proc {}` which can accept several arguments.
* Remove `_instance` suffix from command.Kasper Timm Hansen2015-12-051-2/+2
| | | | | I want to streamline the wording around `command`, and not start pondering about instances.
* Default `argv` to an empty array.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | | | | | | The `ARGV` constant in Ruby is not a string, it's an array as demonstrated by running: ``` $ ruby -e "p ARGV" => [] $ $ ruby -e "p ARGV" test/file.rb --version=2 => ["test/file.rb", "--version=2"] ```
* Spruce up `command_for`.Kasper Timm Hansen2015-12-051-4/+1
| | | | | | * Ditch the instance methods local variable. * Prefer Ruby's default nil return, and remove else branch.
* `exists?` isn't for users.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | Checking that a command exists before running it is an implementation detail of the Rails command and Rake task world right now. Eventually I'd like to get rid of `exists?`, when I've worked out another way to fall back to run the old tasks.
* Move `command_name_for` to private section.Kasper Timm Hansen2015-12-051-4/+4
| | | | | Users shouldn't have to lookup the command name for a task. Put it in the private section, so it doesn't show up in any generated documentation.
* Add Rails command infrastructure and encapsulate development cachingChuck Callebs2015-12-043-1/+104
|
* Use the PORT environment variable for rails serverDavid Cornu2015-08-181-1/+1
|