From fabaa416cedb059b9a3cd1c4ddfb6f074d43a9cf Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Tue, 8 Apr 2014 03:55:21 +0200 Subject: [PATCH] Windows installer v2.0 --- .../coco-dev-setup/batch/config/config.coco | 3 +- .../batch/config/downloads.coco | 1 - .../coco-dev-setup/batch/localisation/de.coco | 1 + .../coco-dev-setup/batch/localisation/en.coco | 1 + .../coco-dev-setup/batch/localisation/fr.coco | 1 + .../coco-dev-setup/batch/localisation/nl.coco | 1 + .../batch/localisation/zh-HANS.coco | 1 + .../batch/localisation/zh-HANT.coco | 1 + .../coco-dev-setup/batch/localisation/zh.coco | 1 + .../batch/scripts/configuration_cmd.bat | 4 + .../batch/scripts/get_local_text.bat | 2 +- .../batch/scripts/github_setup.bat | 4 +- .../batch/scripts/nab_automatic_script.bat | 7 + .../batch/scripts/nab_install_bower.bat | 7 + .../batch/scripts/nab_install_mongodb.bat | 35 ++ .../batch/scripts/nab_install_npm.bat | 6 + .../batch/scripts/nab_install_npm_all.bat | 7 + .../batch/scripts/nab_install_sass.bat | 7 + .../batch/scripts/npm_and_brunch_setup.bat | 83 +-- .../coco-dev-setup/batch/scripts/setup.bat | 43 +- .../coco-dev-setup/batch/scripts/setup_p2.bat | 47 ++ .../last_step_succesfull/config.coco | 6 - .../last_step_succesfull/downloads.coco | 24 - .../last_step_succesfull/en.coco | 53 -- .../last_step_succesfull/get_config.bat | 3 - .../last_step_succesfull/get_download.bat | 4 - .../last_step_succesfull/get_text.bat | 4 - .../last_step_succesfull/get_var.ps1 | 17 - .../last_step_succesfull/run_script.bat | 2 - .../coco-dev-setup/recycle_bin/dev-setup.bat | 533 ------------------ .../coco-dev-setup/recycle_bin/git-test.bat | 50 -- .../coco-dev-setup/src/get_category.cpp | 146 ----- .../coco-dev-setup/src/get_extension.cpp | 36 -- .../windows/coco-dev-setup/src/get_var.cpp | 108 ---- 34 files changed, 143 insertions(+), 1106 deletions(-) create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/configuration_cmd.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_automatic_script.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_install_bower.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_install_mongodb.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm_all.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/nab_install_sass.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/setup_p2.bat delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/config.coco delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/downloads.coco delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/en.coco delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/get_config.bat delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/get_download.bat delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/get_text.bat delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/get_var.ps1 delete mode 100755 scripts/windows/coco-dev-setup/last_step_succesfull/run_script.bat delete mode 100755 scripts/windows/coco-dev-setup/recycle_bin/dev-setup.bat delete mode 100755 scripts/windows/coco-dev-setup/recycle_bin/git-test.bat delete mode 100755 scripts/windows/coco-dev-setup/src/get_category.cpp delete mode 100755 scripts/windows/coco-dev-setup/src/get_extension.cpp delete mode 100755 scripts/windows/coco-dev-setup/src/get_var.cpp diff --git a/scripts/windows/coco-dev-setup/batch/config/config.coco b/scripts/windows/coco-dev-setup/batch/config/config.coco index eba46b0f4..ac09df64b 100755 --- a/scripts/windows/coco-dev-setup/batch/config/config.coco +++ b/scripts/windows/coco-dev-setup/batch/config/config.coco @@ -1,8 +1,9 @@ - 1.2 + 2.0 GlenDC CodeCombat.com 2013-2014 https://github.com/codecombat/codecombat.git git@github.com:codecombat/codecombat.git + http://23.21.59.137/dump.tar.gz \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/config/downloads.coco b/scripts/windows/coco-dev-setup/batch/config/downloads.coco index 771189954..e65d0f7ee 100755 --- a/scripts/windows/coco-dev-setup/batch/config/downloads.coco +++ b/scripts/windows/coco-dev-setup/batch/config/downloads.coco @@ -11,7 +11,6 @@ http://nodejs.org/dist/v0.10.25/x64/node-v0.10.25-x64.msi http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353-x64.exe?direct http://s3.amazonaws.com/CodeCombatLargeFiles/python-64.msi - http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe diff --git a/scripts/windows/coco-dev-setup/batch/localisation/de.coco b/scripts/windows/coco-dev-setup/batch/localisation/de.coco index fc257a64d..b84e9af30 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/de.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/de.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Don't close! Dieser Pfad existiert bereits. Willst du ihn wirklich überschreiben? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/en.coco b/scripts/windows/coco-dev-setup/batch/localisation/en.coco index 947890ee8..e1f0122b9 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/en.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/en.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Don't close! That path already exists, are you sure you want to overwrite it? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/fr.coco b/scripts/windows/coco-dev-setup/batch/localisation/fr.coco index 1c92b433c..064dbe7fa 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/fr.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/fr.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Don't close! That path already exists, are you sure you want to overwrite it? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco index 654d45c97..0f815b928 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Niet sluiten! Dat pad bestaat al, ben je zeker dat je het wil overschrijven? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco index 9ce100631..c0d46727e 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco @@ -61,6 +61,7 @@ 正在为你设置 MongoDB 数据库... 正在下载 CodeCombat 数据库的最新版本... + Don't close! 这个路径已经存在, 你想要覆盖它吗? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco index 93bcefd87..d9d459ef9 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Don't close! That path already exists, are you sure you want to overwrite it? diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh.coco index b84d84146..22f9c3914 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/zh.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh.coco @@ -61,6 +61,7 @@ Setting up a MongoDB database for you... Downloading the last version of the CodeCombat database... + Don't close! That path already exists, are you sure you want to overwrite it? diff --git a/scripts/windows/coco-dev-setup/batch/scripts/configuration_cmd.bat b/scripts/windows/coco-dev-setup/batch/scripts/configuration_cmd.bat new file mode 100755 index 000000000..3c614e671 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/configuration_cmd.bat @@ -0,0 +1,4 @@ +Color 0A +mode con: cols=79 lines=55 + +TITLE CodeCombat.com - Development Environment Installation \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_local_text.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_local_text.bat index 9a54a78c5..aae9bf110 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_local_text.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_local_text.bat @@ -1 +1 @@ -call get_text !language_id! %1 %2 %3 %4 %5 \ No newline at end of file +call get_text %language_id% %1 %2 %3 %4 %5 \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat b/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat index e9add16ca..a2a76f6de 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat @@ -99,13 +99,13 @@ goto:eof :git_checkout md "%repository_path%" - set "repository_path=%repository_path%\coco" + set "repository_path=%repository_path%" call print_dashed_seperator set "git_app_path=%git_bash_path%\bin\git.exe" call get_config github_url - "%git_app_path%" clone "!github_url!" "%repository_path%" + "%git_app_path%" clone "!github_url!" "%repository_path%\coco" goto:exit_git_setup goto:eof diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_automatic_script.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_automatic_script.bat new file mode 100755 index 000000000..df06f23fb --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_automatic_script.bat @@ -0,0 +1,7 @@ +call print_dashed_seperator +call get_local_text npm_script npm script +echo %npm_script% + +echo start cmd.exe cmd /c "TITLE CodeCombat.com - nodemon server & call nodemon -w server -w server_config.js">%~1\SCOCODE.bat +echo start cmd.exe cmd /c "TITLE CodeCombat.com - brunch - live compiler & call brunch w">>%~1\SCOCODE.bat +echo TITLE CodeCombat.com - mongodb database & mongod --setParameter textSearchEnabled=true --dbpath %~2>>%~1\SCOCODE.bat \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_install_bower.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_bower.bat new file mode 100755 index 000000000..283d5e522 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_bower.bat @@ -0,0 +1,7 @@ +call print_dashed_seperator +call get_local_text npm_binstall npm binstall +echo %npm_binstall% + +cd /D %~1 +start /wait cmd /c "echo %npm_binstall% & bower cache clean & bower install" +cd /D %work_directory% \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_install_mongodb.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_mongodb.bat new file mode 100755 index 000000000..8f22c4dee --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_mongodb.bat @@ -0,0 +1,35 @@ +call print_dashed_seperator +call get_local_text npm_mongodb npm mongodb +echo %npm_mongodb% + +if exist %~1 ( + rmdir /s /q %~1 +) + +md %~1 + +call print_dashed_seperator +call get_local_text npm_db npm db +echo %npm_db% + +call get_config database_backup + +call get_local_text npm_close npm close + +cd /D %~1 + +start cmd /c "TITLE MongoDB - %npm_close% & mongod --setParameter textSearchEnabled=true --dbpath %~1" + +%work_directory%\%curl_app% -k %database_backup% -o dump.tar.gz + +start /wait cmd /c "%work_directory%\%zu_app% e dump.tar.gz && del dump.tar.gz && %work_directory%\%zu_app% x dump.tar && del dump.tar" + +start /wait cmd /c "mongorestore dump" + +rmdir /s /q dump + +call %work_directory%\print_dashed_seperator + +taskkill /F /fi "IMAGENAME eq mongod.exe" + +cd /D %work_directory% \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm.bat new file mode 100755 index 000000000..6c6e5d3c2 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm.bat @@ -0,0 +1,6 @@ +call get_local_text npm_install npm install +echo %npm_install% + +cd /D %~1 +start /wait cmd /c "echo %npm_install% & npm install -g bower brunch nodemon sendwithus" +cd /D %work_directory% \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm_all.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm_all.bat new file mode 100755 index 000000000..cb858c029 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_npm_all.bat @@ -0,0 +1,7 @@ +call print_dashed_seperator +call get_local_text npm_npm npm npm +echo %npm_npm% + +cd /D %~1 +start /wait cmd /c "echo %npm_npm% & npm install" +cd /D %work_directory% \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/nab_install_sass.bat b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_sass.bat new file mode 100755 index 000000000..6cece7ced --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/nab_install_sass.bat @@ -0,0 +1,7 @@ +call print_dashed_seperator +call get_local_text npm_sass npm sass +echo %npm_sass% + +cd /D %~1 +start /wait cmd /c "echo %npm_sass% & gem install sass" +cd /D %work_directory% \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/npm_and_brunch_setup.bat b/scripts/windows/coco-dev-setup/batch/scripts/npm_and_brunch_setup.bat index ae3572b36..f04beaed5 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/npm_and_brunch_setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/npm_and_brunch_setup.bat @@ -5,85 +5,20 @@ set work_directory=%CD% set "curl_app=..\utilities\curl.exe" set "zu_app=..\utilities\7za.exe" -set "keystuff=..\utilities\keystuff.exe" -set "coco_root=!repository_path!\coco" +set coco_root=%repository_path%\coco +set coco_db=%repository_path%\cocodb -goto:automatic_script +call nab_install_npm %coco_root% -call get_local_text npm-install -echo !npm_install! +call nab_install_bower %coco_root% -cd !coco_root! -start /wait cmd /c "echo !npm_install! & npm install -g bower brunch nodemon sendwithus" -cd !work_directory! +call nab_install_sass %coco_root% -call print_dashed_seperator -call get_local_text npm-binstall -echo !npm_binstall! +call nab_install_npm_all %coco_root% -cd "!coco_root!" -start /wait cmd /c "echo !npm_binstall! & bower install" -cd "!work_directory!" +call nab_install_mongodb %coco_db% -call print_dashed_seperator -call get_local_text npm-sass -echo !npm_sass! +call nab_automatic_script.bat %coco_root% %coco_db% -cd "!coco_root!" -start /wait cmd /c "echo !npm_sass! & gem install sass" -cd "!work_directory!" - -call print_dashed_seperator -call get_local_text npm-npm -echo !npm_npm! - -cd "!coco_root!" -start /wait cmd /c "echo !npm_npm! & npm install" -cd "!work_directory!" - -:: --- MONGODB - -:mongodb -call print_dashed_seperator -call get_local_text npm-mongodb -echo !npm_mongodb! - -set "mdb_directory=!repository_path!\cocodb" - -if exist mdb_directory ( - rmdir /s /q "!mdb_directory!" -) - -md !mdb_directory! - -call print_dashed_seperator -call get_local_text npm-db -echo !npm_db! - -call get_config database_backup - -cd !mdb_directory! - -start cmd /c "%work_directory%\%keystuff% Alt-Tab && mongod --setParameter textSearchEnabled=true --dbpath !mdb_directory!" - -%curl_app% -k !database_backup! -o dump.tar.gz - -start /wait cmd /c "%work_directory%\%keystuff% Alt-Tab && %zu_app% e dump.tar.gz && del dump.tar.gz && %zu_app% x dump.tar && del dump.tar" - -start /wait cmd /c "mongorestore dump" - -rmdir /s /q db - -:: --- AUTOMATIC SCRIPT - -::automatic_script -call print_dashed_seperator -call get_local_text npm-script -echo !npm_script! - -:: --- END - -call print_dashed_seperator - -pause \ No newline at end of file +call print_dashed_seperator \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/setup.bat b/scripts/windows/coco-dev-setup/batch/scripts/setup.bat index 7c137563f..9ac1c55df 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/setup.bat @@ -1,8 +1,7 @@ @echo off setlocal EnableDelayedExpansion -Color 0A -mode con: cols=79 lines=55 +call configuration_cmd call print_header call print_dashed_seperator @@ -24,44 +23,6 @@ call get_language call download_and_install_applications -call github_setup - -:: This will be available in v2.0 -::call npm_and_brunch_setup - -call print_finished_header -call print_dashed_seperator - -call get_local_text end_succesfull end succesfull -call get_local_text end_thankyou end thankyou -echo %end_succesfull% -echo %end_thankyou% - -call print_dashed_seperator - -call get_local_text start_s1 start s1 -call get_local_text start_s2 start s2 -call get_local_text start_s3 start s3 -call get_local_text start_s4 start s4 -call get_local_text start_s5 start s5 -call get_local_text start_s6 start s6 - -echo !start_s1! -echo !start_s2! -echo. -echo !start_s3! '!repository_path!\coco\SCOCODE.bat' -echo !start_s4! -echo !start_s5! -echo. -echo !start_s6! - -call print_dashed_seperator - -call get_local_text end_readme end readme -call ask_question "!end_readme!" - -if "%result%"=="true" ( - call open_readme -) +start cmd /c "setup_p2.bat" endlocal \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/setup_p2.bat b/scripts/windows/coco-dev-setup/batch/scripts/setup_p2.bat new file mode 100755 index 000000000..cbd358212 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/setup_p2.bat @@ -0,0 +1,47 @@ +@echo off +setlocal EnableDelayedExpansion + +call configuration_cmd + +call github_setup + +call npm_and_brunch_setup + +call print_finished_header +call print_dashed_seperator + +call get_local_text end_succesfull end succesfull +call get_local_text end_thankyou end thankyou +echo %end_succesfull% +echo %end_thankyou% + +call print_dashed_seperator + +call get_local_text start_s1 start s1 +call get_local_text start_s2 start s2 +call get_local_text start_s3 start s3 +call get_local_text start_s4 start s4 +call get_local_text start_s5 start s5 +call get_local_text start_s6 start s6 + +echo !start_s1! +echo !start_s2! +echo. +echo !start_s3! '!repository_path!\coco\SCOCODE.bat' +echo !start_s4! +echo !start_s5! +echo. +echo !start_s6! + +call print_dashed_seperator + +call get_local_text end_readme end readme +call ask_question "!end_readme!" + +if "%result%"=="true" ( + call open_readme +) + +exit + +endlocal \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/config.coco b/scripts/windows/coco-dev-setup/last_step_succesfull/config.coco deleted file mode 100755 index ae8c66f56..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/config.coco +++ /dev/null @@ -1,6 +0,0 @@ - - - 1.0 - GlenDC - CodeCombat.com 2013-2014 - \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/downloads.coco b/scripts/windows/coco-dev-setup/last_step_succesfull/downloads.coco deleted file mode 100755 index 2a0472c41..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/downloads.coco +++ /dev/null @@ -1,24 +0,0 @@ - - - - - http://nodejs.org/dist/v0.10.25/node-v0.10.25-x86.msi - http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct - http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi - - - http://nodejs.org/dist/v0.10.25/x64/node-v0.10.25-x64.msi - http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353-x64.exe?direct - http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi - - https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe - - - mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip - mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip - - - mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip - mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.5.4.zip - - \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/en.coco b/scripts/windows/coco-dev-setup/last_step_succesfull/en.coco deleted file mode 100755 index a2e1f9fca..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/en.coco +++ /dev/null @@ -1,53 +0,0 @@ - - - - English - Bye Bye! - - - Installation has begun, this can take a while... Please stay tuned... - Don't close any windows please, unless specified explicitly. - - - [DOWNLOADING AND INSTALLING 3RD PARTY SOFTWARE] - downloading: - installing: - Download and Installation cancelled... - Software has been installed... - Installation of the Developers Environment is complete! - Installation has been stopped... - unpacking and moving: - Installing bower, brunch, nodemon and sendwithus... - - - CodeCombat is safely stored on a git repository. - Therefore you need a git command-line application (Git-bash). - Examples: git-bash, CygWin, ... - Do you already have git-bash? - Enter the path to where you installed Git-bash - Checking out the Git Repository... - Please enter your github username: - - - Do you already have the latest version of node-js installed? - Please enter the full path of the location you installed nodejs to: - - - Do you already have the latest version of ruby installed? - - - Do you already have the latest version of mongo-db installed? - Enter the path where you would like to install MongoDB: - - - Do you already have the latest version of python installed? - - - Sadly we can't support Windows XP... Please upgrade your OS! - Machine OS cannot be determined... - Report your OS to the developers @ CodeCombat.com... - ... Cleaning up has been disabled... Terminating Script! - The path to your git application is incorrect, please try again... - The path you entered is invalid, please try again... - - \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/get_config.bat b/scripts/windows/coco-dev-setup/last_step_succesfull/get_config.bat deleted file mode 100755 index 3849e22c2..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/get_config.bat +++ /dev/null @@ -1,3 +0,0 @@ -powershell .\get_var.ps1 config.coco %1 > var.tmp -set /p %1= < var.tmp -del /q var.tmp \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/get_download.bat b/scripts/windows/coco-dev-setup/last_step_succesfull/get_download.bat deleted file mode 100755 index fde3799e3..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/get_download.bat +++ /dev/null @@ -1,4 +0,0 @@ -@ECHO off -powershell .\get_var.ps1 downloads.coco %2 %3 %4 %5 %6 > var.tmp -set /p %1= < var.tmp -del /q var.tmp \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/get_text.bat b/scripts/windows/coco-dev-setup/last_step_succesfull/get_text.bat deleted file mode 100755 index 5cae1d431..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/get_text.bat +++ /dev/null @@ -1,4 +0,0 @@ -@ECHO off -powershell .\get_var.ps1 %1.coco %3 %4 %5 %6 %7 > var.tmp -set /p %2= < var.tmp -del /q var.tmp \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/get_var.ps1 b/scripts/windows/coco-dev-setup/last_step_succesfull/get_var.ps1 deleted file mode 100755 index 77573929f..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/get_var.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$xml_file = [xml](get-content $args[0]) -if($args.count -eq 2) -{ - $xml_file.variables.($args[1]) -} -elseif($args.count -eq 3) -{ - $xml_file.variables.($args[1]).($args[2]) -} -elseif($args.count -eq 4) -{ - $xml_file.variables.($args[1]).($args[2]).($args[3]) -} -elseif($args.count -eq 5) -{ - $xml_file.variables.($args[1]).($args[2]).($args[3]).($args[4]) -} \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/last_step_succesfull/run_script.bat b/scripts/windows/coco-dev-setup/last_step_succesfull/run_script.bat deleted file mode 100755 index dfc6e6cc0..000000000 --- a/scripts/windows/coco-dev-setup/last_step_succesfull/run_script.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell "& "%*" \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/recycle_bin/dev-setup.bat b/scripts/windows/coco-dev-setup/recycle_bin/dev-setup.bat deleted file mode 100755 index 97e7d1ee2..000000000 --- a/scripts/windows/coco-dev-setup/recycle_bin/dev-setup.bat +++ /dev/null @@ -1,533 +0,0 @@ -@echo off -setlocal EnableDelayedExpansion - -Color 0A - -mode con: cols=78 lines=60 - -:: Global Variables -set "temp-dir=C:\Coco-Temp" -set install-log=%temp-dir%\coco-dev-install-log.txt - -:: set correct curl app -IF EXIST "%PROGRAMFILES(X86)%" ( - (set "curl-app=utilities\curl\64bit\curl.exe") -) ELSE ( - set "curl-app=utilities\curl\32bit\curl.exe" -) - -set "ZU-app=utilities\7za.exe" - -:: BUGS: - :: + DEBUG ALL STEPS UNTILL NOW DONE - - -:: TODO: -:: + Write code to install vs if it's not yet installed on users pc - -:: + Configuraton and installation checklist: -:: 1) cd codecombat -:: 2) npm install -g bower brunch nodemon sendwithus -:: 3) bower install -:: 4) gem install sass -:: 5) npm install -:: 6) brunch -w -:: Extra... @ Fail run npm install - -:: + Copy the automated dev batch file to root folder -:: => Let user define mongo-db directory -:: + Start the dev environment - -:: Create The Temporary Directory -IF EXIST %temp-dir% rmdir %temp-dir% /s /q -mkdir %temp-dir% - -:: Create Log File -copy /y nul %install-log% > nul - -call:parse_aa_and_draw "config\header" -call:draw_dss - -call:parse_file_new "config\config" cnfg n - -call:log "Welcome to the automated Installation of the CodeCombat Dev. Environment!" -call:log_sse "v%%cnfg[1]%% authored by %%cnfg[2]%% and published by %%cnfg[3]%%." - -:: Language Agreement Stuff - -call:log "In order to continue the installation of the developers environment" -call:log "you will have to read and agree with the following license: -call:draw_dss -echo. -call:parse_aa_and_draw "license.txt" -echo. -call:draw_dss -call:strict_user_yn_question "Have you read the license and do you agree with it?" - -if "%res%"=="false" ( - call:log "Sorry to hear that, have a good day..." - call:log_sse "Installation and Setup of the CodeCombat environment is cancelled." - GOTO:END -) - -:: Tips -call:log "Before we start the installation, here are some tips:" -echo. - -call:parse_aa_and_draw "config\tips" - -call:draw_ss - -:: Read Language Index -call:parse_file_new "localisation\languages" lang lang_c - -:: Read Download URLs -call:parse_file_new "config\downloads" downloads n -call:parse_file_new "config\downloads_32" downloads_32 n -call:parse_file_new "config\downloads_64" downloads_64 n -call:parse_file_new "config\downloads_vista_32" downloads_vista_32 n -call:parse_file_new "config\downloads_vista_64" downloads_vista_64 n -call:parse_file_new "config\downloads_7_32" downloads_7_32 n -call:parse_file_new "config\downloads_7_64" downloads_7_64 n - -:: Parse all Localisation Files -for /L %%i in (1,1,%lang_c%) do ( - call:parse_file "localisation\%%lang[%%i]%%" languages languages_c -) - -set /A "wc = %languages_c% / %lang_c%" - -:: Start install with language question (Localisation) -call:log "Which language do you prefer?" - -set /A c=0 -for /L %%i in (1,%wc%,%languages_c%) do ( - set /A "n = %%i - 1" - call:log " [%%c%%] %%languages[%%i]%%" - set /A c+=1 -) - -set "lang_id=-1" -call:user_enter_language_id -goto:user_pick_language - -:user_enter_language_id - set /p lang_id= "Enter the language ID and press : " -goto:eof - -:user_pick_language - set res=false - if %lang_id% LSS 0 set res=true - if %lang_id% GEQ %lang_c% set res=true - if "%res%"=="true" ( - call:log "Invalid id! Please enter a correct id from the numbers listed above..." - call:draw_dss - call:user_enter_language_id - goto:user_pick_language - ) - -call:get_lw word 0 -call:log_ds "You choose '%word%', from now on all feedback will be logged in it." - -call:log_lw 1 -call:log_lw_sse 2 - -:: downloads for all version... - -:: [TODO] The choice between Cygwin && Git ?! Is => HAVE EXTERNAL GIT APPLICATION LIST!!! - -call:log_lw_sse 3 - -call:log_lw 6 -call:log_lw 7 -call:log_lw 8 -call:install_software_o "git" "%%downloads[1]%%" exe 9 -call:draw_dss -call:get_lw word 11 - -:: [TODO] Add downloads for windows visual studio ?! - -call:user_set_git_path - -:user_set_git_path_fail - if not exist "%git_exe_path%" ( - call:log_lw 27 - call:draw_dss - call:user_set_git_path - ) - :: architecture specific downloads... - IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT) -goto:eof - -:user_set_git_path - set /p git_exe_path="%word%: " - call:user_set_git_path_fail -goto:eof - -:go_to_platform - call:log_ds "Windows %~1 detected..." - GOTO %~2 -goto:eof - -:64BIT - call:log_ds "64-bit computer detected..." - - call:install_software_o "node-js" "%%downloads_64[1]%%" msi 12 - call:draw_dss - - call:get_path_from_user 41 42 - set "node_js_path=%user_tmp_path%" - Call:draw_dss - - call:install_software_o "ruby" "%%downloads_64[2]%%" exe 13 - call:draw_dss - call:install_software_o "python" "%%downloads_64[3]%%" msi 26 - - :: Some installations require specific windows versions - for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j - if "%version%" == "5.2" ( call:go_to_platform "XP" ver_XP_64 ) - if "%version%" == "6.0" ( call:go_to_platform "Vista" ver_Vista_64 ) - if "%version%" == "6.1" ( call:go_to_platform "7" ver_Win7_8_64 ) - if "%version%" == "6.2" ( call:go_to_platform "8.0" ver_Win7_8_64 ) - if "%version%" == "6.3" ( call:go_to_platform "8.1" ver_Win7_8_64 ) - GOTO warn_and_exit -GOTO END - -:32BIT - call:log_ds "32-bit computer detected..." - - call:install_software_o "node-js" "%%downloads_32[1]%%" msi 12 - call:draw_dss - - call:get_path_from_user 41 42 - set "node_js_path=%user_tmp_path%" - Call:draw_dss - - call:install_software_o "ruby" "%%downloads_32[2]%%" exe 13 - call:draw_dss - call:install_software_o "python" "%%downloads_32[3]%%" msi 26 - - :: Some installations require specific windows versions - for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j - if "%version%" == "5.2" ( call:go_to_platform "XP" ver_XP_32 ) - if "%version%" == "6.0" ( call:go_to_platform "Vista" ver_Vista_32 ) - if "%version%" == "6.1" ( call:go_to_platform "7" ver_Win7_8_32 ) - if "%version%" == "6.2" ( call:go_to_platform "8.0" ver_Win7_8_32 ) - if "%version%" == "6.3" ( call:go_to_platform "8.1" ver_Win7_8_32 ) - GOTO warn_and_exit -GOTO END - -:ver_Win7_8_32 - call:install_packed_software_o "mongo-db" "%%downloads_7_32[1]%%" 25 14 - set "mong-db-path = %packed_software_path%" -goto git_rep_checkout - -:ver_Vista_32 - call:install_packed_software_o "mongo-db" "%%downloads_vista_32[1]%%" 25 14 - set "mong-db-path = %packed_software_path%" -goto git_rep_checkout - -:ver_XP_32 - call:log_lw_ds 15 -goto END - -:ver_Win7_8_64 - call:install_packed_software_o "mongo-db" "%%downloads_7_64[1]%%" 25 14 - set "mong-db-path = %packed_software_path%" -goto git_rep_checkout - -:ver_Vista_64 - call:install_packed_software_o "mongo-db" "%%downloads_vista_64[1]%%" 25 14 - set "mong-db-path = %packed_software_path%" -goto git_rep_checkout - -:ver_XP_64 - call:log_lw_ds 15 -goto END - -:git_rep_checkout - call:log_lw_ss 16 - call:log_lw_sse 17 - - set "PATH=%PATH%;%git_exe_path%\bin;%git_exe_path%\cmd" /M - - call:log_lw 36 - call:log_lw 37 - call:log_lw 38 - - call:draw_dss - - call:get_lw word 39 - set /p git_username="%word% " - - call:draw_dss - - call:get_empty_path_from_user 32 - set "git_repository_path=%user_tmp_path%" - -goto:git_rep_checkout_auto - -:git_rep_checkout_auto - git clone https://github.com/%git_username%/codecombat.git "%git_repository_path%" -goto:git_repo_configuration - -:git_repo_configuration - call:log_lw_ss 35 - call:log_lw_sse 36 - - SET "PATH=%PATH%;%node_js_path%" /M - setx -m git "%git_exe_path%\bin" - - call:log_lw 40 - start cmd /k "npm install -g bower brunch nodemon sendwithus & exit" - -goto report_ok - -:report_ok - call:log_lw 18 - call:log_lw_sse 19 - - :: Open README file - call:open_readme - -goto clean_up - -:open_readme - call:open_txt_file "config/info" -goto:eof - -:warn_and_exit - call:log_lw_ss 20 - call:log_lw_sse 21 -goto error_report - -:error_report - call:log_lw_ds 22 -goto END - -:clean_up - call:log_lw_sse 23 - rmdir %temp-dir% /s /q -goto END - -:: ============================ INSTALL SOFTWARE FUNCTIONS ====================== - -:download_software - call:get_lw word 4 - call:log "%word% %~1..." - %curl-app% -sS -k %~2 -o %temp-dir%\%~1-setup.%~3 -goto:eof - -:install_software - call:download_software %~1 %~2 %~3 - call:get_lw word 5 - call:log "%word% %~1..." - START /WAIT %temp-dir%\%~1-setup.%~3 -goto:eof - -:install_software_o - call:get_lw word %~4 - call:user_yn_question "%word%" - if "%res%"=="true" ( - call:install_software %~1 %~2 %~3 - ) else ( - call:log_lw 10 - ) -goto:eof - -:install_packed_software - call:download_software %~1 %~2 zip - - call:draw_dss - - call:get_lw word %~3 - - set /p packed_software_path="%word% " - - :: remove chosen directory of user if it already exists (to prevent a window from popping up) - IF EXIST %packed_software_path% rmdir %packed_software_path% /s /q - - %ZU-app% x %temp-dir%\%~1-setup.zip -o%packed_software_path% - - call:draw_dss - - for /f "delims=" %%a in ('dir "%packed_software_path%\" /on /ad /b') do @set temp_dir=%%a - for /f "delims=" %%a in ('dir "%packed_software_path%\%temp_dir%\" /on /ad /b') do ( - xcopy %packed_software_path%\%temp_dir% %packed_software_path%\ /S /E - ) - - call:draw_dss - rmdir %packed_software_path%\%temp_dir%\ /s /q -goto:eof - -:user_yn_question - set /p result="%~1 [Y/N]: " - call:draw_dss - set "res=false" - if "%result%"=="N" (set "res=true") - if "%result%"=="n" (set "res=true") -goto:eof - -:strict_user_yn_question - set /p result="%~1 [Y/N]: " - call:draw_dss - set "res=unset" - if "%result%"=="N" (set "res=false") - if "%result%"=="n" (set "res=false") - if "%result%"=="Y" (set "res=true") - if "%result%"=="y" (set "res=true") - - if "%res%"=="unset" ( - call:log "Please answer the question with either Y or N..." - call:draw_dss - call:strict_user_yn_question "%~1" - ) -goto:eof - -:install_packed_software_o - call:get_lw word %~4 - call:user_yn_question "%word%" - if "%res%"=="true" ( - call:install_packed_software %~1 %~2 %~3 - ) else ( - call:log_lw 10 - ) -goto:eof - -:: ===================== USER - INTERACTION - FUNCTIONS ======================== - -:get_path_from_user - call:get_lw word %~1 - set /p user_tmp_path="%word% " - if not exist "%user_tmp_path%" ( - call:log_lw 43 - call:draw_dss - call:get_path_from_user %~1 %~2 - ) -goto:eof - -:get_empty_path_from_user - call:get_lw word %~1 - set /p user_tmp_path="%word% " - if exist "%user_tmp_path%" ( - call:log_lw 33 - call:draw_dss - call:get_path_from_user %~1 - ) -goto:eof - -:: ============================== FUNCTIONS ==================================== - -:log - echo %~1 - echo %~1 >> %install-log% -goto:eof - -:draw_ss - echo. - call:log "-----------------------------------------------------------------------------" - echo. -goto:eof - -:draw_dss - echo. - call:log "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" - echo. -goto:eof - -:draw_seperator - echo. - echo + + + + + + + + - echo. -goto:eof - -:log_ss - call:draw_ss - call:log "%~1" -goto:eof - -:log_sse - call:log "%~1" - call:draw_ss -goto:eof - -:log_ds - call:log_ss "%~1" - call:draw_ss -goto:eof - -:: ============================== IO FUNCTIONS ==================================== - -:open_txt_file - start "" notepad.exe %~1 -goto:eof - -:parse_aa_and_draw - set "file=%~1" - for /f "usebackq tokens=* delims=;" %%a in ("%file%") do ( - echo.%%a - ) -goto:eof - -:parse_file - set "file=%~1" - for /F "usebackq delims=" %%a in ("%file%") do ( - set /A %~3+=1 - call set %~2[%%%~3%%]=%%a - ) -goto:eof - -:parse_file_new - set /A %~3=0 - call:parse_file %~1 %~2 %~3 -goto:eof - -:: ============================== LOCALISATION FUNCTIONS ================ - -:get_lw - call:get_lw_id %~1 %lang_id% %~2 -goto:eof - -:get_lw_id - set /A count = %~2 * %wc% + %~3 + 1 - set "%~1=!languages[%count%]!" -goto:eof - -:log_lw - call:get_lw str %~1 - call:log "%str%" -goto:eof - -:log_lw_prfx - call:get_lw str %~1 - call:log "%~2%str%" -goto:eof - -:log_lw_ss - call:get_lw str %~1 - call:log_ss "%str%" -goto:eof - -:log_lw_ds - call:get_lw str %~1 - call:log_ds "%str%" -goto:eof - -:log_lw_sse - call:get_lw str %~1 - call:log_sse "%str%" -goto:eof - -:: ============================== WINDOWS FUNCTIONS ====================== - -:set_env_var - setx -m %~1 %~2 -goto:eof - -:: ============================== EOF ==================================== - -:END - exit -goto:eof - -endlocal \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/recycle_bin/git-test.bat b/scripts/windows/coco-dev-setup/recycle_bin/git-test.bat deleted file mode 100755 index adee59c3e..000000000 --- a/scripts/windows/coco-dev-setup/recycle_bin/git-test.bat +++ /dev/null @@ -1,50 +0,0 @@ -@echo off -setlocal EnableDelayedExpansion - -:: + Configuraton and installation checklist: -:: 1) cd codecombat -:: 2) npm install -g bower brunch nodemon sendwithus -:: 3) bower install -:: 4) gem install sass -:: 5) npm install -:: 6) brunch -w -:: Extra... @ Fail run npm install - -echo "Moving to your git repository..." -C: -cd C:\CodeCombat - -PAUSE - -SET "PATH=%PATH%;C:\Program Files\Nodejs" /M -setx -m git "C:\Program Files (x86)\Git\bin" -SET "PATH=%PATH%;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd" /M - -PAUSE - -echo "Installing bower, brunch, nodemon and sendwithus..." -start cmd /k "npm install -g bower brunch nodemon sendwithus & exit" - -PAUSE - -echo "running npm install..." -start cmd /k "npm install & exit" - -PAUSE - -echo "Activating bower install..." -start cmd /k "bower install & PAUSE & exit" - -PAUSE - -echo "Installing sass via gem..." -start cmd /k "install sass & PAUSE & exit" - -PAUSE - -echo "comping repository via brunch..." -start cmd /k "brunch -w & exit" - -PAUSE - -endlocal \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/src/get_category.cpp b/scripts/windows/coco-dev-setup/src/get_category.cpp deleted file mode 100755 index 971c3aefb..000000000 --- a/scripts/windows/coco-dev-setup/src/get_category.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "stdafx.h" -#include -#include -#include -#include -#include - -#define tstring std::wstring -#define tcout std::wcout - -static const tstring DEF_URL = L"http://www.google.com"; - -int ErrorReport(const tstring & str, int value = 0) -{ - tcout << str.c_str(); - return value; -} - -void GetHashInfo(tstring id, std::vector & info) { - while(id.size() > 0) - { - size_t pos = id.find(L'-'); - - tstring substr = - id.substr(0, pos == tstring::npos ? id.length() : pos); - info.push_back(substr); - - if(pos == tstring::npos) id = L""; - else - { - ++pos; - id = id.substr(pos, id.length() - pos); - } - } -} - -void SetArrayVariable( - const tstring & name, - int id, - const tstring & line - ) -{ - tcout << L"set \""; - tcout << name; - tcout << L"[" << id << "]"; - tcout << L"=" << line; - tcout << L"\"" << std::endl; -} - -void FillArray( - const std::vector & info, - const tstring & name, - const tstring & id_array_name, - const tstring & file, - int & id - ) -{ - if(info.size() == 0) return; - - auto it = info.begin(); - size_t indention = 0; - unsigned int nlc = 0; - - std::wifstream infile(file.c_str(), std::ifstream::in); - - if(!infile) - { - #ifdef _DEBUG - tcout << file.c_str() << std::endl; - tcout << strerror(errno) << std::endl; - #endif - return; - } - - tstring line; - int counter = 1; - while (std::getline(infile, line)) - { - size_t cpos = line.find('['); - if(cpos == tstring::npos) - { - cpos = line.find_first_not_of(L" \t\r\n"); - } - if(nlc++ == 0 || cpos == indention) - { - indention = cpos; - if(it == info.end()) - { - size_t pos = line.find(L'=') + 1; - SetArrayVariable( - name, id, - line.substr(pos, line.size() - pos) - ); - SetArrayVariable( - id_array_name, id++, - line.substr(cpos, pos - 3) - ); - ++counter; - } - else if(line.find(*it) != tstring::npos) - { - ++it; - nlc = 0; - } - } - else if(counter > 1) - { - return; - } - } - - infile.close(); - return; -} - -int _tmain(int argc, _TCHAR* argv[]) -{ - if(argc == 1) - return ErrorReport(L"Please specify a localisation file."); - else if(argc == 2) - return ErrorReport(L"Please specify the name of the array."); - else if(argc == 3) - return ErrorReport(L"Please specify the name of the name-array."); - else if(argc == 4) - return ErrorReport(L"Please specify the counter parameter."); - else if(argc == 5) - return ErrorReport(L"Please specify one or more categories you are looking for."); - - tstring file, name, counter_name, id_array_name; - file = argv[1]; - name = argv[2]; - id_array_name = argv[3]; - counter_name = argv[4]; - int id = 1; - - for(int i = 5 ; i < argc ; ++i) - { - std::vector information; - GetHashInfo(argv[i], information); - FillArray(information, name, id_array_name, file, id); - } - - tcout << L"set \"" << counter_name << L"=" << (id - 1) << L"\""; - - return 0; -} diff --git a/scripts/windows/coco-dev-setup/src/get_extension.cpp b/scripts/windows/coco-dev-setup/src/get_extension.cpp deleted file mode 100755 index f311ac93f..000000000 --- a/scripts/windows/coco-dev-setup/src/get_extension.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "stdafx.h" -#include -#include -#include -#include -#include - -#define tstring std::wstring -#define tcout std::wcout - -int ErrorReport(const tstring & str, int value = 0) -{ - tcout << str.c_str(); - return value; -} - -int _tmain(int argc, _TCHAR* argv[]) -{ - if(argc == 1) - return ErrorReport(L"Please specify a download URL."); - if(argc == 2) - return ErrorReport(L"Please specify a name for your variable."); - - tstring url, name, extension; - url = argv[1]; - name = argv[2]; - - if(url.find(L"exe") != tstring::npos) extension = L"exe"; - else if(url.find(L"msi") != tstring::npos) extension = L"msi"; - else if(url.find(L"zip") != tstring::npos) extension = L"zip"; - - tcout << L"set \"" << name << L"="; - tcout << extension << L"\""; - - return 0; -} \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/src/get_var.cpp b/scripts/windows/coco-dev-setup/src/get_var.cpp deleted file mode 100755 index e69b0be1c..000000000 --- a/scripts/windows/coco-dev-setup/src/get_var.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "stdafx.h" -#include -#include -#include -#include -#include - -#define tstring std::wstring -#define tcout std::wcout - -static const tstring DEF_URL = L"http://www.google.com"; - -int ErrorReport(const tstring & str, int value = 0) -{ - tcout << str.c_str(); - return value; -} - -void GetHashInfo(tstring id, std::vector & info) { - while(id.size() > 0) - { - size_t pos = id.find(L'-'); - - tstring substr = - id.substr(0, pos == tstring::npos ? id.length() : pos); - info.push_back(substr); - - if(pos == tstring::npos) id = L""; - else - { - ++pos; - id = id.substr(pos, id.length() - pos); - } - } -} - -std::wstring GetText(const std::vector & info, const tstring & file) -{ - if(info.size() == 0) return L"Info Size is 0."; - - auto it = info.begin(); - auto last = info.end() - 1; - size_t indention = 0; - unsigned int nlc = 0; - - std::wifstream infile(file.c_str(), std::ifstream::in); - - if(!infile) - { - #ifdef _DEBUG - tcout << file.c_str() << std::endl; - tcout << strerror(errno) << std::endl; - #endif - return L"File couldn't be opened."; - } - - tstring line; - while (std::getline(infile, line)) - { - size_t cpos = line.find('['); - if(nlc++ == 0 || cpos == indention) - { - indention = cpos; - if(line.find(*it) != tstring::npos) - { - if(it == last) - { - size_t pos = line.find(L'=') + 1; - infile.close(); - return line.substr(pos, line.size() - pos); - } - else - { - ++it; - nlc = 0; - } - } - } - } - - infile.close(); - return L"Var couldn't be found."; -} - -int _tmain(int argc, _TCHAR* argv[]) -{ - if(argc == 1) - return ErrorReport(L"Please specify a localisation file."); - else if(argc == 2) - return ErrorReport(L"Please specify the ID you are looking for."); - - tstring file, hash; - file = argv[1]; - hash = argv[2]; - - std::vector information; - GetHashInfo(hash, information); - - size_t size = information.size(); - for(unsigned int i = 0 ; i < size ; ++i) - { - tcout << information[i]; - if(i != size - 1) tcout << L"_"; - } - tcout << L"=" << GetText(information, file); - - return 0; -}