Skip to content

Commit

Permalink
rename bin_path to command_path
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Apr 15, 2024
1 parent 6ca2880 commit 17bd4f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/main/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const preferences = new ElectronPreferences({
options: [{ label: "Enabled", value: "yes" }],
},
{
label: "Synvert ruby bin path",
key: "bin_path",
label: "Synvert ruby command path",
key: "command_path",
type: "text",
},
{
Expand Down Expand Up @@ -71,8 +71,8 @@ const preferences = new ElectronPreferences({
options: [{ label: "Enabled", value: "yes" }],
},
{
label: "Synvert javascript bin path",
key: "bin_path",
label: "Synvert javascript command path",
key: "command_path",
type: "text",
},
{
Expand Down
20 changes: 10 additions & 10 deletions src/renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ import {
scssMaxFileSize,
showMessage,
showErrorMessageWithAction,
rubyBinPath,
javascriptBinPath,
rubyCommandPath,
javascriptCommandPath,
} from "./utils";

const runCommand = async (command, args, { input } = {}) => {
Expand Down Expand Up @@ -111,8 +111,8 @@ const checkRuby = async () => {
if (!rubyEnabled()) {
return;
}
const binPath = rubyBinPath();
const response = await checkRubyDependencies({ runCommand, binPath });
const commandPath = rubyCommandPath();
const response = await checkRubyDependencies({ runCommand, commandPath });
switch (response.code) {
case DependencyResponse.ERROR:
showMessage(`Error when checking synvert-ruby environment: ${response.error}`);
Expand Down Expand Up @@ -151,8 +151,8 @@ const checkJavascript = async () => {
) {
return;
}
const binPath = javascriptBinPath();
const response = await checkJavascriptDependencies({ runCommand, binPath });
const commandPath = javascriptCommandPath();
const response = await checkJavascriptDependencies({ runCommand, commandPath });
switch (response.code) {
case DependencyResponse.ERROR:
showMessage(`Error when checking synvert-javascript environment: ${response.error}`);
Expand Down Expand Up @@ -198,7 +198,7 @@ const testSnippet = async (event) => {
} = event;
const additionalArgs = buildAdditionalCommandArgs(language);
const synvertCommand = language === "ruby" ? runSynvertRuby : runSynvertJavascript;
const binPath = language === "ruby" ? rubyBinPath() : javascriptBinPath();
const commandPath = language === "ruby" ? rubyCommandPath() : javascriptCommandPath();
const { output, error } = await synvertCommand({
runCommand,
executeCommand: "test",
Expand All @@ -207,7 +207,7 @@ const testSnippet = async (event) => {
skipPaths,
additionalArgs,
snippetCode,
binPath,
commandPath,
});
if (error) {
triggerEvent(EVENT_SNIPPET_TESTED, { error });
Expand Down Expand Up @@ -236,7 +236,7 @@ const runSnippet = async (event) => {
} = event;
const additionalArgs = buildAdditionalCommandArgs(language);
const synvertCommand = language === "ruby" ? runSynvertRuby : runSynvertJavascript;
const binPath = language === "ruby" ? rubyBinPath() : javascriptBinPath();
const commandPath = language === "ruby" ? rubyCommandPath() : javascriptCommandPath();
const { output, error } = await synvertCommand({
runCommand,
executeCommand: "run",
Expand All @@ -245,7 +245,7 @@ const runSnippet = async (event) => {
skipPaths,
additionalArgs,
snippetCode,
binPath,
commandPath,
});
if (error) {
triggerEvent(EVENT_SNIPPET_RUN, { error });
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const CUSTOM = "custom";
export const DEFAULT_VALUES = {
ruby: {
enabled: ["yes"],
bin_path: "",
command_path: "",
number_of_workers: 4,
single_quote: ["yes"],
tab_width: 2,
},
javascript: {
enabled: ["yes"],
command_path: "",
max_file_size: 100,
single_quote: ["no"],
semi: ["yes"],
Expand Down Expand Up @@ -68,12 +69,12 @@ export const saveInited = (inited) => savePreference(CUSTOM, "inited", inited);
export const getInited = () => getPreference(CUSTOM, "inited");

export const rubyEnabled = () => getPreference("ruby", "enabled").includes("yes");
export const rubyBinPath = () => getPreference("ruby", "bin_path");
export const rubyCommandPath = () => getPreference("ruby", "command_path");
export const rubyNumberOfWorkers = () => getPreference("ruby", "number_of_workers");
export const rubySingleQuote = () => getPreference("ruby", "single_quote").includes("yes");
export const rubyTabWidth = () => getPreference("ruby", "tab_width");
export const javascriptEnabled = () => getPreference("javascript", "enabled").includes("yes");
export const javascriptBinPath = () => getPreference("javascript", "bin_path");
export const javascriptCommandPath = () => getPreference("javascript", "command_path");
export const javascriptMaxFileSize = () => getPreference("javascript", "max_file_size");
export const javascriptSingleQuote = () => getPreference("javascript", "single_quote").includes("yes");
export const javascriptSemi = () => getPreference("javascript", "semi").includes("yes");
Expand Down

0 comments on commit 17bd4f9

Please sign in to comment.