aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/inspector.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use match? where we don't need MatchDataAkira Matsuda2019-07-291-1/+1
|
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-2/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Fix `rails routes -c` for controller name consists of multiple word.Yoshiyuki Kinjo2018-08-201-1/+1
|
* Rails guides are now served over httpsPaul McMahon2018-07-241-2/+2
| | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* Rely on Rails::Command's help output.Kasper Timm Hansen2018-03-131-26/+21
| | | | | | | | | | | | | | | | | | | | | We end up with: ``` Usage: bin/rails routes [options] Options: -c, [--controller=CONTROLLER] # Filter by a specific controller, e.g. PostsController or Admin::PostsController. -g, [--grep=GREP] # Grep routes by a specific pattern. -E, [--expanded], [--no-expanded] # Print routes expanded vertically with parts explained. ``` which does miss the bit about routes being printed in order. Also: * Renames options to ease help output readability, then clarifies each option. * Fixes a bunch of indentation.
* Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-131-41/+34
| | | | | | | | | | | | | | - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130
* Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-051-1/+10
| | | | | | | In order to get width of console use `IO::console_size`, See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size Related to #32130
* `ConsoleFormatter` is no longer used as a classRyuta Kamizono2018-03-021-2/+2
| | | | It is used as a namespace for `Sheet` and `Expanded`.
* Add --expanded option to "rails routes"Benoit Tigeot2018-02-281-37/+90
| | | | | | | | | | | | | | | | | | | | | | | | | When using rails routes with small terminal or complicated routes it can be very difficult to understand where is the element listed in header. psql had the same issue, that's why they created "expanded mode" you can switch using `\x` or by starting psql with ``` -x --expanded Turn on the expanded table formatting mode. This is equivalent to the \x command. ``` The output is similar to one implemented here for rails routes: db_user-# \du List of roles -[ RECORD 1 ]---------------------------------------------- Role name | super Attributes | Superuser, Create role, Create DB Member of | {} -[ RECORD 2 ]---------------------------------------------- Role name | role Attributes | Superuser, Create role, Create DB, Replication Member of | {}
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-5/+4
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Merge pull request #22435 from yui-knk/fix_engine_route_testRafael Mendonça França2017-11-061-2/+2
|\ | | | | | | Make `assert_recognizes` to traverse mounted engines
| * Make `assert_recognizes` to traverse mounted enginesyui-knk2016-04-231-2/+2
| | | | | | | | | | | | Before this commit paths of mounted engines are not traversed when `assert_recognizes` is called, causing strange test results. This commit enable to traverse mounted paths.
* | Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
| |
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* | Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-131-1/+1
| |
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-061-32/+32
| |
* | applies new string literal convention in actionpack/libXavier Noria2016-08-061-5/+5
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | Merge pull request #23103 from rails/refactor-handling-of-action-defaultJeremy Daer2016-04-241-2/+2
|\ \ | |/ |/| | | Refactor handling of :action default in routing
| * Refactor handling of :action default in routingAndrew White2016-02-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The longstanding convention in Rails is that if the :action parameter is missing or nil then it defaults to 'index'. Up until Rails 5.0.0.beta1 this was handled slightly differently than other routing defaults by deleting it from the route options and adding it to the recall parameters. With the recent focus of removing unnecessary duplications this has exposed a problem in this strategy - we are now mutating the request's path parameters and causing problems for later url generation. This will typically affect url_for rather a named url helper since the latter explicitly pass :controller, :action, etc. The fix is to add a default for :action in the route class if the path contains an :action segment and no default is passed. This change also revealed an issue with the parameterized part expiry in that it doesn't follow a right to left order - as soon as a dynamic segment is required then all other segments become required. Fixes #23019.
* | [ci skip] Replace usage of rake routes with rails routesAbhishek Jain2016-02-251-1/+1
| |
* | Add `internal` attribute to routesJon Moss2016-02-221-1/+1
|/ | | | | | | | | | | | | | This is meant to provide a way for Action Cable, Sprockets, and possibly other Rack applications to mark themselves as internal, and to exclude themselves from the routing inspector, and thus `rails routes` / `rake routes`. I think this is the only way to have mounted Rack apps be marked as internal, within AD/Journey. Another option would be to create an array of regexes for internal apps, and then to iterate over that everytime a request comes through. Also, I only had the first `add_route` method set `internal`'s default to false, to avoid littering it all over the codebase.
* Fixes routes to match verbs and path with -g optionAbhishek Jain2016-02-111-2/+3
|
* Converge on filter.Kasper Timm Hansen2016-02-011-5/+4
| | | | | | | | Some places were saying filter, while others said filter_options, spare the ambiguity and use filter throughout. This inlines a needless local variable and clarifies a route filter consists of defaults and values to match against.
* Simplify filter normalization.Kasper Timm Hansen2016-02-011-5/+3
| | | | | | | Assume the filter is a string, if it wasn't a hash and isn't nil. Remove needless else and rely on Ruby's default nil return. Add spaces within hash braces.
* Add options for rake routes taskVipul A M2016-02-021-15/+19
| | | | | | | | | | Add two options: `-c` and `-g`. `-g` option returns the urls name, verb and path fields that match the pattern. `-c` option returns the urls for specific controller. Fixes #18902, and Fixes #20420 [Anton Davydov & Vipul A M]
* Better error message when running `rake routes` with CONTROLLER arg:Edouard CHIN2016-01-071-7/+18
| | | | | | | - `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome) - If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist - If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter - If no routes were defined in the config/routes.rb file, will warn the user with the original message
* Change `Journey::Route#verb` to return string instead of regexp.yui-knk2015-10-031-4/+0
| | | | | | | | | By [this commit](https://github.com/rails/rails/commit/0b476de445faf330c58255e2ec3eea0f3a7c1bfc) `Journey::Route#verb` need not to return verb as regexp. The returned value is used by inspector, so change it to be a string. Add inspect_with_multiple_verbs test case to keep the behavior of inspector correctly.
* Don't reference sprockets assets on action packArthur Neves2015-04-261-1/+1
| | | | | | | | We need to ignore the `assets_prefix` when running a command like `rake routes`. However we cannot reference asserts_prefix from action_pack as that is a sprockets-rails concern. See this is now implemented on sprockets-rails https://github.com/rails/sprockets-rails/commit/85b89c44ad40af3056899808475e6e4bf65c1f5a
* Change filter on /rails/info/routes to use an actual path regexp from railsbrainopia2015-02-231-22/+4
| | | | | | | | Change filter on /rails/info/routes to use an actual path regexp from rails and not approximate javascript version. Oniguruma supports much more extensive list of features than javascript regexp engine. Fixes #18402.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-3/+1
|
* Remove redundant `to_s` in interpolationclaudiob2014-10-301-1/+1
|
* we do not need to cache rack_appAaron Patterson2014-05-261-9/+3
|
* a redirect is not a dispatcher by definition, so eliminate testAaron Patterson2014-05-261-1/+1
|
* push is_a check up to where the Constraints object is allocatedAaron Patterson2014-05-261-1/+1
|
* nothing is passed to `rack_app` anymore, so rm the paramsAaron Patterson2014-05-251-1/+1
|
* one fewer is_a checkAaron Patterson2014-05-251-4/+3
|
* Always construct route objects with Constraint objectsAaron Patterson2014-05-241-3/+3
|
* unwrap the constraints object on initialization, eliminate loopsAaron Patterson2014-05-241-1/+1
| | | | | | | Unwrap Constraints objects. I don't actually think it's possible to pass a Constraints object to this constructor, but there were multiple places that kept testing children of this object. I *think* they were just being defensive, but I have no idea.
* Fix `rake routes` error when `Rails::Engine` with empty routes is mounted; ↵Maurizio De Santis2014-01-241-3/+3
| | | | | | fixes rails/rails#13810 Squash
* Show routes defined under assets prefixRyunosuke SATO2013-12-191-1/+1
| | | | Closes #9625
* Add mailer previews feature based on mail_view gemAndrew White2013-12-171-1/+1
|
* Fix for routes taskSıtkı Bağdat2013-11-211-1/+2
| | | | This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
* `RoutesInspector` deals with routes using regexp as `:controller` optionYves Senn2013-05-301-1/+1
|
* Add missing require to routes inspectorCarlos Antonio da Silva2013-02-191-0/+1
|
* Duck typing is hard. Add header to HtmlTableFormatter.Steve Klabnik2013-02-181-0/+4
| | | | | | | Somehow I missed this method, which was then throwing an error when viewing routes as HTML. Make @rubys happy: ✔
* editorial tweaksXavier Noria2013-02-191-3/+6
|
* use strip_heredoc to keep indentation consistent.Steve Klabnik2013-02-181-12/+12
| | | | Thanks @sikachu. :heart:
* Add message when you have no routes defined.Steve Klabnik2013-02-181-0/+25
| | | | | | Print a message in both `rake routes` and at GET "/rails/info/routes" that lets you know you have no routes defined, as well as linking to the Rails Guide on the topic.
* Add headings to rake routes tableSteve Klabnik2013-02-181-3/+19
|