Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Adds support for generating pages #674

Merged

Conversation

davidpatters0n
Copy link
Contributor

@davidpatters0n davidpatters0n commented Mar 7, 2018

Description of the Change

Address: #671

Alternate Designs

None

Benefits

Allows developers to run amber g page About

Possible Drawbacks

None

@faustinoaq
Copy link
Contributor

@davidpatters0n Thank you for this nice contribution!

Can we add a page generator as well 😅

Right now is just amber g view About, but is just the view, so I can't add quickly a new page without touching the code

Currently with this PR:

# 1. Generate src/views/about_view.slang
amber g view About

# 2. Create src/controllers/about_controllers.slang
amber g controller About

# 3. Edit controller to render about view
nano src/controllers/about_controllers.slang

# 4. Edit config/router.cr to point /about path to AboutController :index
nano config/router.cr

With proposed amber g page About

# Generate new view, controller and update the new path to router file
amber g page About

Lucky framework can do something similar using lucky gen.page About

@amberframework/contributors WDYT?

@faustinoaq
Copy link
Contributor

BTW, I think we can change raise "Template not found" by:

CLI.logger.error "Template not found", "Generate", :light_red

less verbose, more clean

@davidpatters0n
Copy link
Contributor Author

@faustinoaq - Sure I'll make this amendment later on today. 👍 thanks for the feedback

@eliasjpr
Copy link
Contributor

eliasjpr commented Mar 8, 2018

@faustinoaq Lucky follows a different naming conventions. I am fine not adding a Page generator also that seems that can be addressed in a separate PR.

@eliasjpr eliasjpr merged commit a9449de into amberframework:master Mar 8, 2018
@elorest
Copy link
Member

elorest commented Mar 8, 2018

@faustinoaq A new page should be added with

amber g controller About about:get with existing generators.

eliasjpr added a commit that referenced this pull request Mar 8, 2018
eliasjpr added a commit that referenced this pull request Mar 8, 2018
* Revert "[Generator] Remove raise from Template (#686)"

This reverts commit a87e585.

* Revert "Use Inflector to pluralize model names (#673)"

This reverts commit 10aa165.

* Revert "[Settings] Logger Builder (#684)"

This reverts commit e216eb8.

* Revert "[CLI] Adds support for generating pages (#674)"

This reverts commit a9449de.
@faustinoaq
Copy link
Contributor

@eliasjpr @elorest Yeah, I wanted to review this a bit more but I see it just got merged (and reverted) 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants