Slate Kit comes with a command line tool to serve as a project generator. This project generator is a pacakged java based application, and works like a minimal version of nodejs yeoman or python cookie-cutter There are several types of project generators available by default from Slate Kit. These are the most common type of Applications or services corresponding to the architecture components available from Slate Kit.
slatekit new app -name="Sample1" -packageName="mycompany.apps"
Currently, the Slate Kit CLI tool is only available for automatic install on Mac OS as it is integrated with HomeBrew. You can however perform an manual install on Windows using the instructions provided.
You can easily install the Slate Kit CLI using HomeBrew on Mac OS.
brew tap slatekit/slatekit # Note: install may take a long time ( see notes/issues below ) brew install slatekit
brew upgrade slatekit
brew uninstall slatekit brew untap slatekit/slatekit
Currently, there is no installer available for Windows. However you have 2 options:
There are several sample applications available in git at Samples. You can simply copy one of the samples ( app, cli, api, job, etc ) and adjust/remove code accoringly.
You can also perform a manual install for the time being.
1. Download the latest release zip from https://github.com/slatekit/slatekit-cli/releases
2. Unzip https://github.com/slatekit/slatekit-cli/archive/v2.2.0.zip to C:/tools/slatekit/2.2.0
3. Create a bin directory in C:/tools/slatekit/2.2.0/bin and move slatekit and slatekit.bat files into bin
4. Add C:/tools/slatekit/2.2.0/bin/ to your system path
5. In terminal Run command slatekit new app -name=“MyApp1” -packageName=“company1.apps” (You may have to refresh your terminal)
6. This will fail the first time but it will generate the settings
10. Go to your user/documents directory and open ~/.slatekit/tools/cli/conf/settings.conf file
11. Update the generation.source to path of the templates e.g. C:/tools/slatekit/2.2.0/tempaltes
12. You should now be able to run the command again to generate projects
The settings for the generator are automatically created at ~/.slatekit/tools/cli/conf/settings.conf when you try to create your first project. The settings are listed below
|slatekit.version||Variable||Version of Slate Kit stable libraries to use||2.2.0|
|slatekit.version.beta||Variable||Version of Slate Kit beta libraries to use||2.2.0|
|kotlin.version||Variable||Version of Kotlin to use||1.3.6|
|generation.source||Variable||Represents the path to the templates used for project code generation. This is defaulted to the version of Slate Kit installed through HomeBrew||/usr/local/Cellar/slatekit/1.34.0/templates|
:> slatekit new app -name="MyApp1" -packageName="company1.apps" # Now build and run via gradle :> cd MyApp1 :> gradle build :> gradle run
Generates a new API project for hosting HTTP/Web APIs. APIs in Slate Kit are considered Universal in the sense that you write them once and they are available as both HTTP/Web APIs ( in the form of RPCs ) and also available on the CLI. Also refer to the APIs component.
slatekit new api -name="MyAPI1" -packageName="company1.apis" # Now build and run via gradle :> cd MyAPI1 :> gradle build :> gradle run
Generates a new background job that can be gracefully started, stopped, paused, resumed. They can also be run in “pages”, or process items from queues. Refer to the Jobs component and example: Example_Jobs.kt.
slatekit new job -name="MyJob1" -packageName="company1.jobs"
For the Job, you can run the different job types by passing -job.name to the arguments for gradle/java. E.g.
cd gen/MyJob1 gradle build # To run the One Time Job sample gradle run --args='-sample=onetime' # To run the Paged Job sample gradle run --args='-sample=paging' # To run the Queue Job sample gradle run --args='-sample=queued' # To run the Worker Sample gradle run --args='-sample=worker'
slatekit new cli -name="MyCLI1" -packageName="company1.apps" # Now build and run via gradle :> cd MyCLI1 :> gradle build :> gradle distZip :> cd build/distributions # Unzip the MyCLI1.zip and run :> cd MyCLI1/bin :> ./MyCLI1