aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Use exist? instead of deprecated exists?Kasper Timm Hansen2015-08-051-2/+2
|
* Add rake dev:cache task to enable dev mode caching.Chuck Callebs2015-08-041-0/+23
| | | | | | | | | | | | | | | | 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
* make test runner work correctly inside engineyuuji.yaginuma2015-07-121-1/+5
|
* remove Rack::Lock for webrickAaron Patterson2015-07-101-11/+1
| | | | constant loading should be thread safe now, so lets remove this
* Remove `config` options from `default_options` in `railties`Nuri Hodges2015-06-261-2/+1
| | | | Fixes #20345.
* Remove ContentLength middleware from the defaults.Aaron Patterson2015-06-171-1/+0
| | | | | ContentLength is not part of the rack SPEC since rack/rack@86ddc7a6ec68d7b6951c2dbd07947c4254e8bc0d If you want it, just add it as a middleware in your config.
* Improve test runner's Minitest integration.Kasper Timm Hansen2015-06-041-2/+2
| | | | | | | | | | | This also adds free mix and matching of directories, files and lines filters. Like so: bin/rails test models/post_test.rb test/integration models/person_test.rb:26 You can also mix in a traditional Minitest filter: bin/rails test test/integration -n /check_it_out/
* Refactor railties console and dbconsole commandsMehmet Emin İNAÇ2015-05-103-101/+99
| | | | fix minor convention problems
* Remove sqlite support from `rails dbconsole`Andrew White2015-04-221-3/+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.
* Don't ask something that we don't want toRafael Mendonça França2015-04-221-1/+1
| | | | | | We only want to support adapters that we officially support through the entire framework so it is better to not ask patches for adapters that we may not support
* [ci skip] Document running a rake command as a rails commandNick Cox2015-04-151-0/+11
|
* Revert "Merge pull request #19404 from dmathieu/remove_rack_env"Jeremy Kemper2015-03-204-4/+4
| | | | | | | Preserving RACK_ENV behavior. This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
* Merge pull request #19404 from dmathieu/remove_rack_envAaron Patterson2015-03-194-4/+4
|\ | | | | Don't fallback to RACK_ENV when RAILS_ENV is not present
| * don't fallback to RACK_ENV when RAILS_ENV is not presentDamien Mathieu2015-03-194-4/+4
| |
* | `-e` / `--environment` for the test runner.Yves Senn2015-03-181-1/+1
| |
* | move argument parsing into the `Runner`.Yves Senn2015-03-181-3/+1
| |
* | Move some logic to runnerArthur Neves2015-03-181-13/+1
| |
* | no need to escape the method in a regex wrap, minitest does that for usArthur Neves2015-03-181-1/+1
| |
* | Add test run by line, and report error by lineArthur Neves2015-03-181-3/+13
| |
* | spike of a `OptionParser` backed test runner.Yves Senn2015-03-182-1/+15
|/
* Remove unused Rails::Server#log_pathPhill Baker2015-02-161-4/+0
| | | | | | | With refactors to Rails::Sever from v3 to v4, this method is no longer used and is untested. Previous usage: https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/commands/server.rb#L79 Currently set from: https://github.com/rails/rails/blob/7b75551a1a4539876f878f37a2439cd02f89d961/railties/lib/rails/application/configuration.rb#L69
* Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-1/+1
| | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* Merge pull request #18380 from nobu/Use-EXEEXTSantiago Pastorino2015-01-191-1/+3
|\ | | | | Use EXEEXT
| * Use EXEEXTNobuyoshi Nakada2015-01-071-1/+3
| | | | | | | | | | | | | | | | Use the configured variable EXEEXT, instead of hardcoded suffix and platform names. And on such platforms, files which do not end with the suffix are not executable, so the original names are not necessary, in general.
* | No need of requiring `rbconfig`, it is by-default loadedKuldeep Aggarwal2015-01-102-2/+0
|/
* Remove debugger supportRafael Mendonça França2015-01-042-38/+0
| | | | | bebugger doesn't work with Ruby 2.2 so we don't need to support it anymore
* Remove the tmp/sessions folder and its clear taskRobin Dupret2015-01-031-1/+1
| | | | | | | | | | Commit 1aea470 introduced this directory but this was at a time when the default way to store sessions was on the file system under the tmp directory. Let's remove references to it from the documentation as well. [Robin Dupret & yui-knk]
* Add a code checking about file or not to the rails db commandyuki37382014-12-161-1/+1
|
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|