Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Command line assistant to create fast and easy applications with Nancy web Framework similar as how rails works.
JavaScript C#
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Libs
NancyAppGenerator
NancyAppGenerator.sln
NancyAppGenerator.sln.docstates.suo
NancyAppGenerator.suo
README

README

The main idea it's create a command line application that generate code and html files similar as how ruby on rails works.
Now only support the razor view engine in Nancy
This is a work in progress you can try with this commands:

*In the command line, located in the project folder*

appgen struct 
Generate all the folder structure for a Nancy web application (Views,Controllers, shared folders), now the assets with js,img and css are missing,need to add.
appgen generate controller {controllerName} {action1} {action2} {action3}

Generate a controller with the name {controllerName} and with the actions named {action1},{action2},{action3}, also generate the cshtml views.
Example:
appgen generate Greetings hello bye

appgen generate model {ModelName} {fieldName:type} {fieldName:type} {fieldName:type}
Generate a model class with the name {ModelName} and the field defined with {fieldName:type}, this will also generate a migration file(in migrations folders) to execute with fluent migrator.
Example:
appgen generate model Person Id:integer Name:string BirthDate:datetime status:bool

appgen generate scaffold {ModelName} {fieldName:type} {fieldName:type}
Generate a model class with the name {ModelName} and the field defined with {fieldName:type} and generate a controller with the actions and view to do all the CRUD for the model (Index,New,Edit,Delete)
Example:
appgen generate scaffold Person Id:integer Name:string BirthDate:datetime status:bool

appgen migrate db:dbtype conn:"connection string"
Migrate the migrations classes generated or implemented in the migrations folder using FluentMigrator, the parameter db: expect one of the next database types and it's required:
jet
mysql
oracle
postgres
sqlite
sqlserver2000
sqlserver2005
sqlserver2008
sqlserverce
sqlserver

And the conn: parameter, expect the connection string to connect to the database, inside quotations marks.
Example:
appgen migrate db:sqlite conn:"data source=localdb.sqlite"
Will execute the migrations for the project and create a localdb.sqlite database file.


Note:
when you executed a command, the csproj file of the project will be modified to add the new created files, visual studio maybe will show a message that need to reload the project, after the project reload, you will see the new generated files.

Dependencies:
*Mono.TextTemplating for execute the t4 templates (the views,controllers and models are generated by t4 templates), with this the app also will work with mono in linux
*Fluent migrator (https://github.com/schambers/fluentmigrator) for create the migration classes and to execute the classes to create the database.

TODO:
*Read a connectionstring from app.config/web.config file for made the migrations
*Improve the scaffold and check how to detect changes or fields add on the model
*Improve the scaffold to add validations and the Simple.Data code to save,update and delete
*The model and the database entities must be in separated class, and the model must inherit from the database entity, in order to apply the migration and modify the entity without affect the model
*I need to add jquery, css and all additional assets to make a complete web app
*Create the database bindings using Simple.Data to complain with de Super Duper Happy Path

Something went wrong with that request. Please try again.