cbmarcum / skeletal

A simple project creation tool that uses packaged templates
Apache License 2.0
17 stars 3 forks source link

adding a simpleRepository using config add forgets the default repository #13

Closed cbmarcum closed 1 year ago

cbmarcum commented 1 year ago

adding a simpleRepository before there was a managed-config.json file using:

skeletal config add simpleRepositories "https://codebuilders.jfrog.io/artifactory/generic/openoffice-templates"

created managed-config.json with this content:

{
    "simpleRepositories": [
        "https://codebuilders.jfrog.io/artifactory/generic/openoffice-templates"
    ]
}

then listing templates:

skeletal list
Available templates in https://codebuilders.jfrog.io/artifactory/generic/openoffice-templates

    aoo-addin
    aoo-addin-java
    aoo-addon
    aoo-addon-java
    aoo-client

and the default repo templates are missing!

cbmarcum commented 1 year ago

expected result is if there is no explicit entry for the default simpleRepository it is added first followed by the new one:

{
    "simpleRepositories": [
        "https://codebuilders.jfrog.io/artifactory/generic/skeletal-templates",
        "https://codebuilders.jfrog.io/artifactory/generic/openoffice-templates"
    ]
}
cbmarcum commented 1 year ago

caused in Configuration constructor where all settings are built by default (hard-coded), managed (managed-config.json), and overrides of system properties etc. problem was that once a array setting like simpleRepositories was added which caused the managed-config.json file to be written, it overrode the default setting which held the default repository. fix is to include the defaults in the managed settings and then write them all to the json file. only leave out the overrides.

cbmarcum commented 1 year ago

fixed in 0.13.2