Skip to content

Commit

Permalink
chore: rename bin-wrapper to bin-wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 19, 2018
1 parent ca584fb commit deb77ad
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 56 deletions.
28 changes: 0 additions & 28 deletions __tests__/bin-wrapper.test.js

This file was deleted.

28 changes: 28 additions & 0 deletions __tests__/bin-wrappers.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";

const binWrappers = require("../src/bin-wrappers");
const binCheck = require("bin-check");

describe("bin wrapper instances", () => {
it("should work", () =>
Promise.all([
expect(binCheck(binWrappers.cjpeg.path(), ["-version"])).resolves.toBe(
true
),
expect(binCheck(binWrappers.djpeg.path(), ["-version"])).resolves.toBe(
true
),
expect(binCheck(binWrappers.jpegtran.path(), ["-version"])).resolves.toBe(
true
),
expect(binCheck(binWrappers.rdjpgcom.path(), ["-help"])).rejects.toThrow(
"rdjpgcom displays any textual comments in a JPEG file."
),
expect(
binCheck(binWrappers.tjbench.path(), ["-version"])
).rejects.toThrow("tjbench"),
expect(
binCheck(binWrappers.wrjpgcom.path(), ["-version"])
).rejects.toThrow("wrjpgcom inserts a textual comment in a JPEG file.")
]));
});
20 changes: 0 additions & 20 deletions src/bin-wrapper.js

This file was deleted.

22 changes: 22 additions & 0 deletions src/bin-wrappers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

const path = require("path");
const BinWrappers = require("bin-wrapper");

const dest = path.join(__dirname, "../vendor");
const isWin = process.platform === "win32";

module.exports = {
cjpeg: new BinWrappers().dest(dest).use(isWin ? "cjpeg.exe" : "cjpeg"),
djpeg: new BinWrappers().dest(dest).use(isWin ? "djpeg.exe" : "djpeg"),
jpegtran: new BinWrappers()
.dest(dest)
.use(isWin ? "jpegtran.exe" : "jpegtran"),
rdjpgcom: new BinWrappers()
.dest(dest)
.use(isWin ? "rdjpgcom.exe" : "rdjpgcom"),
tjbench: new BinWrappers().dest(dest).use(isWin ? "tjbench.exe" : "tjbench"),
wrjpgcom: new BinWrappers()
.dest(dest)
.use(isWin ? "wrjpgcom.exe" : "wrjpgcom")
};
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";

const binaries = require("./bin-wrapper");
const binWrappers = require("./bin-wrappers");

module.exports = {
cjpeg: binaries.cjpeg.path(),
djpeg: binaries.djpeg.path(),
jpegtran: binaries.jpegtran.path(),
rdjpgcom: binaries.rdjpgcom.path(),
tjbench: binaries.tjbench.path(),
wrjpgcom: binaries.wrjpgcom.path()
cjpeg: binWrappers.cjpeg.path(),
djpeg: binWrappers.djpeg.path(),
jpegtran: binWrappers.jpegtran.path(),
rdjpgcom: binWrappers.rdjpgcom.path(),
tjbench: binWrappers.tjbench.path(),
wrjpgcom: binWrappers.wrjpgcom.path()
};
2 changes: 1 addition & 1 deletion src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require("fs");
const os = require("os");
const binBuild = require("bin-build");
const PQueue = require("p-queue");
const binWrappers = require("./bin-wrapper");
const binWrappers = require("./bin-wrappers");

const buildCommands = () => {
const cpus = (os.cpus() || { length: 1 }).length;
Expand Down

0 comments on commit deb77ad

Please sign in to comment.