-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructured Helper - Added DevCompanyHelper.initCompany.
- Loading branch information
Showing
35 changed files
with
754 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Create Project | ||
**Experimental** | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Development | ||
|
||
## Pre-Requisites | ||
**_Camundala_** is written in _**Scala**_ and provides _Scala DSLs_. | ||
So far we only use it as a _sbt_ projects. | ||
Here is a video to get you started with a Scala dev environment: | ||
[Setting up a dev environment with Coursier](https://www.youtube.com/watch?v=j-H6LSv2z_8&list=PLTx-VKTe8yLxYQfX_eGHCxaTuWvvG28Ml). | ||
|
||
There are three phases in the development process: | ||
|
||
1. **[Init Company]** | ||
|
||
Create the directory structure and common files to get you started with _Camundala_. | ||
|
||
2. **[Create Project]** | ||
|
||
Create the project directory and the Helper Script for the project development. | ||
|
||
3. **[Project Development]** | ||
|
||
Tasks to support the project development. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
laika.navigationOrder = [ | ||
development.md | ||
initCompany.md | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Init Company | ||
**Experimental** | ||
|
||
Create the directory structure and common files to get you started with _Camundala_. | ||
|
||
The Structure of the Process-Projects looks like this: | ||
``` | ||
myProject1 myProject2 ... | ||
| | | | ||
company-camundala | ||
| | ||
camundala | ||
``` | ||
|
||
The idea is that you have a company layer, where you can override Company specific settings. | ||
|
||
@:callout(info) | ||
**Be aware** that one of the main advantages is the concept of _Convention over Configuration_. | ||
|
||
At the moment not everything is configurable. | ||
|
||
So try to stick to the conventions, whenever possible. | ||
@:@ | ||
|
||
|
||
1. Create a directory for your company development: | ||
```bash | ||
mkdir ~/dev-myCompany | ||
``` | ||
|
||
1. Create `helperCompany.scala` in your company directory. | ||
```bash | ||
cd ~/dev-myCompany | ||
open helperCompany.scala | ||
``` | ||
|
||
1. Copy the following content to `helperCompany.scala`: | ||
```scala | ||
#!/usr/bin/env -S scala shebang | ||
// DO NOT ADJUST. This file is replaced by `./helper.scala update`. | ||
|
||
//> using toolkit 0.5.0 | ||
//> using dep io.github.pme123::camundala-helper:${project.version} | ||
|
||
import camundala.helper.dev.DevCompanyHelper | ||
|
||
@main | ||
def run(command: String, arguments: String*): Unit = | ||
DevCompanyHelper.run(command, arguments*) | ||
``` | ||
|
||
1. Replace `${project.version}` with _${project.version}_. | ||
|
||
1. Make the file executable: | ||
```bash | ||
chmod +x helperCompany.scala | ||
``` | ||
|
||
1. Create the company directory structure: | ||
```bash | ||
./helperCompany.scala init | ||
``` | ||
|
||
1. Open the `company-camundala` directory with your IDE (I use Intellij). | ||
1. Import the sbt project. The project should compile without errors. | ||
|
||
### Next Step: [Create Project] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Project Development | ||
**Experimental** | ||
|
||
TODO |
104 changes: 0 additions & 104 deletions
104
04-helper/src/main/scala/camundala/helper/DevHelper.scala
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
04-helper/src/main/scala/camundala/helper/dev/DevCompanyHelper.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package camundala.helper.dev | ||
|
||
import camundala.helper.dev.company.InitCompanyGenerator | ||
import camundala.helper.util.{DevConfig, RepoConfig} | ||
|
||
import scala.util.{Failure, Success, Try} | ||
|
||
object DevCompanyHelper: | ||
|
||
def run(command: String, arguments: String*): Unit = | ||
val args = arguments.toSeq | ||
println(s"Running command: $command with args: $args") | ||
Try(Command.valueOf(command)) match | ||
case Success(cmd) => | ||
runCommand(cmd, args) | ||
case Failure(_) => | ||
println(s"Command not found: $command") | ||
println("Available commands: " + Command.values.mkString(", ")) | ||
end match | ||
end run | ||
|
||
private def runCommand(command: Command, args: Seq[String]): Unit = | ||
command match | ||
case Command.`init` => | ||
initCompany | ||
case Command.project => | ||
args match | ||
case Seq(projectName) => | ||
createProject(projectName) | ||
case other => | ||
println(s"Invalid arguments for command $command: $other") | ||
println("Usage: project <projectName>") | ||
|
||
|
||
enum Command: | ||
case init, project | ||
|
||
def initCompany: Unit = | ||
val companyName = os.pwd.last.replace("dev-", "") | ||
println(s"Init Company $companyName") | ||
given config: DevConfig = InitCompanyGenerator.init(companyName) //, repoConfig) | ||
InitCompanyGenerator().generate | ||
|
||
def createCompany(companyName: String) = //, repoConfig: RepoConfig) = | ||
println(s"Create/Update Company: $companyName") | ||
|
||
// given config: DevConfig = SetupCompanyGenerator.init(companyName, repoConfig) | ||
|
||
// SetupCompanyGenerator().generate | ||
|
||
def createProject(projectName: String): Unit = | ||
println(s"Update Project: $projectName") | ||
// SetupGenerator()(using config.setupConfig).generate | ||
end DevCompanyHelper |
Oops, something went wrong.