Skip to content

Commit

Permalink
Create modules directory (#260)
Browse files Browse the repository at this point in the history
* create modules directory if missing
  • Loading branch information
thmarx authored Sep 26, 2024
1 parent bcde44a commit d37b75e
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-auth</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-content</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-core</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-extensions</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-filesystem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-filesystem</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-git/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-git</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-media/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-media</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-sandbox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-sandbox</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>cms-server</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public static Path getModuleFolder (String module) {
return Path.of("modules/" + module);
}

public static void createModulesFolder () throws IOException {
var modPath = Path.of("modules/");
if (!Files.exists(modPath)) {
Files.createDirectories(modPath);
}
}

public static boolean isInstalled(String module) {
return Files.exists(getModuleFolder(module));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.condation.cms.CMSServer;
import com.condation.cms.cli.tools.ModulesUtil;
import com.condation.cms.extensions.repository.InstallationHelper;
import java.io.IOException;
import java.nio.file.Path;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
Expand All @@ -47,6 +48,13 @@ public void run() {
return;
}

try {
createModulesFolder();
} catch (IOException ex) {
log.error("", ex);
throw new RuntimeException(ex);
}

var modules = ModulesUtil.getRequiredModules();
log.trace("check required modules: " + modules);
if (!ModulesUtil.allInstalled(modules) && !forceUpdate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@


import com.condation.cms.CMSServer;
import static com.condation.cms.cli.commands.modules.AbstractModuleCommand.createModulesFolder;
import com.condation.cms.extensions.repository.InstallationHelper;
import java.io.IOException;
import java.nio.file.Path;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
Expand Down Expand Up @@ -54,6 +56,13 @@ public void run() {
System.out.println("modules can not be modified in running system");
return;
}

try {
createModulesFolder();
} catch (IOException ex) {
log.error("", ex);
throw new RuntimeException(ex);
}

if (isInstalled(module) && !forceUpdate) {
System.err.println("module is already installed, use -f to force an update");
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>integration-tests</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>modules-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>modules-manager</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion modules/example-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.modules</groupId>
<artifactId>cms-modules</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<artifactId>example-module</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
</parent>
<groupId>com.condation.cms.modules</groupId>
<artifactId>cms-modules</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit d37b75e

Please sign in to comment.