提交 87356a44 编写于 作者: C Corey Butler

Now using goxc for build process.

上级 af6827bc
@echo off
SET INNOSETUP=%CD%\nvm.iss
SET ORIG=%CD%
SET GOPATH=%CD%\src
SET GOBIN=%CD%\bin
SET GOARCH=386
REM Get the version number from the setup file
for /f "tokens=*" %%i in ('findstr /n . %INNOSETUP% ^| findstr ^4:#define') do set L=%%i
set version=%L:~24,-1%
REM Get the version number from the core executable
for /f "tokens=*" %%i in ('findstr /n . %GOPATH%\nvm.go ^| findstr ^NvmVersion^| findstr ^21^') do set L=%%i
set goversion=%L:~19,-1%
IF NOT %version%==%goversion% GOTO VERSIONMISMATCH
SET DIST=%CD%\dist\%version%
REM Build the executable
echo Building NVM for Windows
SET DIST=%CD%\dist\%version%
SET GOPATH=%CD%\src
SET GOBIN=%CD%\bin
SET GOARCH=386
go build -o %GOBIN%\nvm.exe %GOPATH%\nvm.go
rm %GOBIN%\nvm.exe
cd %GOPATH%
goxc -arch="386" -os="windows" -n="nvm" -d="%GOBIN%" -o="%GOBIN%\nvm{{.Ext}}" -tasks-=package
cd %ORIG%
rm %GOBIN%\src.exe
rm %GOPATH%\src.exe
rm %GOPATH%\nvm.exe
REM Clean the dist directory
rm -rf "%DIST%"
mkdir "%DIST%"
REM Create the "noinstall" zip
echo Generating nvm-noinstall.zip
......@@ -22,8 +40,15 @@ echo Generating nvm-setup.zip
buildtools\iscc %INNOSETUP% /o%DIST%
buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"
rm "%DIST%\nvm-setup.exe"
cls
echo --------------------------
echo Release %version% available in %DIST%
GOTO COMPLETE
:VERSIONMISMATCH
echo The version number in nvm.iss does not match the version in src\nvm.go
echo - nvm.iss line #4: %version%
echo - nvm.go line #21: %goversion%
EXIT /B
:COMPLETE
@echo on
#define MyAppName "NVM for Windows"
#define MyAppShortName "nvm"
#define MyAppLCShortName "nvm"
#define MyAppVersion "1.0.4"
#define MyAppVersion "1.0.5"
#define MyAppPublisher "Ecor Ventures, LLC"
#define MyAppURL "http://github.com/coreybutler/nvm"
#define MyAppExeName "nvm.exe"
......@@ -55,7 +55,7 @@ var
SymlinkPage: TInputDirWizardPage;
function IsDirEmpty(dir: string): Boolean;
var
var
FindRec: TFindRec;
ct: Integer;
begin
......@@ -73,8 +73,8 @@ begin
end;
end;
//function getInstalledVErsions(dir: string):
var
//function getInstalledVErsions(dir: string):
var
nodeInUse: string;
function TakeControl(np: string; nv: string): string;
......@@ -93,7 +93,7 @@ begin
StringChangeEx(path,np+';;',';',True);
RegWriteExpandStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', path);
RegQueryStringValue(HKEY_CURRENT_USER,
'Environment',
'Path', path);
......@@ -105,7 +105,7 @@ begin
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', path);
nodeInUse := ExpandConstant('{app}')+'\'+nv;
end;
function Ansi2String(AString:AnsiString):String;
......@@ -134,7 +134,7 @@ begin
// Create a file to check for Node.JS
TmpJS := ExpandConstant('{tmp}') + '\nvm_check.js';
SaveStringToFile(TmpJS, 'console.log(require("path").dirname(process.execPath));', False);
// Execute the node file and save the output temporarily
TmpResultFile := ExpandConstant('{tmp}') + '\nvm_node_check.txt';
Exec(ExpandConstant('{cmd}'), '/C node "'+TmpJS+'" > "' + TmpResultFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
......@@ -163,7 +163,7 @@ begin
TakeControl(NodePath, NodeVersion);
end;
end;
// Make sure the symlink directory doesn't exist
if DirExists(SymlinkPage.Values[0]) then begin
// If the directory is empty, just delete it since it will be recreated anyway.
......@@ -200,14 +200,14 @@ var
nvm_symlink: string;
begin
MsgBox('Removing NVM for Windows will remove the nvm command and all versions of node.js, including global npm modules.', mbInformation, MB_OK);
// Remove the symlink
RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'NVM_SYMLINK', nvm_symlink);
RemoveDir(nvm_symlink);
// Clean the registry
// Clean the registry
RegDeleteValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'NVM_HOME')
......@@ -228,9 +228,9 @@ begin
StringChangeEx(path,'%NVM_HOME%','',True);
StringChangeEx(path,'%NVM_SYMLINK%','',True);
StringChangeEx(path,';;',';',True);
RegWriteExpandStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', path);
RegQueryStringValue(HKEY_CURRENT_USER,
'Environment',
'Path', path);
......@@ -238,9 +238,9 @@ begin
StringChangeEx(path,'%NVM_HOME%','',True);
StringChangeEx(path,'%NVM_SYMLINK%','',True);
StringChangeEx(path,';;',';',True);
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', path);
Result := True;
end;
......@@ -249,7 +249,7 @@ procedure CurStepChanged(CurStep: TSetupStep);
var
path: string;
begin
if CurStep = ssPostInstall then
if CurStep = ssPostInstall then
begin
SaveStringToFile(ExpandConstant('{app}\settings.txt'), 'root: ' + ExpandConstant('{app}') + #13#10 + 'path: ' + SymlinkPage.Values[0] + #13#10, False);
......@@ -314,4 +314,4 @@ Type: files; Name: "{app}\elevate.cmd";
Type: files; Name: "{app}\elevate.vbs";
Type: files; Name: "{app}\nodejs.ico";
Type: files; Name: "{app}\settings.txt";
Type: filesandordirs; Name: "{app}";
\ No newline at end of file
Type: filesandordirs; Name: "{app}";
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册