Implement renderInstructions in themer-xcode
This commit is contained in:
parent
20956b7288
commit
ab8ddbe060
@ -12,8 +12,4 @@ Then pass `themer-xcode` as a `-t` (`--template`) arg to `themer`:
|
||||
|
||||
themer -c my-colors.js -t themer-xcode -o gen
|
||||
|
||||
## Output
|
||||
|
||||
`themer-xcode` will generate a `Themer Dark.dvtcolortheme` / `Themer Light.dvtcolortheme` (or both) in your output directory.
|
||||
|
||||
Copy (or symlink) your theme(s) to `~/Library/Developer/Xcode/UserData/FontAndColorThemes/` (you can create this directory if it does not already exist), then restart Xcode. Your theme will then be available in Preferences > Fonts and Colors.
|
||||
Installation instructions for the generated theme file(s) will be included in `<output dir>/README.md`.
|
||||
|
@ -171,3 +171,15 @@ exports[`render should render a properly formatted Xcode theme file 2`] = `
|
||||
</dict>
|
||||
</plist>"
|
||||
`;
|
||||
|
||||
exports[`renderInstructions should provide installation instructions 1`] = `
|
||||
"
|
||||
Copy (or symlink) the generated theme files to Xcode's themes directory:
|
||||
|
||||
mkdir -p ~/Library/Developer/Xcode/UserData/FontAndColorThemes
|
||||
cp 'Themer Dark.dvtcolortheme' ~/Library/Developer/Xcode/UserData/FontAndColorThemes/
|
||||
cp 'Themer Light.dvtcolortheme' ~/Library/Developer/Xcode/UserData/FontAndColorThemes/
|
||||
|
||||
Then restart Xcode. The themes will be available in Preferences > Fonts and Colors.
|
||||
"
|
||||
`;
|
||||
|
@ -127,7 +127,17 @@ const render = colors => {
|
||||
});
|
||||
};
|
||||
|
||||
const renderInstructions = paths => `
|
||||
Copy (or symlink) the generated theme ${paths.length > 1 ? 'files' : 'file'} to Xcode's themes directory:
|
||||
|
||||
mkdir -p ~/Library/Developer/Xcode/UserData/FontAndColorThemes
|
||||
${paths.map(p => ` cp '${p}' ~/Library/Developer/Xcode/UserData/FontAndColorThemes/`).join('\n')}
|
||||
|
||||
Then restart Xcode. The ${paths.length > 1 ? 'themes' : 'theme'} will be available in Preferences > Fonts and Colors.
|
||||
`;
|
||||
|
||||
module.exports = {
|
||||
formatColorSet,
|
||||
render,
|
||||
renderInstructions,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const {formatColorSet, render} = require('./index');
|
||||
const {formatColorSet, render, renderInstructions} = require('./index');
|
||||
const {colors} = require('../../themer-colors-default');
|
||||
|
||||
describe('formatColorSet', () => {
|
||||
@ -25,3 +25,11 @@ describe('render', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('renderInstructions', () => {
|
||||
it('should provide installation instructions', async () => {
|
||||
const files = await Promise.all(render(colors));
|
||||
const instructions = renderInstructions(files.map(({ name }) => name));
|
||||
expect(instructions).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user