diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompiler.java b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompiler.java index 36ab644..9aa3091 100644 --- a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompiler.java +++ b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompiler.java @@ -11,6 +11,7 @@ import static com.github.clagomess.pirilampo.core.enums.CompilationTypeEnum.FEATURE; public class FeatureToHTMLCompiler extends Compiler { + private final PropertiesCompiler propertiesCompiler = new PropertiesCompiler(); private final ParametersDto parameters; private final File feature; private final FeatureMetadataDto featureMetadataDto; @@ -60,6 +61,7 @@ public void build() throws Exception { outArtifact.delete(); throw e; } finally { + propertiesCompiler.setData(parameters); stopTimer(); } } diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompiler.java b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompiler.java index 3e221ac..db01d85 100644 --- a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompiler.java +++ b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompiler.java @@ -18,6 +18,7 @@ @Slf4j @RequiredArgsConstructor public class FeatureToPDFCompiler extends Compiler { + private final PropertiesCompiler propertiesCompiler = new PropertiesCompiler(); private final ParametersDto parameters; private final File feature; private final FeatureMetadataDto featureMetadataDto; @@ -79,6 +80,7 @@ public void build() throws Exception { deleteAllTempFiles(); throw e; } finally { + propertiesCompiler.setData(parameters); stopTimer(); } } diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompiler.java b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompiler.java index 0ad64c0..6e60b13 100644 --- a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompiler.java +++ b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompiler.java @@ -24,6 +24,7 @@ @Slf4j public class FolderToHTMLCompiler extends Compiler { + private final PropertiesCompiler propertiesCompiler = new PropertiesCompiler(); private final ImageParser imageParser = new ImageParser(); private final ParametersDto parameters; protected final Map index = new HashMap<>(); @@ -225,6 +226,7 @@ public void build() throws Exception { outArtifact.delete(); throw e; } finally { + propertiesCompiler.setData(parameters); stopTimer(); } } diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompiler.java b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompiler.java index 3eb6a8b..b00706d 100644 --- a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompiler.java +++ b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompiler.java @@ -16,6 +16,7 @@ @Slf4j public class FolderToPDFCompiler extends Compiler { + private final PropertiesCompiler propertiesCompiler = new PropertiesCompiler(); private final ParametersDto parameters; public FolderToPDFCompiler(ParametersDto parameters) { @@ -92,6 +93,7 @@ public void build() throws Exception { deleteAllTempFiles(); throw e; } finally { + propertiesCompiler.setData(parameters); stopTimer(); } } diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/PropertiesCompiler.java b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/PropertiesCompiler.java index c1329fe..5695fdb 100644 --- a/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/PropertiesCompiler.java +++ b/core/src/main/java/com/github/clagomess/pirilampo/core/compilers/PropertiesCompiler.java @@ -99,6 +99,8 @@ public void setData(ParametersDto parameters){ prop.setProperty("compilationArtifact", parameters.getCompilationArtifact().name()); prop.store(output, null); + + log.info("- saved configuration at {}", file); } catch (IOException ex) { log.error(log.getName(), ex); } diff --git a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompilerTest.java b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompilerTest.java index 0dae81b..7812264 100644 --- a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompilerTest.java +++ b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToHTMLCompilerTest.java @@ -57,6 +57,22 @@ public void build() throws Exception { */ } + @Test + public void checkIsSavedProperties() throws Exception { + ParametersDto parameters = new ParametersDto(); + parameters.setProjectSource(featureFile); + parameters.setProjectTarget(targetFile); + parameters.setCompilationType(CompilationTypeEnum.FEATURE); + parameters.setCompilationArtifact(CompilationArtifactEnum.HTML); + + new FeatureToHTMLCompiler(parameters).build(); + + assertTrue(new File( + parameters.getProjectSource().getParentFile(), + PropertiesCompiler.FILENAME + ).isFile()); + } + @Test public void checkDeletedBuffersOnError() { ParametersDto parameters = new ParametersDto(); diff --git a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompilerTest.java b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompilerTest.java index 05deb1a..a7df309 100644 --- a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompilerTest.java +++ b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FeatureToPDFCompilerTest.java @@ -76,6 +76,22 @@ public void build() throws Exception { // @TODO: also, validate html } + @Test + public void checkIsSavedProperties() throws Exception { + ParametersDto parameters = new ParametersDto(); + parameters.setProjectSource(featureFile); + parameters.setProjectTarget(targetFile); + parameters.setCompilationType(CompilationTypeEnum.FEATURE); + parameters.setCompilationArtifact(CompilationArtifactEnum.PDF); + + new FeatureToPDFCompiler(parameters).build(); + + assertTrue(new File( + parameters.getProjectSource().getParentFile(), + PropertiesCompiler.FILENAME + ).isFile()); + } + @Test public void checkDeletedBuffersOnError() { ParametersDto parameters = new ParametersDto(); diff --git a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompilerTest.java b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompilerTest.java index 5703c79..2e2065d 100644 --- a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompilerTest.java +++ b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToHTMLCompilerTest.java @@ -98,6 +98,20 @@ public void buildIndex() throws IOException { .contains(";"); } + @Test + public void checkIsSavedProperties() throws Exception { + ParametersDto parameters = new ParametersDto(); + parameters.setProjectSource(featureFolder); + parameters.setProjectTarget(targetFile); + + new FolderToHTMLCompiler(parameters).build(); + + assertTrue(new File( + parameters.getProjectSource(), + PropertiesCompiler.FILENAME + ).isFile()); + } + @Test public void checkDeletedBuffersOnError() { ParametersDto parameters = new ParametersDto(); diff --git a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompilerTest.java b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompilerTest.java index 3d5ca6c..2087a2f 100644 --- a/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompilerTest.java +++ b/core/src/test/java/com/github/clagomess/pirilampo/core/compilers/FolderToPDFCompilerTest.java @@ -57,6 +57,22 @@ public void build() throws Exception { // @TODO: validate content html + @Test + public void checkIsSavedProperties() throws Exception { + ParametersDto parameters = new ParametersDto(); + parameters.setProjectSource(featureFolder); + parameters.setProjectTarget(targetFile); + parameters.setCompilationType(CompilationTypeEnum.FOLDER); + parameters.setCompilationArtifact(CompilationArtifactEnum.PDF); + + new FolderToPDFCompiler(parameters).build(); + + assertTrue(new File( + parameters.getProjectSource(), + PropertiesCompiler.FILENAME + ).isFile()); + } + @Test public void checkDeletedBuffersOnError() { ParametersDto parameters = new ParametersDto();