31
votes

Je ne sais pas comment construire des «routes» de tâche

Je ne peux pas exécuter rake routes même si le fichier routes.rb est vide. Ceci est la sortie:

rake about                              # List versions of all Rails frameworks and the environment
rake action_mailbox:ingress:exim        # Relay an inbound email from Exim to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:ingress:postfix     # Relay an inbound email from Postfix to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:ingress:qmail       # Relay an inbound email from Qmail to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:install             # Installs Action Mailbox and its dependencies
rake action_mailbox:install:migrations  # Copy migrations from action_mailbox to application
rake action_text:install                # Copy over the migration, stylesheet, and JavaScript files
rake action_text:install:migrations     # Copy migrations from action_text to application
rake active_storage:install             # Copy over the migration needed to the application
rake app:template                       # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake app:update                         # Update configs and some other initially generated files (or use just update:configs or update:bin)
rake assets:clean[keep]                 # Remove old compiled assets
rake assets:clobber                     # Remove compiled assets
rake assets:environment                 # Load asset compile environment
rake assets:precompile                  # Compile all the assets named in config.assets.precompile
rake cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases, except when DATABASE_URL is present
rake db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases, except when DATABASE_URL is present
rake db:environment:set                 # Set the environment value for the database
rake db:fixtures:load                   # Loads fixtures into the current environment's database
rake db:migrate                         # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:down                    # Runs the "down" for a given migration VERSION
rake db:migrate:redo                    # Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
rake db:migrate:status                  # Display status of migrations
rake db:migrate:up                      # Runs the "up" for a given migration VERSION
rake db:prepare                         # Runs setup if database does not exist, or runs migrations if it does
rake db:reset                           # Drops and recreates the database from db/schema.rb for the current environment and loads the seeds
rake db:rollback                        # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear              # Clears a db/schema_cache.yml file
rake db:schema:cache:dump               # Creates a db/schema_cache.yml file
rake db:schema:dump                     # Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)
rake db:schema:load                     # Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`) into the database
rake db:seed                            # Loads the seed data from db/seeds.rb
rake db:seed:replant                    # Truncates tables of each database for current environment and loads the seeds
rake db:setup                           # Creates the database, loads the schema, and initializes with the seed data (use db:reset to also drop the database first)
rake db:structure:dump                  # Dumps the database structure to db/structure.sql
rake db:structure:load                  # Recreates the databases from the structure.sql file
rake db:version                         # Retrieves the current schema version number
rake log:clear                          # Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rake middleware                         # Prints out your Rack middleware stack
rake restart                            # Restart app by touching tmp/restart.txt
rake secret                             # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)
rake stats                              # Report code statistics (KLOCs, etc) from the application or engine
rake test                               # Runs all tests in test folder except system ones
rake test:all                           # Runs all tests, including system tests
rake test:db                            # Run tests quickly, but also reset db
rake test:system                        # Run system tests only
rake time:zones[country_or_offset]      # List all time zones, list by two-letter country code (`bin/rails time:zones[US]`), or list by UTC offset (`bin/rails time:zones[-8]`)
rake tmp:clear                          # Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)
rake tmp:create                         # Creates tmp directories for cache, sockets, and pids
rake webpacker                          # Lists all available tasks in Webpacker
rake webpacker:binstubs                 # Installs Webpacker binstubs in this application
rake webpacker:check_binstubs           # Verifies that webpack & webpack-dev-server are present
rake webpacker:check_node               # Verifies if Node.js is installed
rake webpacker:check_yarn               # Verifies if Yarn is installed
rake webpacker:clean[keep,age]          # Remove old compiled webpacks
rake webpacker:clobber                  # Remove the webpack compiled output directory
rake webpacker:compile                  # Compile JavaScript packs using webpack for production with digests
rake webpacker:info                     # Provide information on Webpacker's environment
rake webpacker:install                  # Install Webpacker in this application
rake webpacker:install:angular          # Install everything needed for Angular
rake webpacker:install:coffee           # Install everything needed for Coffee
rake webpacker:install:elm              # Install everything needed for Elm
rake webpacker:install:erb              # Install everything needed for Erb
rake webpacker:install:react            # Install everything needed for React
rake webpacker:install:stimulus         # Install everything needed for Stimulus
rake webpacker:install:svelte           # Install everything needed for Svelte
rake webpacker:install:typescript       # Install everything needed for Typescript
rake webpacker:install:vue              # Install everything needed for Vue
rake webpacker:verify_install           # Verifies if Webpacker is installed
rake webpacker:yarn_install             # Support for older Rails versions
rake yarn:install                       # Install all JavaScript dependencies as specified via Yarn
rake zeitwerk:check                     # Checks project structure for Zeitwerk compatibility

sortie de rake sur :

➜ rake about
About your application's environment
Rails version             6.1.0
Ruby version              ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
RubyGems version          3.1.4
Rack version              2.2.3
Middleware                Webpacker::DevServerProxy, Rack::MiniProfiler, ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper, Warden::Manager
Application root          /Users/cobexa/app
Environment               development
Database adapter          postgresql
Database schema version   20201219225707

et sortie de rake - tasks :

➜ rake routes
rake aborted!
Don't know how to build task 'routes' (See the list of available tasks with `rake --tasks`)

(See full trace by running task with --trace)


4 commentaires

Quelle est la sortie de rake - tâches ? Quelle version de Rails / Ruby utilisez-vous?


J'ai oublié d'ajouter ça, désolé. Mise à jour de la description initiale.


Je viens de découvrir que Rake Routes était obsolète sur Rails 6.1 en faveur de Rails Routes : github.com/rails/rails/commit/…


@cobexa pouvez-vous ajouter cela comme réponse à votre question


4 Réponses :


84
votes

Je viens de découvrir que Rake Routes a été obsolète sur Rails 6.1 en faveur de Rails Routes : https://github.com/rails/rails/Commit/41ad613e4c5d6c05f20ac0437564ff0d31ab9f5a


4 commentaires

Ce sera une habitude incroyablement difficile à briser. J'écris Rake Routes depuis environ 2009.


"Dégédé" impliquerait que cela fonctionne toujours ... Bummer, ils l'ont cassé si rapidement.


Oui, et ils ont ajouté des routes par défaut qui sont si longues dans le terminal que la sortie entière de la commande est illisible sur mon écran de 15 "(> ლ)


@Mindtonic Vous pouvez utiliser l'option - étendue pour une sortie propre sur votre petit écran ;-)



4
votes

Vous pouvez essayer d'utiliser des routes Rails au lieu de routes de râteau.


0 commentaires

4
votes

Les routes bin / rake sont obsolètes. Vous pouvez utiliser bin / rails routes


0 commentaires

2
votes

Vous pouvez utiliser Rails Routes - Expanded pour une sortie très propre même sur les petits écrans.


0 commentaires