You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/04/27 10:01:44 UTC

[sling-org-apache-sling-feature-modelconverter] 26/40: Small tweak to how files converted from prov model to feature are named

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-org-apache-sling-feature-modelconverter.git

commit 571927a4204c8c5aa0c8774ff92619a5adab0ca4
Author: David Bosschaert <da...@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/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java b/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
index cf1a973..0db9c2b 100644
--- a/src/main/java/org/apache/sling/feature/modelconverter/impl/ProvisioningToFeature.java
+++ b/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.