From 23e1005175725d88935f10038ff060a938cde7f4 Mon Sep 17 00:00:00 2001 From: coaxial Date: Sat, 21 Jul 2018 15:03:54 -0400 Subject: [PATCH] Fix containers names and aliases --- __tests__/__snapshots__/app.js.snap | 20 ++++++++++---------- __tests__/__snapshots__/helpers.js.snap | 20 ++++++++++---------- generators/helpers.js | 15 ++++----------- yarn.lock | 4 ---- 4 files changed, 24 insertions(+), 35 deletions(-) diff --git a/__tests__/__snapshots__/app.js.snap b/__tests__/__snapshots__/app.js.snap index 0df6412..703af4b 100644 --- a/__tests__/__snapshots__/app.js.snap +++ b/__tests__/__snapshots__/app.js.snap @@ -212,12 +212,12 @@ driver: lint: name: yamllint platforms: - - name: ubuntu_trusty - alias: 'ubuntu:14.04' - - name: ubuntu_xenial - alias: 'ubuntu:16.04' - - name: ubuntu_bionic - alias: 'ubuntu:18.04' + - name: ubuntu-trusty + alias: ubuntu/trusty + - name: ubuntu-xenial + alias: ubuntu/xenial + - name: ubuntu-bionic + alias: ubuntu/bionic provisioner: name: ansible @@ -298,10 +298,10 @@ driver: lint: name: yamllint platforms: - - name: debian_jessie - alias: 'images:debian/8' - - name: debian_stretch - alias: 'images:debian/9' + - name: debian-jessie + alias: debian/jessie + - name: debian-stretch + alias: debian/stretch provisioner: name: ansible diff --git a/__tests__/__snapshots__/helpers.js.snap b/__tests__/__snapshots__/helpers.js.snap index 299ae21..8c91ab6 100644 --- a/__tests__/__snapshots__/helpers.js.snap +++ b/__tests__/__snapshots__/helpers.js.snap @@ -133,24 +133,24 @@ Array [ exports[`helpers #moleculePlatforms formats the list correctly 1`] = ` Array [ Object { - "alias": "ubuntu:14.04", - "name": "ubuntu_trusty", + "alias": "ubuntu/trusty", + "name": "ubuntu-trusty", }, Object { - "alias": "ubuntu:16.04", - "name": "ubuntu_xenial", + "alias": "ubuntu/xenial", + "name": "ubuntu-xenial", }, Object { - "alias": "ubuntu:18.04", - "name": "ubuntu_bionic", + "alias": "ubuntu/bionic", + "name": "ubuntu-bionic", }, Object { - "alias": "images:debian/8", - "name": "debian_jessie", + "alias": "debian/jessie", + "name": "debian-jessie", }, Object { - "alias": "images:debian/9", - "name": "debian_stretch", + "alias": "debian/stretch", + "name": "debian-stretch", }, ] `; diff --git a/generators/helpers.js b/generators/helpers.js index 04316f9..19c98b9 100644 --- a/generators/helpers.js +++ b/generators/helpers.js @@ -6,7 +6,6 @@ const { curry, either, head, - ifElse, insert, isEmpty, isNil, @@ -16,7 +15,6 @@ const { map, pipe, prop, - propEq, repeat, replace, tail, @@ -25,8 +23,8 @@ const { unless, unnest, } = require('ramda'); +const { paramCase } = require('change-case'); const { safeDump, safeLoad } = require('js-yaml'); -const { snakeCase } = require('change-case'); const { basename } = require('path'); @@ -77,17 +75,12 @@ const versions = platformName => insert(0, separator(toLower(platformName)), platformsToChoices(platformName)); const generateListForVersions = map(version => { - const isUbuntu = propEq('distribution', 'ubuntu'); - const ubuntuFormat = ubuntu => `ubuntu:${prop('versionNumber', ubuntu)}`; - const nonUbuntuFormat = notUubntu => - `images:${prop('distribution', notUubntu)}/${prop('versionNumber', notUubntu)}`; const versionLabel = either(prop('codeName'), prop('versionNumber')); - - const aliasValue = ifElse(isUbuntu, ubuntuFormat, nonUbuntuFormat); + const imagesFormat = item => `${prop('distribution', item)}/${versionLabel(item)}`; return { - name: snakeCase(`${prop('distribution', version)} ${versionLabel(version)}`), - alias: aliasValue(version), + name: paramCase(imagesFormat(version)), + alias: imagesFormat(version), }; }); diff --git a/yarn.lock b/yarn.lock index 27fee9e..233f0c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1802,10 +1802,6 @@ ignore@^3.3.3, ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" -immutable@^3.8.2: - version "3.8.2" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" - import-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc"