Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate gitpod to module #2316

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.