Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix containers names and aliases #7

Merged
merged 1 commit into from
Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions __tests__/__snapshots__/app.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions __tests__/__snapshots__/helpers.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
]
`;
15 changes: 4 additions & 11 deletions generators/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {
curry,
either,
head,
ifElse,
insert,
isEmpty,
isNil,
Expand All @@ -16,7 +15,6 @@ const {
map,
pipe,
prop,
propEq,
repeat,
replace,
tail,
Expand All @@ -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');

Expand Down Expand Up @@ -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),
};
});

Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down