Groovy web console

subscribe to the feed Subscribe
to this
site

Untitled

Published 1 month ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def migrationFiles() {    return [
        "migrations/cxp/1.js",
        "migrations/cxp/2.js",
        "migrations/mcp/3.js",
        "migrations/courier/4.js",
    ]
}

def getAppMigrations() {
    appMigrationsMap = [:]

    migrationFiles().each { file ->
        app = file.split('/')[1]

        if (!appMigrationsMap.containsKey(app)) {
            appMigrationsMap.put(app, [])
        }

        migrations = appMigrationsMap.get(app)
        migrations << file
        appMigrationsMap.put(app, migrations)
    }

    return appMigrationsMap
}


getAppMigrations()