Skip to content

Commit

Permalink
Minor polish
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Sep 11, 2024
1 parent 87e7146 commit 6c3cdd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.openrewrite.*;
import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.properties.CreatePropertiesFile;
import org.openrewrite.properties.PropertiesVisitor;
import org.openrewrite.properties.tree.Properties;
Expand Down Expand Up @@ -60,12 +60,12 @@ public TreeVisitor<?, ExecutionContext> getScanner(Accumulator acc) {
String sourcePath = PathUtils.separatorsToUnix(propertyFile.getSourcePath().toString());
String[] pathArray = sourcePath.split("/");

if (sourcePath.matches("(?:.*/)?application.properties")) {
if (propertyFile.getSourcePath().endsWith("application.properties")) {
acc.pathToApplicationProperties = getPathToApplicationProperties(pathArray);
acc.propertyFileContent = getNewApplicationPropertyFileInfo(propertyFile.getContent());
}

if (sourcePath.matches("(?:.*/)?application-[^/]+\\.properties")) {
if (propertyFile.getSourcePath().getFileName().toString().matches("application-[^/]+\\.properties")) {
acc.fileNameToFilePath.put(pathArray[pathArray.length - 1], sourcePath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void noApplicationProperties() {
base-url.PR-services=http://my.url.com
exchange-token=1234567890
exchange-tokens=${base-url.PR-services}/exchange-token
""",
sourceSpecs -> sourceSpecs.path("application-dev.properties"))
);
Expand All @@ -58,7 +57,6 @@ void noSeparateProfile() {
base-url.PR-services=http://my.url.com
exchange-token=1234567890
exchange-tokens=${base-url.PR-services}/exchange-token
""",
sourceSpecs -> sourceSpecs.path("application.properties"))
);
Expand Down

0 comments on commit 6c3cdd7

Please sign in to comment.