-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] win,package: usefull file for packing and installing
- Loading branch information
Rudy Sicard
committed
Nov 22, 2012
1 parent
90577b2
commit 025e24d
Showing
5 changed files
with
357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Opa on Windows # | ||
|
||
|
||
## Overview ## | ||
|
||
Opa is a new generation of cloud development platform. It is a new programming | ||
language, a new web server, a new database and a new distributed execution | ||
engine, all of them tightly integrated to provide a great experience for cloud | ||
developers. | ||
|
||
## Mandatory Software | ||
|
||
There are mandatory softwares that a post-install script is currently helping you to install right now (see Need Help if not). | ||
|
||
0) MongoDb : Please follow the step-by-step installation | ||
(http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows) | ||
|
||
1) Nodejs : in order to use the nodejs backend, you must install nodejs (>= 0.8.1). | ||
Make sure that your NODE_PATH user environment variable contains %APPDATA%\npm\node_modules. | ||
For instance, do right click on "Computer" -> "Properties" -> "Advanced system parameter" -> "Environment variables" and then in user variable add NODE_PATH=%NODE_PATH%;%USERPROFILE%\AppData\[Roaming\]\npm\node_modules | ||
(http://nodejs.org/#download) | ||
|
||
## Recommended Editing Software | ||
|
||
We recommend the use of Sublime Text 2 to edit your Opa code. | ||
It is avalaible at http://www.sublimetext.com/ | ||
We provide a plugin with syntax hightlighting and build command for this editor. | ||
|
||
Syntax hightlighting mode are also provided for emacs and vim. | ||
(http://doc.opalang.org/#!/manual/Getting-Opa/Setting-up-your-editor). | ||
|
||
|
||
|
||
## First steps in Opa ? | ||
|
||
A mini-tutorial is included in Opa plugin for ST2. | ||
It will help you to write your first "Hello World" Opa Web server | ||
|
||
0) start ST2 | ||
|
||
1) open a new file with "opa" as extension, e.g. "hello.opa" | ||
|
||
2) write TUTORIAL_01, and use completion to expand to the tutorial instructions. | ||
|
||
3) Follow the magically appeared instructions | ||
|
||
|
||
|
||
## Need help ? | ||
|
||
0) To install automatically Opa modes, after installing Sublime Text 2 or emacs, | ||
or reinstall nodejs or mongodb, you can call the post-install script: | ||
|
||
[Start Menu -> Search on %OPABASEDIR%\share\opa\post_install.cmd] | ||
|
||
1) Documentation about opa can be found here: | ||
|
||
doc.opalang.org | ||
|
||
2) Questions can get answers quickly on our real-time forum: | ||
|
||
forum.opalang.org | ||
|
||
3) If you fall in love with Opa, following us can be your love declaration: | ||
|
||
https://lists.owasp.org/mailman/listinfo/opa | ||
https://twitter.com/opalang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
# -*- coding: utf-8 -*- | ||
!include "MUI2.nsh" | ||
#!include "FileAssociation.nsh" | ||
|
||
### Env variables | ||
|
||
!include "WordFunc.nsh" | ||
!define REG_ENVIRONMENT "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" | ||
!macro DualUseFunctions_ un_ | ||
function ${un_}SetPathVar | ||
# stack top: <'string to add'> / <AppendFlag> | ||
Exch $0 ; new string | ||
Exch | ||
Exch $1 ; append = 2, prefix = 1, remove = 0 | ||
Push $R0 ; saved working registers | ||
|
||
ReadRegStr $R0 HKLM "${REG_ENVIRONMENT}" "Path" | ||
|
||
${Select} $1 | ||
${Case} 0 | ||
${${un_}WordAdd} "$R0" ";" "-$0" $R0 | ||
${Case} 1 | ||
${${un_}WordAdd} "$0" ";" "+$R0" $R0 | ||
${Case} 2 | ||
${${un_}WordAdd} "$R0" ";" "+$0" $R0 | ||
${EndSelect} | ||
|
||
WriteRegExpandStr HKLM "${REG_ENVIRONMENT}" "Path" "$R0" | ||
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2' | ||
|
||
Pop $R0 ; restore registers | ||
Pop $1 | ||
Pop $0 | ||
functionEnd | ||
!macroend | ||
!insertmacro DualUseFunctions_ "" | ||
!insertmacro DualUseFunctions_ "un." | ||
|
||
### end env variables | ||
|
||
|
||
|
||
# General information | ||
!define PRODUCT_NAME "Opa" | ||
!define PRODUCT_PUBLISHER "MLstate" | ||
!define PRODUCT_WEB_SITE "http://www.opalang.org" | ||
!define PRODUCT_VERSION "0.9.0" | ||
|
||
|
||
# We support french and english | ||
!insertmacro MUI_LANGUAGE English | ||
!insertmacro MUI_LANGUAGE French | ||
|
||
LangString MsgPost ${LANG_ENGLISH} "Installation done.$\r$\nWould you like to view the README, verify dependencies and install syntax highlighting?$\r$\nYou can relaunch his operation later if needed ($INSTDIR\share\opa\post_install.cmd)" | ||
LangString MsgPost ${LANG_FRENCH} "Installation terminée.$\r$\nVoulez-vous lire le README, vérifier l'installation et installer la coloration syntaxique ?$\r$\nVous pouvez relancer cette operation plus tard si besoin ($INSTDIR\share\opa\post_install.cmd)" | ||
|
||
# post install script | ||
Function .onInstSuccess | ||
MessageBox MB_YESNO $(MsgPost) IDNO NoReadme | ||
Exec '"$INSTDIR\share\opa\post_install.cmd" "$INSTDIR"' | ||
NoReadme: | ||
FunctionEnd | ||
|
||
|
||
Name "${PRODUCT_NAME}" | ||
outFile "installer.exe" | ||
Icon bin\uninstall\opa_logo_72x72.ico | ||
CRCCheck on | ||
BrandingText "MLstate" | ||
|
||
InstallDir "C:\Dev\Opa" | ||
|
||
LangString MsgFolder ${LANG_ENGLISH} "Please, choose an installation folder (without symbols or spaces)." | ||
LangString MsgFolder ${LANG_FRENCH} "Veuillez choisir un répertoire d'intallation (sans symboles ou espaces)." | ||
|
||
DirText $(MsgFolder) | ||
|
||
# Include license | ||
LicenseLangString license ${LANG_ENGLISH} share/doc/opa/AGPL | ||
LicenseLangString license ${LANG_FRENCH} share/doc/opa/AGPL | ||
LicenseData $(license) | ||
|
||
LangString MsgLicense ${LANG_ENGLISH} "Please read and accept Opa license" | ||
LangString MsgLicense ${LANG_FRENCH} "Veuillez lire et accepter la licence d'utilisation d'Opa" | ||
LicenseText $(MsgLicense) | ||
|
||
#!define MUI_WELCOMEPAGE_TEXT "Hello!" | ||
#!define MUI_WELCOMEPAGE_TITLE "Title!" | ||
#!insertmacro MUI_PAGE_WELCOME | ||
|
||
!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\Opa" | ||
|
||
Page license | ||
Page directory | ||
Page components | ||
Page instfiles | ||
|
||
Section Opa | ||
DetailPrint "Opa" | ||
SectionIn RO | ||
|
||
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayName" "${PRODUCT_NAME}" | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "Publisher" "${PRODUCT_PUBLISHER}" | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayIcon" "$INSTDIR\bin\uninstall\opa_logo_72x72.ico" | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "UninstallString" "$INSTDIR\bin\uninstall\Uninstall.exe" | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayVersion" "1.0.7" | ||
WriteRegDWORD HKLM "${REG_UNINSTALL}" "EstimatedSize" "70000" | ||
WriteRegDWORD HKLM "${REG_UNINSTALL}" "NoModify" 1 | ||
WriteRegDWORD HKLM "${REG_UNINSTALL}" "NoRepair" 1 | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "InstallSource" "$INSTDIR\" | ||
WriteRegStr HKLM "${REG_UNINSTALL}" "InstallLocation" "$INSTDIR\" | ||
|
||
|
||
SetOutPath "$INSTDIR" | ||
#for i in $(ls -1d * | grep "/" | tr -d "/"); do echo file /r $i ; done to automate | ||
file /r bin | ||
file /r lib | ||
file /r share | ||
|
||
CreateDirectory "$SMPROGRAMS\Opa" | ||
CreateShortCut "$SMPROGRAMS\Opa\opa.lnk" "$INSTDIR\bin\opa.bat" | ||
CreateShortCut "$SMPROGRAMS\Opa\post_install.lnk" "$INSTDIR\share\opa\post_install.cmd" | ||
CreateShortCut "$SMPROGRAMS\Opa\README.lnk" "$INSTDIR\share\opa\READMEWIN.txt" | ||
|
||
|
||
writeUninstaller $INSTDIR\bin\uninstall\Uninstall.exe | ||
|
||
|
||
Push 1 ; prefix | ||
Push "$INSTDIR\bin" | ||
Call SetPathVar | ||
|
||
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' | ||
!define env_hku 'HKU ".DEFAULT\Environment"' | ||
!define env_hkcu 'HKCU "Environment"' | ||
WriteRegExpandStr ${env_hklm} "OPABASEDIR" "$INSTDIR" | ||
ReadRegStr $R0 ${env_hkcu} "NODE_PATH" | ||
WriteRegExpandStr ${env_hkcu} "NODE_PATH" "$R0;%USERPROFILE%\AppData\Roaming\npm\node_modules;$INSTDIR\lib\opa\stdlib;$INSTDIR\lib\opa\stdlib\stdlib.qmljs;$INSTDIR\lib\opa\static" | ||
|
||
# .js are launchable | ||
ReadRegStr $R0 ${env_hklm} "PATHEXT" | ||
WriteRegExpandStr ${env_hklm} "PATHEXT" "$R0;.JS" | ||
# using node | ||
# AppAssocReg::SetAppAsDefault "node.exe" assoc_name type | ||
# Pop $Var | ||
|
||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 | ||
|
||
SectionEnd | ||
|
||
#LangString MsgEx ${LANG_ENGLISH} "OPA Examples" | ||
#LangString MsgEx ${LANG_FRENCH} "Exemples OPA" | ||
|
||
#Section $(MsgEx) | ||
#SetOutPath "$INSTDIR" | ||
#file /r examples | ||
#SectionEnd | ||
|
||
|
||
section "Uninstall" | ||
|
||
ReadRegStr $0 HKLM "${REG_UNINSTALL}" "InstallSource" | ||
DeleteRegKey /ifempty HKLM "${REG_UNINSTALL}" | ||
|
||
Push 0 ; remove | ||
Push "$INSTDIR\bin" | ||
Call Un.SetPathVar | ||
|
||
# now delete installed files | ||
# for i in $(ls -1d * | grep "/" | tr -d "/"); do echo RMDir /r $i ; done TO AUTOMATE | ||
RMDir /r $0\bin | ||
RMDir /r $0\lib | ||
RMDir /r $0\share | ||
RMDir $0 | ||
|
||
RMDir /r "$SMPROGRAMS\Opa" | ||
|
||
sectionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
REM | ||
REM This scripts sets all needed env var before calling the compiler | ||
REM It assumes the package include everything (flexdll, mingw, libz, libcrypto, bash_nt, ...) | ||
REM | ||
@echo off | ||
|
||
REM Saving old values for external var | ||
set OLDPATH=%PATH% | ||
REM OCAML set OLDOCAMLLIB=%OCAMLLIB% | ||
|
||
REM BEGIN ENV VAR NEEDED BY THE COMPILER | ||
REM COMMON PATHS | ||
set OPABASEDIRLIB=%OPABASEDIR%\lib | ||
set OPABASEDIRMINGW=%OPABASEDIRLIB%\mingw | ||
REM OCAML set OPABASEDIROCAML=%OPABASEDIRLIB%\ocaml | ||
REM FINAL NEEDED VARS | ||
set MLSTATELIBS=%OPABASEDIR% | ||
REM OCAML set OCAMLLIB=%OPABASEDIROCAML%\lib | ||
REM OCAML set FLEXLINKFLAGS=-nocygpath -L %OPABASEDIRMINGW%\x86_64-w64-mingw32\lib -L %OPABASEDIRMINGW%\lib | ||
REM BE AWARE YOU CANNOT DOUBLE QUOTE %OPABASEDIRMINGW%\bin OTHERWISE GCC IS COMPLAINING ABOUT A MISSING LIB | ||
set PATH=%OPABASEDIR%\bin;%OPABASEDIRMINGW%\bin | ||
REM OCAML set PATH=%OPABASEDIR%\bin;%OPABASEDIRLIB%\flexdll;%OPABASEDIROCAML%\bin\;%OPABASEDIRMINGW%\bin | ||
|
||
REM CALLING THE COMPILER OR OTHER TOOLS | ||
if "%1"=="create" ( | ||
if "%2"=="" ( | ||
"%OPABASEDIR%\bin\opa-create.exe" | ||
) else ( | ||
"%OPABASEDIR%\bin\opa-create.exe" --name %2 | ||
) | ||
) else ( | ||
"%OPABASEDIR%\lib\opa\bin\opa-bin.exe" --no-color %* | ||
) | ||
|
||
REM Restoring old values | ||
set PATH=%OLDPATH% | ||
REM OCAML set OCAMLLIB=%OLDOCAMLLIB% |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
@echo off | ||
echo Hello! I am going to help you to install recommended software for Opa | ||
|
||
REM This scriptis run just after the install on Windows | ||
|
||
REM In case OPABASEDIR is not propagated yet, we use the first parameter if existing | ||
if NOT "%~1"=="" set OPABASEDIR=%~1 | ||
|
||
pause | ||
REM Showing some message to the user | ||
echo Have a look at the README, if needed | ||
start notepad "%OPABASEDIR%\share\opa\READMEWIN.txt" | ||
|
||
REM Detection Sublime in order to install the Opa package | ||
set SOPAMODE=Opa.sublime-package | ||
if exist "%APPDATA%\Sublime Text 2\" set SUBLIMEINSTALLED=%APPDATA%\Sublime Text 2\Installed Packages&goto :sublimeOK | ||
:sublimeKO | ||
echo Please, consider installing sublime http://www.sublimetext.com/ for a better Opa experience | ||
start http://www.sublimetext.com/ | ||
goto :afterSublime | ||
:sublimeOK | ||
echo Sublime Text has been found | ||
copy /Y "%OPABASEDIR%\share\opa\%SOPAMODE%" "%SUBLIMEINSTALLED%\" | ||
echo The Opa plugin for Sublime Text has been installed. | ||
:afterSublime | ||
|
||
:MongoDetect | ||
REM Mongo detection | ||
for %%X in (mongod.exe) do (set FOUNDMONGO=%%~$PATH:X) | ||
if defined FOUNDMONGO goto MongoOK | ||
:MongoKO | ||
echo MongoDb cannot be found, please install it. | ||
start http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows | ||
start http://www.mongodb.org/downloads | ||
goto :afterMongo | ||
:MongoOK | ||
echo MongoDb has been found | ||
:afterMongo | ||
|
||
|
||
:NodeDetect | ||
REM Node detection | ||
for %%X in (node.exe) do (set FOUNDNODE=%%~$PATH:X) | ||
if defined FOUNDNODE goto NodeOK | ||
:NodeKO | ||
echo Nodejs cannot be found, please install it. | ||
start http://nodejs.org/#download | ||
pause | ||
goto :NodeDetect | ||
:NodeOK | ||
echo Nodejs has been found | ||
echo Make node the default js interpreter | ||
ftype JSFILE="%FOUNDNODE%" %%1 %%* | ||
echo Installing plugins | ||
npm -g install mongodb nodemailer imap formidable | ||
REM iconv | ||
|
||
REM Vim & emacs | ||
REM vim/{ftdetect,syntax}/opa.vim | ||
REM vim/{ftdetect,syntax}/opa.vim | ||
REM if exists %HOME% then goto emacsOk | ||
REM :emacsKO | ||
REM goto :afterEmacs | ||
REM :emacsOk | ||
REM echo ; Opa Mode >> %DOTEMACS% | ||
REM echo (autoload 'opa-js-mode "%OPABASEDIR%\share\opa\emacs\opa-js-mode.el" "OPA JS editing mode." t) >> %DOTEMACS% | ||
REM echo (autoload 'opa-classic-mode "%OPABASEDIR%\share\opa\emacs\opa-mode.el" "OPA CLASSIC editing mode." t) >> %DOTEMACS% | ||
REM echo (add-to-list 'auto-mode-alist '("\\.opa$" . opa-js-mode)) ;; Set the default mode here >> %DOTEMACS% | ||
REM echo (add-to-list 'auto-mode-alist '("\\.js\\.opa$" . opa-js-mode)) >> %DOTEMACS% | ||
REM echo (add-to-list 'auto-mode-alist '("\\.classic\\.opa$" . opa-classic-mode)) >> %DOTEMACS% | ||
REM :afterEmacs | ||
|
||
REM Letting the user the time to read something | ||
echo "In case you need to call me, I am in menu [ Start -> Opa -> post-install.cmd ]" | ||
pause |