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

support template option on new application generation #379

Closed
wants to merge 1 commit into from
Closed

support template option on new application generation #379

wants to merge 1 commit into from

Conversation

aderyabin
Copy link
Contributor

I've added support --template=slim option on new app generation, erb value by default

  lotus new bookshelf --template=slim

@runlevel5
Copy link
Member

looks good, I like it, though I think template is a bit confusing, I would take it as the generator skeleton templates, what do you think about renaming it template_engine instead? I know it is longer but it does express its intent clearly

@@ -75,6 +75,7 @@ def console
method_option :database, aliases: ['-d', '--db'], desc: "application database (#{Lotus::Generators::DatabaseConfig::SUPPORTED_ENGINES.keys.join('/')})", default: Lotus::Generators::DatabaseConfig::DEFAULT_ENGINE
method_option :architecture, aliases: ['-a', '--arch'], desc: 'application architecture (container/app)', default: Lotus::Commands::New::Abstract::DEFAULT_ARCHITECTURE
method_option :application_name, desc: 'application name, only for container', default: Lotus::Commands::New::Container::DEFAULT_APPLICATION_NAME
method_option :template, desc: 'template engine', default: 'erb'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update the description with the list of available option? I really want to make it easy for users, please see line 75 for inspiration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, let's be consistent and replace template to template_engine in .lotusrc too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, that one might break the compatibility, I'd vote for replacing it, if we agree to do so, it's worth to mention it in the next release notes

cc @jodosha

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joneslee85 If we decide to proceed with this feature, we must handle .lotusrc as well.

@runlevel5 runlevel5 added this to the v0.6.0 milestone Oct 22, 2015
@jodosha
Copy link
Member

jodosha commented Oct 22, 2015

@joneslee85 @aderyabin please have a look at #155

@aderyabin
Copy link
Contributor Author

Thanks for reference.

On Thu, Oct 22, 2015 at 4:26 PM, Luca Guidi notifications@github.com
wrote:

@joneslee85 https://github.com/joneslee85 @aderyabin
https://github.com/aderyabin please have a look at #155
#155


Reply to this email directly or view it on GitHub
#379 (comment).


Andrey Deryabin

@aderyabin
Copy link
Contributor Author

@jodosha @AlfonsoUceda Are you still want to create a template engine gems like lotus-haml ?

@aderyabin
Copy link
Contributor Author

This PR affects Lotusrc. It's better to accept #371 before current.

@jodosha
Copy link
Member

jodosha commented Oct 22, 2015

Are you still want to create a template engine gems like lotus-haml ?

@aderyabin We actually closed #155 because we do NOT want to maintain lotus-haml et. co

@aderyabin
Copy link
Contributor Author

I think that support template engines is not so difficult:
– add templates (index.html.xxx and application.html.xxx)
– add gem to Gemfile.

@jodosha Am I correct?

@AlfonsoUceda
Copy link
Contributor

@aderyabin officially we don't want support templates but people can create gems for supporting lotus with those templates ;)

@jodosha
Copy link
Member

jodosha commented Oct 22, 2015

@aderyabin

The main problem is to maintain application.html.xxx for all that template engines: https://github.com/lotus/view#engines

The templates created by action generator are empty, so it's just a matter to specify the right extension. We take it from .lotusrc. If you manually edit it template=haml and try to generate a new action, you'll see it works fine.

Adding the gem to Gemfile is easy too.

* replaced `template` to `template_engine` option
* added support legacy `template` option in `.lotusrc` for existed applications
* moved global constants to Lotus module
@jodosha
Copy link
Member

jodosha commented Nov 17, 2015

I'm gonna close this, because I'm afraid it can lead to inconsistencies and/or request for support for other template engines. This is something that should be eventually handled by third party gems.

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

Successfully merging this pull request may close these issues.

None yet

4 participants