sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [sling-whiteboard] branch master updated: Small tweak to how files converted from prov model to feature are named
Date Mon, 09 Apr 2018 12:58:40 GMT
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 38f7775  Small tweak to how files converted from prov model to feature are named
38f7775 is described below

commit 38f77750337574c9526417694d23b166dbc0dafb
Author: David Bosschaert <david.bosschaert@gmail.com>
AuthorDate: Mon Apr 9 13:57:14 2018 +0100

    Small tweak to how files converted from prov model to feature are named
    
    When converting a provisioning model to a feature, include the name of
    the original provisioning model file and name of the original feature in
    the filename.
---
 .../sling/feature/modelconverter/impl/ProvisioningToFeature.java  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/featuremodel/feature-modelconverter/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
b/featuremodel/feature-modelconverter/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
index cf1a973..0db9c2b 100644
--- a/featuremodel/feature-modelconverter/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
+++ b/featuremodel/feature-modelconverter/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
@@ -72,6 +72,12 @@ public class ProvisioningToFeature {
         Model model = createModel(Collections.singletonList(file), null, true, false);
         final List<org.apache.sling.feature.Feature> features = buildFeatures(model);
 
+        String bareFileName = file.getName();
+        int idx = bareFileName.lastIndexOf('.');
+        if (idx > 0) {
+            bareFileName = bareFileName.substring(0, idx);
+        }
+
         List<File> files = new ArrayList<>();
         for (org.apache.sling.feature.Feature f : features) {
             String id = f.getVariables().get("provisioning.model.name");
@@ -79,6 +85,8 @@ public class ProvisioningToFeature {
                 id = f.getId().getArtifactId();
             }
 
+            id = bareFileName + "_" + id;
+
             File outFile = new File(outDir, id + ".json");
             int counter = 0;
             while (outFile.exists()) {

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

Mime
View raw message