Skip to content

Commit

Permalink
パッケージを整理して、Windowsインストーラーのファイルを追加 #178
Browse files Browse the repository at this point in the history
  • Loading branch information
kujirahand committed Feb 5, 2018
1 parent 46808fe commit 50c281e
Show file tree
Hide file tree
Showing 9 changed files with 438 additions and 873 deletions.
8 changes: 8 additions & 0 deletions bin/nako3-build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
SET ROOT_DIR=%~dp0\..
cd %ROOT_DIR%
call npm install
call npm run build
call npm start
pause

6 changes: 6 additions & 0 deletions bin/nako3server.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
SET ROOT_DIR=%~dp0\..
cd %ROOT_DIR%
call npm start
pause

9 changes: 9 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# インストーラー

## Windows

Inno Setup Compierを使って、バッチファイルを実行するだけのインストーラー。

## macOS

ターミナル上で実行。
16 changes: 12 additions & 4 deletions installer/install-win.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
rem=/* 日本語プログラミング言語「なでしこ」v3
@echo OFF
node %~0 %*
node "%~0" %*
IF "%ERRORLEVEL%"=="9009" (
ECHO ------------------------------------
ECHO なでしこ3 Windows向けインストーラー
ECHO ------------------------------------
ECHO [エラーの理由]
ECHO ------------------------------------
Expand All @@ -21,18 +19,28 @@ IF "%ERRORLEVEL%"=="9009" (
// --------------------------------------------
// ここから Node.js のプログラム
// --------------------------------------------
const VERSION = "3.0.21"
const fs = require('fs')
const execSync = require('child_process').execSync
try {
// インストールされているかチェック
const cnakoVersion = execSync('cnako3 -v').toString()
let cnakoVersion = execSync('cnako3 -v').toString()
if (cnakoVersion !== VERSION) {
console.log("UPDATE")
execSync('CALL npm -g update nadesiko3')
cnakoVersion = execSync('cnako3 -v').toString()
}
console.log("INSTALLED version=", cnakoVersion)
} catch (e) {
// console.log(e);
console.log("INSTALL NADESIKO3 --- Please wait a moment")
const result = execSync('CALL npm -g install nadesiko3');
console.log(result.toString());
}
// なでしこインストールディレクトリを見る
const root = execSync('npm -g root').toString()
const nadesiko = root + "\\nadesiko3"
execSync(nadesiko + "\\bin\\nako3-build.bat")
console.log("ok.");


Expand Down
47 changes: 47 additions & 0 deletions installer/install-win.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "日本語プログラミング言語なでしこ3"
#define MyAppDir "nadesiko-lang3"
#define MyAppVersion "3.0.21"
#define MyAppPublisher "nadesi.com"
#define MyAppURL "https://nadesi.com/"
#define MyAppExeName "install-win.bat"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A94C1E50-31C0-4875-93EB-4D508E3C3605}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppDir}
DisableProgramGroupPage=yes
OutputBaseFilename=setup{#MyAppVersion}
Compression=lzma
SolidCompression=yes

[Languages]
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: ".\install-win.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\start-win.bat"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppDir}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commonprograms}\エディタを実行"; Filename: "{app}\start-win.bat"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

39 changes: 39 additions & 0 deletions installer/start-win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
rem=/* 日本語プログラミング言語「なでしこ」v3
@echo OFF
node "%~0" %*
IF "%ERRORLEVEL%"=="9009" (
ECHO ------------------------------------
ECHO [エラーの理由]
ECHO ------------------------------------
ECHO なでしこ3をローカルで実行するには Node.js が必要です。
ECHO 下記のWebサイトからインストールしてください。
ECHO [URL] https://nodejs.org
ECHO インストール後、改めて、このバッチファイルを実行してください。
PAUSE
EXIT
) ELSE (
PAUSE
EXIT
)
*/0;
// --------------------------------------------
// ここから Node.js のプログラム
// --------------------------------------------
const VERSION = "3.0.21"
const fs = require('fs')
const execSync = require('child_process').execSync

// なでしこインストールディレクトリを見る
const root = execSync('npm -g root').toString()
const nadesiko = root + "\\nadesiko3"
execSync(nadesiko + "\\bin\\nako3-server.bat")
console.log("ok.");









Loading

0 comments on commit 50c281e

Please sign in to comment.