refactorings, add python to IDE
This commit is contained in:
parent
acfc5ae753
commit
f5a544a7b2
6 changed files with 45 additions and 9 deletions
|
@ -9,7 +9,7 @@ private var aptInit = false
|
||||||
/**
|
/**
|
||||||
* Installs package(s) by using package manager "apt".
|
* Installs package(s) by using package manager "apt".
|
||||||
*
|
*
|
||||||
* @param packages the packages to be installed, packages separated by space if there are more than one
|
* @param packages the packages to be installed, packages must be separated by space if there are more than one
|
||||||
*/
|
*/
|
||||||
fun Prov.aptInstall(packages: String): ProvResult = def {
|
fun Prov.aptInstall(packages: String): ProvResult = def {
|
||||||
if (!aptInit) {
|
if (!aptInit) {
|
||||||
|
@ -27,6 +27,21 @@ fun Prov.aptInstall(packages: String): ProvResult = def {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs package(s) by using package manager "snap".
|
||||||
|
*
|
||||||
|
* @param packages the packages to be installed, packages must be separated by space if there are more than one
|
||||||
|
*/
|
||||||
|
// todo: add test
|
||||||
|
fun Prov.snapInstall(packages: String, classic: Boolean = false): ProvResult = def {
|
||||||
|
val packageList = packages.split(" ")
|
||||||
|
for (packg in packageList) {
|
||||||
|
cmd("sudo snap install $packg" + if (classic) " --classic" else "")
|
||||||
|
}
|
||||||
|
ProvResult(true) // dummy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a package from a ppa (personal package archive) by using package manager "apt".
|
* Installs a package from a ppa (personal package archive) by using package manager "apt".
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,8 +8,8 @@ import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provisions according to the options either a meissa workplace, reposOnly or gopassOnly.
|
* Provisions a workplace locally or on a remote machine.
|
||||||
* Locally or on a remote machine. If remotely, the remote host and remote user are specified by args parameters.
|
* Specify option -h for help.
|
||||||
*/
|
*/
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,12 @@ fun Prov.provisionWorkplace(
|
||||||
installDocker()
|
installDocker()
|
||||||
|
|
||||||
// IDEs
|
// IDEs
|
||||||
cmd("sudo snap install intellij-idea-community --classic")
|
|
||||||
installVSC("python", "clojure")
|
installVSC("python", "clojure")
|
||||||
|
installIntelliJ()
|
||||||
|
|
||||||
installDevOps()
|
installDevOps()
|
||||||
|
|
||||||
|
installPython()
|
||||||
}
|
}
|
||||||
|
|
||||||
ProvResult(true) // dummy
|
ProvResult(true) // dummy
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.domaindrivenarchitecture.provs.workplace.infrastructure
|
||||||
|
|
||||||
|
import org.domaindrivenarchitecture.provs.core.Prov
|
||||||
|
|
||||||
|
|
||||||
|
fun Prov.installIntelliJ() = task {
|
||||||
|
cmd("sudo snap install intellij-idea-community --classic")
|
||||||
|
}
|
|
@ -2,10 +2,9 @@ package org.domaindrivenarchitecture.provs.workplace.infrastructure
|
||||||
|
|
||||||
import org.domaindrivenarchitecture.provs.core.Prov
|
import org.domaindrivenarchitecture.provs.core.Prov
|
||||||
import org.domaindrivenarchitecture.provs.core.ProvResult
|
import org.domaindrivenarchitecture.provs.core.ProvResult
|
||||||
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDirs
|
|
||||||
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.dirExists
|
|
||||||
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
|
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
|
||||||
|
|
||||||
|
|
||||||
fun Prov.installPython() = def {
|
fun Prov.installPython() = def {
|
||||||
installPython3()
|
installPython3()
|
||||||
installVenv()
|
installVenv()
|
||||||
|
@ -14,14 +13,12 @@ fun Prov.installPython() = def {
|
||||||
installJupyterlab()
|
installJupyterlab()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun Prov.installPython3(): ProvResult = def {
|
fun Prov.installPython3(): ProvResult = def {
|
||||||
aptInstall("python3.8-venv")
|
aptInstall("python3.8-venv")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Prov.installVenv(): ProvResult = def {
|
fun Prov.installVenv(): ProvResult = def {
|
||||||
var venvHome = "~/.python/meissa"
|
val venvHome = "~/.python/meissa"
|
||||||
cmd("python3 -m venv " + venvHome)
|
cmd("python3 -m venv " + venvHome)
|
||||||
cmd("source " + venvHome + "/bin/activate")
|
cmd("source " + venvHome + "/bin/activate")
|
||||||
cmd("pip install pip --upgrade")
|
cmd("pip install pip --upgrade")
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.domaindrivenarchitecture.provs.workplace.infrastructure
|
||||||
|
|
||||||
|
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||||
|
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
internal class PythonKtTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@ContainerTest
|
||||||
|
fun installPython() {
|
||||||
|
defaultTestContainer().installPython()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue