Skip to content

Commit

Permalink
Migrate gitpod to module
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnClin committed Jun 30, 2022
1 parent 89d092d commit c893044
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 240 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ private GeneratorAction() {}
public static final String DOCKERFILE = "dockerfile";

public static final String GITHUB_CODESPACES = "github-codespaces";
public static final String GITPOD = "gitpod";

public static final String SPRINGBOOT_WEBFLUX_NETTY = "springboot-webflux-netty";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package tech.jhipster.lite.generator.setup.gitpod.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.setup.gitpod.domain.GitpodService;
import tech.jhipster.lite.generator.setup.gitpod.domain.GitpodModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class GitpodApplicationService {

private final GitpodService gitpodService;
private final GitpodModuleFactory factory;

public GitpodApplicationService(GitpodService gitpodService) {
this.gitpodService = gitpodService;
public GitpodApplicationService() {
factory = new GitpodModuleFactory();
}

public void init(Project project) {
gitpodService.init(project);
public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package tech.jhipster.lite.generator.setup.gitpod.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.*;

import tech.jhipster.lite.error.domain.Assert;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

public class GitpodModuleFactory {

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

//@formatter:off
return moduleBuilder(properties)
.files()
.batch(from("setup/gitpod"), to("."))
.file(".gitpod.yml")
.file(".gitpod.Dockerfile")
.and()
.and()
.build();
//@formatter:on
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package tech.jhipster.lite.generator.setup.gitpod.infrastructure.primary;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.setup.gitpod.application.GitpodApplicationService;
import tech.jhipster.lite.module.infrastructure.primary.JHipsterModuleApiDoc;
import tech.jhipster.lite.module.infrastructure.primary.JHipsterModuleResource;

@Configuration
class GitpodModuleConfiguration {

@Bean
JHipsterModuleResource gitpodModule(GitpodApplicationService gitPods) {
return JHipsterModuleResource
.builder()
.legacyUrl("/api/developer-tools/gitpod")
.slug("gitpod")
.withoutProperties()
.apiDoc(new JHipsterModuleApiDoc("Gitpod", "Init Gitpod configuration files"))
.factory(gitPods::buildModule);
}
}

This file was deleted.

6 changes: 6 additions & 0 deletions src/test/features/gitpod.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Gitpod

Scenario: Should apply gitpod module
When I apply "gitpod" module to default project without properties
Then I should have files in "."
| .gitpod.yml |

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package tech.jhipster.lite.generator.setup.gitpod.domain;

import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.*;

import org.junit.jupiter.api.Test;
import tech.jhipster.lite.UnitTest;
import tech.jhipster.lite.common.domain.FileUtils;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.JHipsterModulesFixture;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@UnitTest
class GitpodModuleFactoryTest {

private static final GitpodModuleFactory factory = new GitpodModuleFactory();

@Test
void shouldBuildModule() {
JHipsterModuleProperties properties = JHipsterModulesFixture.propertiesBuilder(FileUtils.tmpDirForTest()).build();

JHipsterModule module = factory.buildModule(properties);

assertThatModule(module).createFiles(".gitpod.yml", ".gitpod.Dockerfile");
}
}

This file was deleted.

This file was deleted.

0 comments on commit c893044

Please sign in to comment.