aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
Commit message (Collapse)AuthorAgeFilesLines
* Ensure Active Record connection consistencyschneems2014-01-091-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Only build a ConnectionSpecification if requiredJosé Valim2013-12-241-1/+1
|
* Use the new Resolver API in dbconsoleJosé Valim2013-12-231-3/+2
|
* Make `rails runner` command options more obviousschneems2013-12-191-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're surrounding the options in angle brackets `<>` as is convention in `curl`: ``` $ curl --help Usage: curl [options...] <url> ``` And then in square brackets `[]` with bars `|` as in `tar`: ``` $ tar --help ... Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ] ``` To further clarify that the command can be used with both, we now show examples: ``` Examples: rails runner 'puts Rails.env' This runs the code `puts Rails.env` after loading the app rails runner path/to/filename.rb This runs the Ruby file located at `path/to/filename.rb` after loading the app ``` This format was taken from the `find` man pages: ``` EXAMPLES The following examples are shown as given to the shell: find / \! -name "*.c" -print Print out a list of all the files whose names do not end in .c. find / -newer ttt -user wnj -print Print out a list of all the files owned by user ``wnj'' that are newer than the file ttt. ``` The the text at the bottom is also shifted to improve readability.
* fixed rails dbconsole to support ENV['DATABASE_URL'].Huiming Teo2013-12-161-8/+5
|
* Use .railsrc while creating new plugin if availablePrathamesh Sonpatki2013-12-011-0/+14
| | | | - Fixes #10700
* Add positional information to eval call so that this information willPrathamesh Sonpatki2013-11-201-1/+1
| | | | | | | | | | be used in printing correct location where the exception occurred. Closes #12885 - Without this the location of exception is always the line on which 'eval' is called - But if the exception occurs in a gem outside of Rails, then that location is not printed in stacktrace
* AestheticsRafael Mendonça França2013-11-071-13/+13
|
* Move interrupt information to print_boot_information methodAlex Johnson2013-11-071-4/+1
|
* Extract method refactoring for Rails::Server#startAlex Johnson2013-11-071-24/+38
|
* More Warnings removed for ruby trunkArun Agrawal2013-11-011-1/+1
| | | | Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
* stop mutating ARGVAaron Patterson2013-10-301-2/+2
|
* rename AppPreparerAaron Patterson2013-10-301-1/+1
| | | | | AppPreparer doesn't actually prepare applications, it scrubs ARGV. Let's also get the class under test while we're at it
* Make logging to stdout work again with implicit `development` envMarc Schütz2013-10-131-1/+2
|
* Only output Server logs in Developmentschneems2013-09-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Missing destroy commandAkira Matsuda & Yukiko Kawamoto2013-09-131-0/+4
|
* Merge pull request #11378 from wangjohn/class_for_application_generatorRafael Mendonça França2013-07-091-27/+1
|\ | | | | Creating a class to handle preparing ARGV.
| * Creating a class to handle preparing ARGV.wangjohn2013-07-091-27/+1
| | | | | | | | | | | | Before the AppGenerator is started, ARGV needs to be modified to correctly account for some things. I'm extracting these out into their own class.
* | Using the instance variable for argv.wangjohn2013-07-091-2/+2
|/ | | | | Instead of using the global constant ARGV, we're changing to using the instance variable because it is more testable.
* Creating a class for carrying out rails commands.wangjohn2013-07-071-0/+170
| | | | | | This class encapsulates a lot of logic that wasn't very object oriented. Helper methods have been created to try to make things more logical and easy to read.
* s/plugin_new/pluginschneems2013-06-302-9/+9
| | | | | There are historical reasons that the `plugin` command was `plugin_new`, now those are no longer applicable, we should remove the naming edge case from the project. This PR is based off of comments from #11176 ATP Railties
* Merge pull request #10666 from YanhaoYang/masterCarlos Antonio da Silva2013-06-251-1/+1
|\ | | | | Make "rails dbconsole" work with activerecord-postgis-adapter
| * make "rails dbconsole" work with activerecord-postgis-adapterYanhaoYang2013-05-171-1/+1
| |
* | load the file rather than evalingAaron Patterson2013-06-171-1/+1
| |
* | add notice to server boot messages if using default 0.0.0.0 bindingLuke Wendling2013-05-251-0/+3
|/
* exit with non-zero to signal failureHrvoje Šimić2013-05-131-2/+2
|
* removing `rails test`, updating docs to show how to use `rake test`Aaron Patterson2013-04-051-146/+0
|
* Revert more Rails.version changesRafael Mendonça França2013-04-011-1/+1
| | | | Related with ed8df3ff018d17fad123e48c7cb907332e72e7dc
* remove references to *::VERSION, replace with *.versionCharlie Somerville2013-03-211-1/+1
|
* More helpful message when starting serverGabe Kopley2013-03-181-1/+1
| | | | v2 of pull request based on feedback from @rafaelfranca, @schneems, and @carlosantoniodasilva
* config.ru uses the effective Rack appYves Senn2013-03-151-0/+1
| | | | | | | | | | We used to pass the Rails::Application subclass to #run. The Rails server then called #to_app to convert that class to the actual Rack application. if you surround `#run` with a call to `#map` the server no longer convertes the class to the instance and we end up with unnecessary delegation calls on every request.
* Stop calling "super" twice in Rails::Server#appCarlos Antonio da Silva2013-03-121-1/+4
| | | | Cache the value of "super" in a variable and use it instead.
* Make sure that `rails test` load test in test envPrem Sichanugrist2013-03-091-3/+9
|
* Improve wording for rails test commandDalibor Nasevic2013-03-091-17/+17
|
* Load fixtures only when running suites, or `-f`Prem Sichanugrist2013-03-091-1/+18
| | | | | | * `rails test -f` will run the test suites with all fixtures loaded * New application will now generated without `fixtures :all` line enabled by default.
* Add support for MiniTest flags in TestRunnerPrem Sichanugrist2013-03-091-30/+61
| | | | | Any flags that got set will be passed through to MiniTest::Unit.runner, such as `-n`, `-s-, and `-v`.
* Add `rails test` command to run the test suitePrem Sichanugrist and Chris Toomey2013-03-091-0/+92
| | | | | | | | | | | | | | | | | | | To run the whole test suite: $ rails test To run the test file(s): $ rails test test/unit/foo_test.rb [test/unit/bar_test.rb ...] To run the test suite $ rails test [models,helpers,units,controllers,mailers,...] For more information, see `rails test --help`. This command will eventually replacing `rake test:*`, and `rake test` command will actually invoking `rails test` instead.
* Fix rails console --sandboxJon Leighton2013-03-081-1/+3
| | | | | | I've also added a proper acceptance test which reproduced the issue. Closes #9513, #9515.
* Use --rc= instead of --rcrobertomiranda2013-02-041-2/+6
|
* Refactor --rc optionGuillermo Iguaran2013-02-021-6/+1
|
* Add --rc option to support the load of a custom rc fileAmparo Luna2013-02-011-1/+7
|
* Prefer File.read over File.open.readAkira Matsuda2013-02-011-1/+1
|
* Add --no-rc option to skip the loading of railsrc fileAmparo Luna2013-01-311-6/+8
|
* extract PerformanceTest into rails-performance_tests gemYves Senn2013-01-102-66/+0
|
* Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake. ↵Jeremy Kemper2013-01-061-1/+1
| | | | Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn'
* Rescue from LoadError when trying to load the debugger gem for consoleCarlos Antonio da Silva2013-01-061-1/+1
| | | | | | | | Avoid swallowing all exceptions that might happen when requiring debugger, just catch a LoadError if it cannot be loaded. Check for more background: https://github.com/rails/rails/commit/28fd867c9bc790636d37a28f288791cd0089a6fd#commitcomment-2386952
* Don't use Rails.root since it is not available at this pointRafael Mendonça França2013-01-052-2/+2
|
* Remove unnecessary begin..rescue..end, use only rescueCarlos Antonio da Silva2013-01-041-7/+5
|
* Move class method to instance in dbconsoleCarlos Antonio da Silva2013-01-042-2/+3
| | | | | This method doesn't need to be in the class, since it's only used only from the instance.
* This commit fixes issue #8628Mykola Kyryk2013-01-042-2/+19
| | | | | | | | | | | | Allow environment name to start with a substring of the default environment names. For example: tes, pro, prod, dev, devel, etc. Fixing identation. Adding test for Rails::Console.parse_arguments method. Fix issue 8628 for Rails::DBConsole.