Welcome aboard
You’re riding Ruby on Rails with Maven!
Getting started
Here’s how to get rolling:
-
Use
mvn rails${railsVersion.substring(0,1)}:generateto create your models and controllersTo see all available options, run it without parameters.
example:
mvn rails${railsVersion.substring(0,1)}:generate -Dargs="scaffold user name:string" -
Set up a default route and remove or rename this file
Routes are set up in
config/routes.rb. -
Create your database
mvn rails${railsVersion.substring(0,1)}:rake -Dargs="db:create db:migrate"
will to create your database. If you're not using SQLite (the default), editconfig/database.ymlwith your username and password.For production use
mvn rails${railsVersion.substring(0,1)}:rake -Dargs="db:create db:migrate" -Drails.env=production -
Start embedded servlet-engine
Run
mvn jetty:runand find the generated users resource here - jetty runs on port 8080 !For production
mvn jetty:run -Drails.env=production -
Start default ruby server (webrick)
mvn rails${railsVersion.substring(0,1)}:serverFind the users resource here - webrick runs on port 3000 !
For production
mvn rails${railsVersion.substring(0,1)}:server -Drails.env=production -
Package your war file
mvn package -Drails.env=productionwill produce a war file for production in the directorytarget.run jetty with the production warfile
mvn jetty:run-war -Drails.env=production -
Running the tests or specs
mvn -Drails.env=testafter migrating the new tables with
mvn rails3:rake -Dargs=db:migrate -Drails.env=test -
More help for maven goals
mvn rails${railsVersion.substring(0,1)}:helpfor rails specific goals.mvn gem:helpfor rubygems specific goals.