mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Rename archetype -> template.
This commit is contained in:
parent
d5e6a04b5d
commit
2b3aeabba2
14 changed files with 90 additions and 91 deletions
|
@ -29,11 +29,11 @@ class Args {
|
|||
@Parameter(names = arrayOf("--help", "--usage"), description = "Display the help")
|
||||
var usage: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("-i", "--init"), description = "Invoke the archetypes named, separated by a comma")
|
||||
var archetypes : String? = null
|
||||
@Parameter(names = arrayOf("-i", "--init"), description = "Invoke the templates named, separated by a comma")
|
||||
var templates: String? = null
|
||||
|
||||
@Parameter(names = arrayOf("--listArchetypes"), description = "List the available archetypes")
|
||||
var listArchetypes: Boolean = false
|
||||
@Parameter(names = arrayOf("--listTemplates"), description = "List the available templates")
|
||||
var listTemplates: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("--log"), description = "Define the log level (1-3)")
|
||||
var log: Int = 1
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package com.beust.kobalt.api
|
||||
|
||||
import com.beust.kobalt.Args
|
||||
|
||||
/**
|
||||
* Plugins that want to participate in the --init process (they can generate files to initialize
|
||||
* a new project).
|
||||
*/
|
||||
interface IInitContributor {
|
||||
val archetypes: List<IArchetype>
|
||||
}
|
||||
|
||||
interface IArchetype {
|
||||
/**
|
||||
* The name of this archetype. This is the name that will be looked up when passed to the --init
|
||||
* argument.
|
||||
*/
|
||||
val archetypeName: String
|
||||
|
||||
/**
|
||||
* Description of this archetype.
|
||||
*/
|
||||
val archetypeDescription: String
|
||||
|
||||
/**
|
||||
* The plug-in this archetype belongs to.
|
||||
*/
|
||||
val pluginName: String
|
||||
|
||||
/**
|
||||
* Instructions to display to the user after a template has been generated.
|
||||
*/
|
||||
val instructions : String get() = "Build this project with `./kobaltw assemble`"
|
||||
|
||||
/**
|
||||
* Generate the files for this archetype. The parameter is the arguments that were passed to the kobaltw
|
||||
* command.
|
||||
*/
|
||||
fun generateArchetype(args: Args, classLoader: ClassLoader)
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.beust.kobalt.api
|
||||
|
||||
import com.beust.kobalt.Args
|
||||
|
||||
/**
|
||||
* Plugins that want to participate in the --init process (they can generate files to initialize
|
||||
* a new project).
|
||||
*/
|
||||
interface ITemplateContributor {
|
||||
val templates: List<ITemplate>
|
||||
}
|
||||
|
||||
interface ITemplate {
|
||||
/**
|
||||
* The name of this template. This is the name that will be looked up when passed to the --init
|
||||
* argument.
|
||||
*/
|
||||
val templateName: String
|
||||
|
||||
/**
|
||||
* Description of this template.
|
||||
*/
|
||||
val templateDescription: String
|
||||
|
||||
/**
|
||||
* The plug-in this template belongs to.
|
||||
*/
|
||||
val pluginName: String
|
||||
|
||||
/**
|
||||
* Instructions to display to the user after a template has been generated.
|
||||
*/
|
||||
val instructions : String get() = "Build this project with `./kobaltw assemble`"
|
||||
|
||||
/**
|
||||
* Generate the files for this template. The parameter is the arguments that were passed to the kobaltw
|
||||
* command.
|
||||
*/
|
||||
fun generateTemplate(args: Args, classLoader: ClassLoader)
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) {
|
|||
val plugins = arrayListOf<IPlugin>()
|
||||
val projectContributors = arrayListOf<IProjectContributor>()
|
||||
val classpathContributors = arrayListOf<IClasspathContributor>()
|
||||
val initContributors = arrayListOf<IInitContributor>()
|
||||
val initContributors = arrayListOf<ITemplateContributor>()
|
||||
val repoContributors = arrayListOf<IRepoContributor>()
|
||||
val compilerFlagContributors = arrayListOf<ICompilerFlagContributor>()
|
||||
val compilerInterceptors = arrayListOf<ICompilerInterceptor>()
|
||||
|
@ -147,7 +147,7 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) {
|
|||
if (this is ICompilerFlagContributor) compilerFlagContributors.add(this)
|
||||
if (this is ICompilerInterceptor) compilerInterceptors.add(this)
|
||||
if (this is IDocContributor) docContributors.add(this)
|
||||
if (this is IInitContributor) initContributors.add(this)
|
||||
if (this is ITemplateContributor) initContributors.add(this)
|
||||
if (this is IPlugin) plugins.add(this)
|
||||
if (this is IProjectContributor) projectContributors.add(this)
|
||||
if (this is IRepoContributor) repoContributors.add(this)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue