diff --git a/bin/pngToIcns b/bin/convertToIcns similarity index 96% rename from bin/pngToIcns rename to bin/convertToIcns index 655925a..de8f5c7 100755 --- a/bin/pngToIcns +++ b/bin/convertToIcns @@ -2,9 +2,9 @@ ### USAGE -# ./pngToIcns +# ./convertToIcns # Example -# ./pngToIcns.sh ~/sample.png ~/Desktop/converted.icns +# ./convertToIcns ~/sample.png ~/Desktop/converted.icns # exit the shell script on error immediately set -e diff --git a/src/build/iconBuild.js b/src/build/iconBuild.js index d1b736d..2568a72 100644 --- a/src/build/iconBuild.js +++ b/src/build/iconBuild.js @@ -1,6 +1,6 @@ import path from 'path'; import helpers from './../helpers/helpers'; -import pngToIcns from './../helpers/pngToIcns'; +import convertToIcns from './../helpers/convertToIcns'; import singleIco from './../helpers/singleIco'; const isOSX = helpers.isOSX; @@ -68,7 +68,7 @@ function iconBuild(options, callback) { return; } - pngToIcns(options.icon, (error, icnsPath) => { + convertToIcns(options.icon, (error, icnsPath) => { options.icon = icnsPath; if (error) { console.warn('Skipping icon conversion from `.png` to `.icns`: ', error); diff --git a/src/helpers/pngToIcns.js b/src/helpers/convertToIcns.js similarity index 86% rename from src/helpers/pngToIcns.js rename to src/helpers/convertToIcns.js index 839fc18..09bea58 100644 --- a/src/helpers/pngToIcns.js +++ b/src/helpers/convertToIcns.js @@ -5,7 +5,7 @@ import helpers from './helpers'; const isOSX = helpers.isOSX; tmp.setGracefulCleanup(); -const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/pngToIcns'); +const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/convertToIcns'); /** * @callback pngToIcnsCallback @@ -19,7 +19,7 @@ const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/pngToIcns'); * @param {string} icnsDest * @param {pngToIcnsCallback} callback */ -function pngToIcns(pngSrc, icnsDest, callback) { +function convertToIcns(pngSrc, icnsDest, callback) { if (!isOSX()) { callback('OSX is required to convert .png to .icns icon', pngSrc); return; @@ -48,10 +48,10 @@ function pngToIcns(pngSrc, icnsDest, callback) { * @param {string} pngSrc * @param {pngToIcnsCallback} callback */ -function pngToIcnsTmp(pngSrc, callback) { +function convertToIcnsTmp(pngSrc, callback) { const tempIconDirObj = tmp.dirSync({unsafeCleanup: true}); const tempIconDirPath = tempIconDirObj.name; - pngToIcns(pngSrc, `${tempIconDirPath}/icon.icns`, callback); + convertToIcns(pngSrc, `${tempIconDirPath}/icon.icns`, callback); } -export default pngToIcnsTmp; +export default convertToIcnsTmp; diff --git a/test/module/getIcon-spec.js b/test/module/getIcon-spec.js index 22bcc3c..e773d07 100644 --- a/test/module/getIcon-spec.js +++ b/test/module/getIcon-spec.js @@ -5,14 +5,14 @@ import chai from 'chai'; import fs from 'fs'; import os from 'os'; import path from 'path'; -import pngToIcns from './../../lib/helpers/pngToIcns'; +import convertToIcns from './../../lib/helpers/convertToIcns'; let assert = chai.assert; // Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert function testConvertPng(pngName, done) { - pngToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => { + convertToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => { if (error) { done(error); return;