The source of English version: Http://www.padrinorb.com/guides/generators
Padrino provides a builder for quickly creating applications, with the advantage of building the recommended Padrino application structure, automatically generating gemfile that lists all the startup dependencies, and providing guidelines to help novices get started as soon as possible.
An important feature of the builder is that they are built from scratch to support a large number of tools, class libraries, and gems that are involved in your Padrino application.
That is, the Padrino builder does not limit your use of any database, object-relational mapping, test framework, template engine, or JavaScript library. In fact, you can tell Padrino what components you want to use when generating an application.
Project Builder
The way the project Builder is used is fairly straightforward:
$ Padrino G Project <the_app_name> </path/to/create/app>--<component-name> <value>
The simplest commands for generating basic applications are:
$ Padrino G Project Demo_project
This command creates a Padrino application that inherits from Padrino::application under the Demo_project folder in the current directory, and the application has configured the default component for you.
If you have special needs, you can set the following:
$ Padrino G Project Demo_project-t rspec-e haml-m rr-s jquery-d datamapper-c Sass
You can also specify that the generator skips a particular component (or uses your own):
$ Padrino G Project Demo_project--test None--renderer None
You can also use the--app parameter to set an alias for your core application:
$ Padrino G Project Demo_project--app Alternate_app_name # alias-n
When you create a new application, the generator uses the Bundler Package Manager to handle the dependencies, and when you add the--run_bundler parameter, the generator automatically executes the necessary bundler commands:
$ Padrino G Project Demo_project--run_bundler # Alias-b
If you want to fix it manually, open the terminal in the generated application root and execute the bundle install command.
The basic project contains a lot of chestnuts about how to use the Project Builder, welcome to pick!
The builder framework is extensible, and users can easily add components and tools to it.
If you are interested in this, you can set up a branch on our project, read the code in LIN/GENERATORS/PROJECT.RB, and create instructions in the relevant files in lib/generators/components. We are very happy to accept a push request from a third party component type (Help maintenance is also welcome).
Some valid configuration options for the Project Builder:
Note: When using the builder, the project name, module name, and controller name do not duplicate. For example, do not name your application posts, but also name your controller or child application as posts.