From 6f2cfbf1e8d3975024e6a7691e508dc446db9f80 Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 00:37:59 +0200 Subject: [PATCH 01/11] config system has been refactored and now works with powershell --- .../coco-dev-setup/batch/localisation/de.coco | 20 ++++++++--------- .../batch/scripts/get_config.bat | 4 +++- .../batch/scripts/get_download.bat | 6 ++--- .../batch/scripts/get_local_text.bat | 2 +- .../coco-dev-setup/batch/scripts/get_text.bat | 6 ++--- .../coco-dev-setup/batch/scripts/get_var.ps1 | 22 ++++++++++++++----- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/scripts/windows/coco-dev-setup/batch/localisation/de.coco b/scripts/windows/coco-dev-setup/batch/localisation/de.coco index 6c3105433..f9ddc7344 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/de.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/de.coco @@ -15,10 +15,10 @@ Sind die für CodeCombat benötigten Programme bereits installiert? Wir empfehlen Ihnen, mit „Nein“ zu antorten, falls Sie unsicher sind. Überspringe Installation der Programme... - <1>Ohne Software von Drittanbietern könnte CodeCombat nicht entwickelt werden. - <2>Aus diesem Grund müssen Sie diese Software installieren, - <3>um sich in der Community zu engagieren. - <4>Wenn Sie ein Programm bereits installiert haben, brechen Sie die Installation bitte ab. + Ohne Software von Drittanbietern könnte CodeCombat nicht entwickelt werden. + Aus diesem Grund müssen Sie diese Software installieren, + um sich in der Community zu engagieren. + Wenn Sie ein Programm bereits installiert haben, brechen Sie die Installation bitte ab. Haben Sie bereits die aktuellste Version von installiert? wird heruntergeladen... @@ -71,11 +71,11 @@ Willst du das README lesen, um weitere Informationen zu erhalten? - <1>Von nun an kannst du die Entwicklungsumgebung starten unter - <2>einmal mit der Maus klicken. - <3> 1) Einfach Doppelklicken - <4>und warten bis die Entwicklungsumgebung fertig geladen hat. - <5> 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen. - <6>Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten! + Von nun an kannst du die Entwicklungsumgebung starten unter + einmal mit der Maus klicken. + 1) Einfach Doppelklicken + und warten bis die Entwicklungsumgebung fertig geladen hat. + 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen. + Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten! \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_config.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_config.bat index fe51a71d1..21c975aaf 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_config.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_config.bat @@ -1 +1,3 @@ -call run_script .\get_var.ps1 ..\config\config.coco %1 \ No newline at end of file +for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\config\\config.coco %1') do ( + set "%1=%%F" +) \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_download.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_download.bat index d8c209f16..2f884b366 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_download.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_download.bat @@ -1,3 +1,3 @@ -call run_script .\get_var.ps1 ..\\config\\downloads.coco %2 %3 %4 %5 %6 > var.tmp -set /p %1= < var.tmp -del /q var.tmp \ No newline at end of file +for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\config\\downloads.coco %2 %3 %4 %5') do ( + set "%1=%%F" +) \ 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 aae9bf110..9a54a78c5 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/get_text.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_text.bat index 33f75adf4..aacdf94f2 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_text.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_text.bat @@ -1,3 +1,3 @@ -call run_script .\get_var.ps1 ..\\localisation\\%1.coco %3 %4 %5 %6 %7 > var.tmp -set /p %2= < var.tmp -del /q var.tmp \ No newline at end of file +for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\localisation\\%1.coco %3 %4 %5 %6') do ( + set "%2=%%F" +) \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_var.ps1 b/scripts/windows/coco-dev-setup/batch/scripts/get_var.ps1 index 91da095d5..5e63443fb 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_var.ps1 +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_var.ps1 @@ -1,17 +1,27 @@ $xml_file = [xml](get-content $args[0]) -if($args.count -eq 3) +if($args.count -eq 2) { - cmd /c "set_var.bat" ($args[1]) ($xml_file.variables.($args[2])) + $var_output = ($xml_file.variables.($args[1])) +} +elseif($args.count -eq 3) +{ + $var_output = ($xml_file.variables.($args[1]).($args[2])) } elseif($args.count -eq 4) { - cmd /c "set_var.bat" ($args[1]) ($xml_file.variables.($args[2]).($args[3])) + $var_output = ($xml_file.variables.($args[1]).($args[2]).($args[3])) } elseif($args.count -eq 5) { - cmd /c "set_var.bat" ($args[1]) ($xml_file.variables.($args[2]).($args[3]).($args[4])) + $var_output = ($xml_file.variables.($args[1]).($args[2]).($args[3]).($args[4])) } elseif($args.count -eq 6) { - cmd /c "set_var.bat" ($args[1]) ($xml_file.variables.($args[2]).($args[3]).($args[4]).($args[5])) -} \ No newline at end of file + $var_output = ($xml_file.variables.($args[1]).($args[2]).($args[3]).($args[4]).($args[5])) +} +elseif($args.count -eq 7) +{ + $var_output = ($xml_file.variables.($args[1]).($args[2]).($args[3]).($args[4]).($args[5]).($args[6])) +} + +Write-Host "$var_output" \ No newline at end of file From ed12b644ca0ed250db8841a822933cc6081270fd Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 01:27:15 +0200 Subject: [PATCH 02/11] More refactoring. localisation works almost again, and fixed some caused by previous refactoring. --- .../coco-dev-setup/batch/config/config.coco | 2 ++ .../coco-dev-setup/batch/config/tips.coco | 2 +- .../coco-dev-setup/batch/localisation/de.coco | 18 +++++------ .../coco-dev-setup/batch/localisation/en.coco | 20 ++++++------ .../coco-dev-setup/batch/localisation/nl.coco | 20 ++++++------ .../scripts/download_and_install_app.bat | 14 ++++---- .../download_and_install_applications.bat | 24 +++++++------- .../batch/scripts/get_system_information.bat | 6 ++-- .../batch/scripts/github_setup.bat | 32 +++++++++---------- .../coco-dev-setup/batch/scripts/setup.bat | 32 +++++++++---------- 10 files changed, 85 insertions(+), 85 deletions(-) diff --git a/scripts/windows/coco-dev-setup/batch/config/config.coco b/scripts/windows/coco-dev-setup/batch/config/config.coco index ae8c66f56..3e7c256d9 100755 --- a/scripts/windows/coco-dev-setup/batch/config/config.coco +++ b/scripts/windows/coco-dev-setup/batch/config/config.coco @@ -3,4 +3,6 @@ 1.0 GlenDC CodeCombat.com 2013-2014 + https://github.com/codecombat/codecombat.git + git@github.com:codecombat/codecombat.git \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/config/tips.coco b/scripts/windows/coco-dev-setup/batch/config/tips.coco index 0a4bb84c4..896086692 100755 --- a/scripts/windows/coco-dev-setup/batch/config/tips.coco +++ b/scripts/windows/coco-dev-setup/batch/config/tips.coco @@ -4,4 +4,4 @@ 4) Having questions/suggestions? Talk with us on HipChat via CodeCombat.com You can find a step-by-step guide for this installation on our wiki. - https://github.com/codecombat/codecombat/wiki/ \ No newline at end of file + github.com/codecombat/codecombat/wiki/Setup-on-Windows:-a-step-by-step-guide \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/de.coco b/scripts/windows/coco-dev-setup/batch/localisation/de.coco index f9ddc7344..e385122ec 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/de.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/de.coco @@ -30,16 +30,16 @@ - Wie Du bereits weißt, ist CodeCombat Open Source. - Unser Quellcode ist komplett auf Github. - Wenn Du möchtest, kannst du das komplette Git Repository selbst herunterladen und nach deinen wünschen einrichten. - Allerdings empfehlen wir, dass du den Prozess statt dessen uns überlässt. + Wie Du bereits weißt, ist CodeCombat Open Source. + Unser Quellcode ist komplett auf Github. + Wenn Du möchtest, kannst du das komplette Git Repository selbst herunterladen und nach deinen wünschen einrichten. + Allerdings empfehlen wir, dass du den Prozess statt dessen uns überlässt. - Willst du das lokale Git Setup selbst vornehmen? - Bit vergewissere dich, dass das Repository korrekt heruntergeladen wurde, bevor du fortfährst. - Bitte schließe dieses Fenster nicht. - Wenn du fertig bist, drücke eine beliebige Taste zum Fortfahren... + Willst du das lokale Git Setup selbst vornehmen? + Bit vergewissere dich, dass das Repository korrekt heruntergeladen wurde, bevor du fortfährst. + Bitte schließe dieses Fenster nicht. + Wenn du fertig bist, drücke eine beliebige Taste zum Fortfahren... Gebe bitte den kompletten Pfad zu deinem CodeCombat Git Repository ein: @@ -62,7 +62,7 @@ - Dieser Pfad existiert bereits. Willst du ihn wirklich überschreiben? + Dieser Pfad existiert bereits. Willst du ihn wirklich überschreiben? Dieser Pfad exisitert nicht. Bitte versuche es erneut... diff --git a/scripts/windows/coco-dev-setup/batch/localisation/en.coco b/scripts/windows/coco-dev-setup/batch/localisation/en.coco index 96934bf3e..bdf8e53d1 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/en.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/en.coco @@ -15,10 +15,10 @@ Have you already installed all the software needed for CodeCombat? We recommand that you reply negative in case you're not sure. Skipping the installation of the software... - <1>CodeCombat couldn't be developed without third-party software. - <2>That's why you'll need to install this software, - <3>in order to start contributing to our community. - <4>Cancel the installation if you already have the application. + CodeCombat couldn't be developed without third-party software. + That's why you'll need to install this software, + in order to start contributing to our community. + Cancel the installation if you already have the application. Do you already have the latest version of installed? is downloading... @@ -71,11 +71,11 @@ Do you want to read the README for more information? - <1>From now on you can start the dev. environment at - <2>the touch of a single mouse click. - <3> 1) Just double click - <4> and let the environment start up. - <5> 2) Now just open 'localhost:3000' in your prefered browser. - <6>That's it, you're now ready to start working on CodeCombat! + From now on you can start the dev. environment at + the touch of a single mouse click. + 1) Just double click + and let the environment start up. + 2) Now just open 'localhost:3000' in your prefered browser. + That's it, you're now ready to start working on CodeCombat! \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco index 64bdf8c58..f631124cf 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco @@ -15,10 +15,10 @@ Heb je alle benodige software al geinstalleerd? We raden aan dat je negatief antwoord indien je niet zeker bent. De installatie van software wordt geanulleerd... - <1>CodeCombat kon niet worden ontwikkeld zonder third-party software. - <2>Dat is waarom je deze software moet installeren, - <3>zodat je je kan beginnen met het bijdragen tot onze gemeenschap. - <4>Annuleer de installatie als je de applicatie al hebt. + CodeCombat kon niet worden ontwikkeld zonder third-party software. + Dat is waarom je deze software moet installeren, + zodat je je kan beginnen met het bijdragen tot onze gemeenschap. + Annuleer de installatie als je de applicatie al hebt. Heb je al de laatste versie van geinstalleerd? is aan het downloaden... @@ -71,11 +71,11 @@ Wil je de LEESMIJ lezen voor meer informatie? - <1>Vanaf nu kan je de ontwikkelings omgeving opstarten - <2>met het gemak van een enkele muisklik. - <3> 1) Dubbelklik op - <4>en laat de omgeving opstarten. - <5> 2) Nu kan je 'localhost:3000' openen in je browser naar voorkeur. - <6>Dat is het, je bent nu klaar om te starten met je werk aan CodeCombat. + Vanaf nu kan je de ontwikkelings omgeving opstarten + met het gemak van een enkele muisklik. + 1) Dubbelklik op + en laat de omgeving opstarten. + 2) Nu kan je 'localhost:3000' openen in je browser naar voorkeur. + Dat is het, je bent nu klaar om te starten met je werk aan CodeCombat. \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_app.bat b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_app.bat index b72e74dbd..8d85be8b1 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_app.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_app.bat @@ -6,8 +6,8 @@ if NOT exist "%temp_directory%" ( md %temp_directory% ) -call get_local_text install-process-prefix -call get_local_text install-process-sufix +call get_local_text install_process_prefix install process prefix +call get_local_text install_process_sufix install process sufix call ask_question "!install_process_prefix! %1 !install_process_sufix!" @@ -18,7 +18,7 @@ if "%result%"=="true" ( call print_dashed_seperator call get_extension %2 download_extension -call get_local_text install-process-downloading +call get_local_text install_process_downloading install process downloading echo %1 !install_process_downloading! set "install_file=!temp_directory!%1.!download_extension!" %curl_app% -k %2 -o !install_file! @@ -34,10 +34,10 @@ if "%download_extension%"=="zip" ( goto:get_mongodb_path :get_mongodb_path - call get_local_text install-process-mongodbpath + call get_local_text install_process_mongodbpath install process mongodbpath set /p "mongodb_path=!install_process_mongodbpath!: " if exist "%mongodb_path%" ( - call get_local_text error-path + call get_local_text error_path error path call ask_question "!error_path!" if "!result!"=="false" ( call print_dashed_seperator @@ -52,14 +52,14 @@ if "%download_extension%"=="zip" ( goto:clean_up ) -call get_local_text install-process-installing +call get_local_text install_process_installing install process installing echo %1 !install_process_installing! echo. start /WAIT !install_file! goto:clean_up :clean_up - call get_local_text install-process-cleaning + call get_local_text install_process_cleaning install process cleaning echo %1 !install_process_cleaning! rmdir /s /q "!temp_directory!" goto:exit_installation diff --git a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat index 65c41f58d..d2469086e 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat @@ -1,16 +1,16 @@ call print_install_header call print_dashed_seperator -call get_local_text install-process-sks +call get_local_text install_process_sks install process sks echo !install_process_sks! -call get_local_text install-process-skq +call get_local_text install_process_skq install process skq call ask_question "!install_process_skq!" call print_dashed_seperator if "%result%"=="true" ( - call get_local_text install-process-skc + call get_local_text install_process_skc install process skc echo !install_process_skc! call print_dashed_seperator goto:exit_setup @@ -20,22 +20,22 @@ call get_system_information call print_dashed_seperator if %system_info_os% == XP ( - call get_local_text install-system-xp + call get_local_text install_system_xp install system xp echo !install_system_xp! call print_exit ) call get_category ..\\config\\downloads.coco downloads download_names downloads_count general-general general-%system_info_bit% %system_info_os%-%system_info_bit% -call get_local_text install-process-1 -call get_local_text install-process-2 -call get_local_text install-process-3 -call get_local_text install-process-4 +call get_local_text install_process_s1 install process s1 +call get_local_text install_process_s2 install process s2 +call get_local_text install_process_s3 install process s3 +call get_local_text install_process_s4 install process s4 -echo !install_process_1! -echo !install_process_2! -echo !install_process_3! -echo !install_process_4! +echo !install_process_s1! +echo !install_process_s2! +echo !install_process_s3! +echo !install_process_s4! call print_dashed_seperator diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_system_information.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_system_information.bat index 542ffe73c..908399932 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_system_information.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_system_information.bat @@ -16,15 +16,15 @@ if "%version%" == "6.3" ( call:set_os Win7 ) goto:end :set_bit - call get_local_text install-system-bit + call get_local_text install_system_bit install system bit set system_info_bit=%~1 echo %system_info_bit%%install_system_bit% goto:eof :set_os set system_info_os=%~1 - call get_local_text install-system-prefix - call get_local_text install-system-sufix + call get_local_text install_system_prefix install system prefix + call get_local_text install_system_sufix install system sufix echo %install_system_prefix% %system_info_os% %install_system_sufix% goto:eof 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 6c8952bc3..e9add16ca 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/github_setup.bat @@ -1,10 +1,10 @@ call print_github_header call print_dashed_seperator -call get_local_text github-intro-opensource -call get_local_text github-intro-online -call get_local_text github-intro-manual -call get_local_text github-intro-norec +call get_local_text github_intro_opensource github intro opensource +call get_local_text github_intro_online github intro online +call get_local_text github_intro_manual github intro manual +call get_local_text github_intro_norec github intro norec echo !github_intro_opensource! echo !github_intro_online! @@ -13,23 +13,23 @@ echo !github_intro_norec! call print_dashed_seperator -call get_local_text github-skip-question +call get_local_text github_skip_question github skip question call ask_question "!github_skip_question!" call print_dashed_seperator if "%result%"=="true" ( - call get_local_text github-skip-consequence + call get_local_text github_skip_consequence github skip consequence echo !github_skip_consequence! - call get_local_text github-skip-donotclose + call get_local_text github_skip_donotclose github skip donotclose echo !github_skip_donotclose! - call get_local_text github-skip-wait + call get_local_text github_skip_wait github skip wait set /p "github_skip_wait=!github_skip_wait!" call print_dashed_seperator - call get_local_text github-process-path + call get_local_text github_process_path github process path call get_path_safe "!github_process_path!" set "repository_path=!tmp_safe_path!" @@ -39,7 +39,7 @@ if "%result%"=="true" ( goto:get_bash_path :get_bash_path - call get_local_text github-process-bashi + call get_local_text github_process_bashi github process bashi echo !github_process_bashi! if not defined install_system_bit ( @@ -49,14 +49,14 @@ goto:get_bash_path ) if "%system_info_bit%"=="64" ( - call get_local_text github-process-bashp64 + call get_local_text github_process_bashp64 github process bashp64 echo !github_process_bashp64! ) else ( - call get_local_text github-process-bashp32 + call get_local_text github_process_bashp32 github process bashp32 echo !github_process_bashp32! ) - call get_local_text github-process-bashq + call get_local_text github_process_bashq github process bashq set /p "git_bash_path=!github_process_bashq!: " if not defined git_bash_path ( @@ -69,7 +69,7 @@ goto:get_bash_path ) if not exist "%git_bash_path%" ( - call get_local_text error-exist + call get_local_text error_exist error exist echo !error_exist! call print_dashed_seperator goto:get_bash_path @@ -80,10 +80,10 @@ goto:eof :get_git_path call print_dashed_seperator - call get_local_text github-process-checkout + call get_local_text github_process_checkout github process checkout set /p "repository_path=!github_process_checkout!: " if exist !repository_path! ( - call get_local_text error-path + call get_local_text error_path error path call ask_question "!error_path!" if "!result!"=="false" ( call print_dashed_seperator diff --git a/scripts/windows/coco-dev-setup/batch/scripts/setup.bat b/scripts/windows/coco-dev-setup/batch/scripts/setup.bat index a5e4b61f7..b552dcced 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/setup.bat @@ -14,8 +14,6 @@ echo Welcome to the automated Installation of the CodeCombat Dev. Environment! echo v%version% authored by %author% and published by %copyright%. call print_seperator -pause - echo Before we start the installation, here are some tips: call print_tips call print_seperator @@ -34,32 +32,32 @@ call github_setup call print_finished_header call print_dashed_seperator -call get_local_text end-succesfull -call get_local_text end-thankyou +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-1 -call get_local_text start-2 -call get_local_text start-3 -call get_local_text start-4 -call get_local_text start-5 -call get_local_text start-6 +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_1! -echo !start_2! +echo !start_s1! +echo !start_s2! echo. -echo !start_3! '!repository_path!\coco\SCOCODE.bat' -echo !start_4! -echo !start_5! +echo !start_s3! '!repository_path!\coco\SCOCODE.bat' +echo !start_s4! +echo !start_s5! echo. -echo !start_6! +echo !start_s6! call print_dashed_seperator -call get_local_text end-readme +call get_local_text end_readme end readme call ask_question "!end_readme!" if "%result%"=="true" ( From cfb8ef06384d69b8a1674281e98c73a3e1ceec8b Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 03:19:31 +0200 Subject: [PATCH 03/11] GetExtension, getDownload, getVar and getText works now --- .../coco-dev-setup/batch/config/downloads.coco | 16 ++++++++++++---- .../batch/scripts/get_category.bat | 3 --- .../batch/scripts/get_extension.bat | 4 ++-- .../batch/scripts/get_extension.ps1 | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 9 deletions(-) delete mode 100755 scripts/windows/coco-dev-setup/batch/scripts/get_category.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/get_extension.ps1 diff --git a/scripts/windows/coco-dev-setup/batch/config/downloads.coco b/scripts/windows/coco-dev-setup/batch/config/downloads.coco index 2a0472c41..ff1af0501 100755 --- a/scripts/windows/coco-dev-setup/batch/config/downloads.coco +++ b/scripts/windows/coco-dev-setup/batch/config/downloads.coco @@ -14,11 +14,19 @@ 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 + + http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip + + + 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 + + http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip + + + 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/batch/scripts/get_category.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_category.bat deleted file mode 100755 index 44384806f..000000000 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_category.bat +++ /dev/null @@ -1,3 +0,0 @@ -for /f "delims=" %%a in ('..\\utilities\\get_category.exe %*') do ( - %%a -) \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_extension.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_extension.bat index 6e4525784..bbcd05b5e 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/get_extension.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_extension.bat @@ -1,3 +1,3 @@ -for /f "delims=" %%a in ('..\\utilities\\get_extension.exe %1 %2') do ( - %%a +for /F "delims=" %%F in ('call run_script .\\get_extension.ps1 %1') do ( + set "%2=%%F" ) \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_extension.ps1 b/scripts/windows/coco-dev-setup/batch/scripts/get_extension.ps1 new file mode 100755 index 000000000..631132f74 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_extension.ps1 @@ -0,0 +1,18 @@ +$url = ($args[0].ToLower()) + +if($url.Contains("zip")) +{ + Write-Host "zip" +} +elseif($url.Contains("exe")) +{ + Write-Host "exe" +} +elseif($url.Contains("msi")) +{ + Write-Host "msi" +} +elseif($url.Contains("tar.gz")) +{ + Write-Host "tar.gz" +} \ No newline at end of file From 9e22b5f47bc470918d3d8f4e23ebddf17ea036d7 Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 05:41:16 +0200 Subject: [PATCH 04/11] Version 1.1 of the windows installer is online and active --- .../coco-dev-setup/batch/config/config.coco | 2 +- .../batch/config/downloads.coco | 16 +- .../download_and_install_applications.bat | 4 +- .../batch/scripts/get_variables.bat | 4 + .../batch/scripts/get_variables.ps1 | 33 ++++ .../batch/scripts/run_script.bat | 1 + .../coco-dev-setup/batch/scripts/setup.bat | 4 +- .../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/src/get_category.cpp | 146 ------------------ .../coco-dev-setup/src/get_extension.cpp | 36 ----- .../windows/coco-dev-setup/src/get_var.cpp | 108 ------------- 18 files changed, 53 insertions(+), 414 deletions(-) create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat create mode 100755 scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1 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/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 3e7c256d9..f8a9f6091 100755 --- a/scripts/windows/coco-dev-setup/batch/config/config.coco +++ b/scripts/windows/coco-dev-setup/batch/config/config.coco @@ -1,6 +1,6 @@ - 1.0 + 1.1 GlenDC CodeCombat.com 2013-2014 https://github.com/codecombat/codecombat.git diff --git a/scripts/windows/coco-dev-setup/batch/config/downloads.coco b/scripts/windows/coco-dev-setup/batch/config/downloads.coco index ff1af0501..b198d59a7 100755 --- a/scripts/windows/coco-dev-setup/batch/config/downloads.coco +++ b/scripts/windows/coco-dev-setup/batch/config/downloads.coco @@ -4,29 +4,31 @@ 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://s3.amazonaws.com/CodeCombatLargeFiles/python-32.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 + http://s3.amazonaws.com/CodeCombatLargeFiles/python-64.msi - https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe + + https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe + - + http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip - - + + http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip 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/batch/scripts/download_and_install_applications.bat b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat index d2469086e..782ecb783 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat @@ -25,7 +25,9 @@ if %system_info_os% == XP ( call print_exit ) -call get_category ..\\config\\downloads.coco downloads download_names downloads_count general-general general-%system_info_bit% %system_info_os%-%system_info_bit% +call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 0 general general +call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 1 %system_info_os% b%system_info_bit% +call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 2 general b%system_info_bit% call get_local_text install_process_s1 install process s1 call get_local_text install_process_s2 install process s2 diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat b/scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat new file mode 100755 index 000000000..a53805fac --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat @@ -0,0 +1,4 @@ +set count=0 +for /F "delims=" %%F in ('call run_script.bat .\\get_variables.ps1 %*') do ( + %%F +) \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1 b/scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1 new file mode 100755 index 000000000..6d94b4324 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1 @@ -0,0 +1,33 @@ +$xml_file = [xml](get-content $args[0]) +$arr_value = $args[1] +$arr_name = $args[2] +$arr_counter = $args[3] +$counter = $args[4] + +if($args.count -eq 6) +{ + $root = $xml_file.variables.($args[5]) +} +elseif($args.count -eq 7) +{ + $root = $xml_file.variables.($args[5]).($args[6]) +} +elseif($args.count -eq 8) +{ + $root = $xml_file.variables.($args[5]).($args[6]).($args[7]) +} +elseif($args.count -eq 9) +{ + $nodes = $xml_file.variables.($args[5]).($args[6]).($args[7]).($args[8]) +} + +foreach ($node in $root.ChildNodes) +{ + $counter += 1 + $value = $node.InnerText + $name = $node.Name + Write-Host set "$arr_value[$counter]=$value" + Write-Host set "$arr_name[$counter]=$name" +} + +Write-Host set "$arr_counter=$counter" \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/scripts/run_script.bat b/scripts/windows/coco-dev-setup/batch/scripts/run_script.bat index 13e7d3032..1e4797008 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/run_script.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/run_script.bat @@ -1 +1,2 @@ +@echo off PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& "%*" \ 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 b552dcced..7c137563f 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/setup.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/setup.bat @@ -2,7 +2,7 @@ setlocal EnableDelayedExpansion Color 0A -mode con: cols=78 lines=55 +mode con: cols=79 lines=55 call print_header call print_dashed_seperator @@ -33,7 +33,7 @@ call print_finished_header call print_dashed_seperator call get_local_text end_succesfull end succesfull -call get_local_text end_thankyou end_thankyou +call get_local_text end_thankyou end thankyou echo %end_succesfull% echo %end_thankyou% 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/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; -} From 79d19d61dbd541a7ced1a5df444021c831b5d1e4 Mon Sep 17 00:00:00 2001 From: Vindurrin Date: Fri, 4 Apr 2014 00:14:28 -0400 Subject: [PATCH 05/11] Update pt-BR.coffee --- app/locale/pt-BR.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/locale/pt-BR.coffee b/app/locale/pt-BR.coffee index 09d9b2ac1..1e350d8e1 100644 --- a/app/locale/pt-BR.coffee +++ b/app/locale/pt-BR.coffee @@ -5,7 +5,7 @@ module.exports = nativeDescription: "português do Brasil", englishDescription: sending: "Enviando..." cancel: "Cancelar" save: "Salvar" -# create: "Create" + create: "Criar" delay_1_sec: "1 segundo" delay_3_sec: "3 segundos" delay_5_sec: "5 segundos" @@ -13,13 +13,13 @@ module.exports = nativeDescription: "português do Brasil", englishDescription: fork: "Fork" play: "Jogar" -# units: -# second: "second" -# seconds: "seconds" -# minute: "minute" -# minutes: "minutes" -# hour: "hour" -# hours: "hours" + unidades: + second: "segundo" + seconds: "segundos" + minute: "minuto" + minutes: "minutos" + hour: "hora" + hours: "horas" modal: close: "Fechar" @@ -53,7 +53,7 @@ module.exports = nativeDescription: "português do Brasil", englishDescription: login: sign_up: "Criar conta" log_in: "Entrar" -# logging_in: "Logging In" + logging_in: "Entrando" log_out: "Sair" recover: "Recuperar sua conta" From 58c57af561b8962a44283366645f7dc7813d2211 Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 10:14:48 +0200 Subject: [PATCH 06/11] Latest update, ready to release version 1.2 of the windows installer. --- .../coco-dev-setup/batch/config/config.coco | 2 +- .../batch/config/downloads.coco | 4 ++++ .../coco-dev-setup/batch/localisation/de.coco | 21 ++++++++++--------- .../coco-dev-setup/batch/localisation/en.coco | 1 + .../coco-dev-setup/batch/localisation/nl.coco | 1 + .../download_and_install_applications.bat | 7 +++++-- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/windows/coco-dev-setup/batch/config/config.coco b/scripts/windows/coco-dev-setup/batch/config/config.coco index f8a9f6091..eba46b0f4 100755 --- a/scripts/windows/coco-dev-setup/batch/config/config.coco +++ b/scripts/windows/coco-dev-setup/batch/config/config.coco @@ -1,6 +1,6 @@ - 1.1 + 1.2 GlenDC CodeCombat.com 2013-2014 https://github.com/codecombat/codecombat.git diff --git a/scripts/windows/coco-dev-setup/batch/config/downloads.coco b/scripts/windows/coco-dev-setup/batch/config/downloads.coco index b198d59a7..771189954 100755 --- a/scripts/windows/coco-dev-setup/batch/config/downloads.coco +++ b/scripts/windows/coco-dev-setup/batch/config/downloads.coco @@ -5,14 +5,18 @@ 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://s3.amazonaws.com/CodeCombatLargeFiles/python-32.msi + http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe 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 https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe + http://download.microsoft.com/download/C/6/D/C6D0FD4E-9E53-4897-9B91-836EBA2AACD3/vcredist_x86.exe diff --git a/scripts/windows/coco-dev-setup/batch/localisation/de.coco b/scripts/windows/coco-dev-setup/batch/localisation/de.coco index e385122ec..fc257a64d 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/de.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/de.coco @@ -15,10 +15,11 @@ Sind die für CodeCombat benötigten Programme bereits installiert? Wir empfehlen Ihnen, mit „Nein“ zu antorten, falls Sie unsicher sind. Überspringe Installation der Programme... - Ohne Software von Drittanbietern könnte CodeCombat nicht entwickelt werden. - Aus diesem Grund müssen Sie diese Software installieren, - um sich in der Community zu engagieren. - Wenn Sie ein Programm bereits installiert haben, brechen Sie die Installation bitte ab. + Ohne Software von Drittanbietern könnte CodeCombat nicht entwickelt werden. + Aus diesem Grund müssen Sie diese Software installieren, + um sich in der Community zu engagieren. + Wenn Sie ein Programm bereits installiert haben, brechen Sie die Installation bitte ab. + Make sure to select the option that adds the application to your Windows Path, if the option is available. Haben Sie bereits die aktuellste Version von installiert? wird heruntergeladen... @@ -71,11 +72,11 @@ Willst du das README lesen, um weitere Informationen zu erhalten? - Von nun an kannst du die Entwicklungsumgebung starten unter - einmal mit der Maus klicken. - 1) Einfach Doppelklicken - und warten bis die Entwicklungsumgebung fertig geladen hat. - 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen. - Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten! + Von nun an kannst du die Entwicklungsumgebung starten unter + einmal mit der Maus klicken. + 1) Einfach Doppelklicken + und warten bis die Entwicklungsumgebung fertig geladen hat. + 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen. + Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten! \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/en.coco b/scripts/windows/coco-dev-setup/batch/localisation/en.coco index bdf8e53d1..947890ee8 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/en.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/en.coco @@ -19,6 +19,7 @@ That's why you'll need to install this software, in order to start contributing to our community. Cancel the installation if you already have the application. + Make sure to select the option that adds the application to your Windows Path, if the option is available. Do you already have the latest version of installed? is downloading... diff --git a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco index f631124cf..654d45c97 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/nl.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/nl.coco @@ -19,6 +19,7 @@ Dat is waarom je deze software moet installeren, zodat je je kan beginnen met het bijdragen tot onze gemeenschap. Annuleer de installatie als je de applicatie al hebt. + Zorg er zeker voor dat je de optie selecteert dat de applicatie aan je Windows Path toevoegt, als de optie beschikbaar is. Heb je al de laatste versie van geinstalleerd? is aan het downloaden... diff --git a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat index 782ecb783..3c5f798fd 100755 --- a/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat +++ b/scripts/windows/coco-dev-setup/batch/scripts/download_and_install_applications.bat @@ -26,18 +26,21 @@ if %system_info_os% == XP ( ) call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 0 general general -call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 1 %system_info_os% b%system_info_bit% -call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 2 general b%system_info_bit% +call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 2 %system_info_os% b%system_info_bit% +call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 3 general b%system_info_bit% call get_local_text install_process_s1 install process s1 call get_local_text install_process_s2 install process s2 call get_local_text install_process_s3 install process s3 call get_local_text install_process_s4 install process s4 +call get_local_text install_process_winpath install process winpath echo !install_process_s1! echo !install_process_s2! echo !install_process_s3! echo !install_process_s4! +echo. +echo !install_process_winpath! call print_dashed_seperator From 4599725040274fcb73d0519f15e748dbbf389795 Mon Sep 17 00:00:00 2001 From: Glen De Cauwsemaecker Date: Fri, 4 Apr 2014 15:13:00 +0200 Subject: [PATCH 07/11] Added french and chinese as extra lanaguages for the installer. --- .../coco-dev-setup/batch/localisation/fr.coco | 82 +++++++++++++++++++ .../batch/localisation/languages.coco | 6 +- .../batch/localisation/zh-HANS.coco | 82 +++++++++++++++++++ .../batch/localisation/zh-HANT.coco | 82 +++++++++++++++++++ .../coco-dev-setup/batch/localisation/zh.coco | 82 +++++++++++++++++++ 5 files changed, 333 insertions(+), 1 deletion(-) create mode 100755 scripts/windows/coco-dev-setup/batch/localisation/fr.coco create mode 100755 scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco create mode 100755 scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco create mode 100755 scripts/windows/coco-dev-setup/batch/localisation/zh.coco diff --git a/scripts/windows/coco-dev-setup/batch/localisation/fr.coco b/scripts/windows/coco-dev-setup/batch/localisation/fr.coco new file mode 100755 index 000000000..1c92b433c --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/localisation/fr.coco @@ -0,0 +1,82 @@ + + + + français + From now on we'll send our feedback in English! + + + + -bit computer detected. + The operating system + was detected. + We don't support Windows XP, installation cancelled. + + + Have you already installed all the software needed for CodeCombat? + We recommand that you reply negative in case you're not sure. + Skipping the installation of the software... + CodeCombat couldn't be developed without third-party software. + That's why you'll need to install this software, + in order to start contributing to our community. + Cancel the installation if you already have the application. + Make sure to select the option that adds the application to your Windows Path, if the option is available. + Do you already have the latest version of + installed? + is downloading... + is installing... + is unzipping... + is cleaning... + Please define the full path where mongodb should be installed + + + + + CodeCombat is opensource, like you already know. + All our sourcecode can be found online at Github. + You can choose to do the entire Git setup yourself. + However we recommend that you instead let us handle it instead. + + + Do you want to do the Local Git setup manually yourself? + Make sure you have correctly setup your repository before processing. + Do not close this window please. + When you're ready, press any key to continue... + + + Please give the full path of your CodeCombat git repository: + Please enter the full path where you want to install your CodeCombat environment + This installation requires Git Bash. + Git bash is by default installed at 'C:\Program Files (x86)\Git'. + Git bash is by default installed at 'C:\Program Files\Git'. + Please enter the full path where git bash is installed or just press enter if it's in the default location + Do you want to checkout the repository via ssh? + + + + Installing bower, brunch, nodemon and sendwithus... + Installing bower packages... + Installing sass... + Installing npm... + Starting brunch.... + Setting up a MongoDB database for you... + Downloading the last version of the CodeCombat database... + + + + That path already exists, are you sure you want to overwrite it? + That path doesn't exist. Please try again... + + + The setup of the CodeCombat Dev. Environment was succesfull. + Thank you already for your contribution and see you soon. + Do you want to read the README for more information? + + + From now on you can start the dev. environment at + the touch of a single mouse click. + 1) Just double click + and let the environment start up. + 2) Now just open 'localhost:3000' in your prefered browser. + That's it, you're now ready to start working on CodeCombat! + + \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/languages.coco b/scripts/windows/coco-dev-setup/batch/localisation/languages.coco index da3331dfe..a267d65d0 100755 --- a/scripts/windows/coco-dev-setup/batch/localisation/languages.coco +++ b/scripts/windows/coco-dev-setup/batch/localisation/languages.coco @@ -1,3 +1,7 @@ en nl -de \ No newline at end of file +de +fr +zh +zh-HANT +zh-HANS \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco new file mode 100755 index 000000000..2eca2705c --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco @@ -0,0 +1,82 @@ + + + + 简体中文 + From now on we'll send our feedback in English! + + + + -bit computer detected. + The operating system + was detected. + We don't support Windows XP, installation cancelled. + + + Have you already installed all the software needed for CodeCombat? + We recommand that you reply negative in case you're not sure. + Skipping the installation of the software... + CodeCombat couldn't be developed without third-party software. + That's why you'll need to install this software, + in order to start contributing to our community. + Cancel the installation if you already have the application. + Make sure to select the option that adds the application to your Windows Path, if the option is available. + Do you already have the latest version of + installed? + is downloading... + is installing... + is unzipping... + is cleaning... + Please define the full path where mongodb should be installed + + + + + CodeCombat is opensource, like you already know. + All our sourcecode can be found online at Github. + You can choose to do the entire Git setup yourself. + However we recommend that you instead let us handle it instead. + + + Do you want to do the Local Git setup manually yourself? + Make sure you have correctly setup your repository before processing. + Do not close this window please. + When you're ready, press any key to continue... + + + Please give the full path of your CodeCombat git repository: + Please enter the full path where you want to install your CodeCombat environment + This installation requires Git Bash. + Git bash is by default installed at 'C:\Program Files (x86)\Git'. + Git bash is by default installed at 'C:\Program Files\Git'. + Please enter the full path where git bash is installed or just press enter if it's in the default location + Do you want to checkout the repository via ssh? + + + + Installing bower, brunch, nodemon and sendwithus... + Installing bower packages... + Installing sass... + Installing npm... + Starting brunch.... + Setting up a MongoDB database for you... + Downloading the last version of the CodeCombat database... + + + + That path already exists, are you sure you want to overwrite it? + That path doesn't exist. Please try again... + + + The setup of the CodeCombat Dev. Environment was succesfull. + Thank you already for your contribution and see you soon. + Do you want to read the README for more information? + + + From now on you can start the dev. environment at + the touch of a single mouse click. + 1) Just double click + and let the environment start up. + 2) Now just open 'localhost:3000' in your prefered browser. + That's it, you're now ready to start working on CodeCombat! + + \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco new file mode 100755 index 000000000..93bcefd87 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco @@ -0,0 +1,82 @@ + + + + 繁体中文 + From now on we'll send our feedback in English! + + + + -bit computer detected. + The operating system + was detected. + We don't support Windows XP, installation cancelled. + + + Have you already installed all the software needed for CodeCombat? + We recommand that you reply negative in case you're not sure. + Skipping the installation of the software... + CodeCombat couldn't be developed without third-party software. + That's why you'll need to install this software, + in order to start contributing to our community. + Cancel the installation if you already have the application. + Make sure to select the option that adds the application to your Windows Path, if the option is available. + Do you already have the latest version of + installed? + is downloading... + is installing... + is unzipping... + is cleaning... + Please define the full path where mongodb should be installed + + + + + CodeCombat is opensource, like you already know. + All our sourcecode can be found online at Github. + You can choose to do the entire Git setup yourself. + However we recommend that you instead let us handle it instead. + + + Do you want to do the Local Git setup manually yourself? + Make sure you have correctly setup your repository before processing. + Do not close this window please. + When you're ready, press any key to continue... + + + Please give the full path of your CodeCombat git repository: + Please enter the full path where you want to install your CodeCombat environment + This installation requires Git Bash. + Git bash is by default installed at 'C:\Program Files (x86)\Git'. + Git bash is by default installed at 'C:\Program Files\Git'. + Please enter the full path where git bash is installed or just press enter if it's in the default location + Do you want to checkout the repository via ssh? + + + + Installing bower, brunch, nodemon and sendwithus... + Installing bower packages... + Installing sass... + Installing npm... + Starting brunch.... + Setting up a MongoDB database for you... + Downloading the last version of the CodeCombat database... + + + + That path already exists, are you sure you want to overwrite it? + That path doesn't exist. Please try again... + + + The setup of the CodeCombat Dev. Environment was succesfull. + Thank you already for your contribution and see you soon. + Do you want to read the README for more information? + + + From now on you can start the dev. environment at + the touch of a single mouse click. + 1) Just double click + and let the environment start up. + 2) Now just open 'localhost:3000' in your prefered browser. + That's it, you're now ready to start working on CodeCombat! + + \ No newline at end of file diff --git a/scripts/windows/coco-dev-setup/batch/localisation/zh.coco b/scripts/windows/coco-dev-setup/batch/localisation/zh.coco new file mode 100755 index 000000000..b84d84146 --- /dev/null +++ b/scripts/windows/coco-dev-setup/batch/localisation/zh.coco @@ -0,0 +1,82 @@ + + + + 中文 + From now on we'll send our feedback in English! + + + + -bit computer detected. + The operating system + was detected. + We don't support Windows XP, installation cancelled. + + + Have you already installed all the software needed for CodeCombat? + We recommand that you reply negative in case you're not sure. + Skipping the installation of the software... + CodeCombat couldn't be developed without third-party software. + That's why you'll need to install this software, + in order to start contributing to our community. + Cancel the installation if you already have the application. + Make sure to select the option that adds the application to your Windows Path, if the option is available. + Do you already have the latest version of + installed? + is downloading... + is installing... + is unzipping... + is cleaning... + Please define the full path where mongodb should be installed + + + + + CodeCombat is opensource, like you already know. + All our sourcecode can be found online at Github. + You can choose to do the entire Git setup yourself. + However we recommend that you instead let us handle it instead. + + + Do you want to do the Local Git setup manually yourself? + Make sure you have correctly setup your repository before processing. + Do not close this window please. + When you're ready, press any key to continue... + + + Please give the full path of your CodeCombat git repository: + Please enter the full path where you want to install your CodeCombat environment + This installation requires Git Bash. + Git bash is by default installed at 'C:\Program Files (x86)\Git'. + Git bash is by default installed at 'C:\Program Files\Git'. + Please enter the full path where git bash is installed or just press enter if it's in the default location + Do you want to checkout the repository via ssh? + + + + Installing bower, brunch, nodemon and sendwithus... + Installing bower packages... + Installing sass... + Installing npm... + Starting brunch.... + Setting up a MongoDB database for you... + Downloading the last version of the CodeCombat database... + + + + That path already exists, are you sure you want to overwrite it? + That path doesn't exist. Please try again... + + + The setup of the CodeCombat Dev. Environment was succesfull. + Thank you already for your contribution and see you soon. + Do you want to read the README for more information? + + + From now on you can start the dev. environment at + the touch of a single mouse click. + 1) Just double click + and let the environment start up. + 2) Now just open 'localhost:3000' in your prefered browser. + That's it, you're now ready to start working on CodeCombat! + + \ No newline at end of file From 63f72cb45450bd5d960138952be7c3c2c6626af2 Mon Sep 17 00:00:00 2001 From: Alexei Nikitin Date: Fri, 4 Apr 2014 10:01:03 -0700 Subject: [PATCH 08/11] Update ru.coffee --- app/locale/ru.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/locale/ru.coffee b/app/locale/ru.coffee index 5f77ea288..bbe0667c3 100644 --- a/app/locale/ru.coffee +++ b/app/locale/ru.coffee @@ -226,8 +226,8 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi skip_tutorial: "Пропуск (Esc)" editor_config: "Настройки редактора" editor_config_title: "Настройки редактора" -# editor_config_language_label: "Programming Language" -# editor_config_language_description: "Define the programming language you want to code in." + editor_config_language_label: "Язык программирования" + editor_config_language_description: "Определяет язык, на котором вы хотите программировать." editor_config_keybindings_label: "Сочетания клавиш" editor_config_keybindings_default: "По умолчанию (Ace)" editor_config_keybindings_description: "Добавляет дополнительные сочетания, известные из популярных редакторов." @@ -264,8 +264,8 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi tip_patience: "Терпением ты обладать должен, юный падаван. - Yoda" tip_documented_bug: "Документированный баг не является багом; это фича." tip_impossible: "Это всегда кажется невозможным, пока не сделано. - Nelson Mandela" -# tip_talk_is_cheap: "Talk is cheap. Show me the code. - Linus Torvalds" -# tip_first_language: "The most disastrous thing that you can ever learn is your first programming language. - Alan Kay" + tip_talk_is_cheap: "Слова ничего не стоят. Покажи мне код. - Linus Torvalds" + tip_first_language: "Наиболее катастрофическая вещь, которую вы можете выучить - ваш первый язык программирования. - Alan Kay" time_current: "Текущее:" time_total: "Максимальное:" time_goto: "Перейти на:" From 7019bb6dea28c0cb5c31a5a7d475e478f662b863 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Fri, 4 Apr 2014 13:38:36 -0700 Subject: [PATCH 09/11] Added score histogram to ladder tab --- app/styles/play/ladder/ladder_tab.sass | 22 +++++++- app/views/play/ladder/ladder_tab.coffee | 72 +++++++++++++++++++++++++ server/levels/level_handler.coffee | 13 +++++ 3 files changed, 106 insertions(+), 1 deletion(-) diff --git a/app/styles/play/ladder/ladder_tab.sass b/app/styles/play/ladder/ladder_tab.sass index d4878511a..7e8c261f5 100644 --- a/app/styles/play/ladder/ladder_tab.sass +++ b/app/styles/play/ladder/ladder_tab.sass @@ -3,4 +3,24 @@ max-width: 150px white-space: nowrap overflow: hidden - text-overflow: ellipsis \ No newline at end of file + text-overflow: ellipsis + + .bar rect + fill: steelblue + shape-rendering: crispEdges + + .bar text + fill: #fff + + .specialbar rect + fill: red + + + .axis path, .axis line + fill: none + stroke: #000 + shape-rendering: crispEdges + .x.axis + color: red + + \ No newline at end of file diff --git a/app/views/play/ladder/ladder_tab.coffee b/app/views/play/ladder/ladder_tab.coffee index db4eff8ad..9ff828899 100644 --- a/app/views/play/ladder/ladder_tab.coffee +++ b/app/views/play/ladder/ladder_tab.coffee @@ -140,6 +140,18 @@ module.exports = class LadderTabView extends CocoView return if @loadingFacebookFriends or @loadingLeaderboards or @loadingGPlusFriends @startsLoading = false @render() + + render: -> + super() + + @$el.find('.histogram-display').each (i, el) => + histogramWrapper = $(el) + team = _.find @teams, name: histogramWrapper.data('team-name') + histogramData = null + $.when( + $.get("/db/level/#{@level.get('slug')}/histogram_data?team=#{team.name.toLowerCase()}", (data) -> histogramData = data) + ).then => + @generateHistogram(histogramWrapper, histogramData, team.name.toLowerCase()) getRenderData: -> ctx = super() @@ -153,6 +165,66 @@ module.exports = class LadderTabView extends CocoView ctx.onGPlus = application.gplusHandler.loggedIn ctx + generateHistogram: (histogramElement, histogramData, teamName) -> + #renders twice, hack fix + if $("#"+histogramElement.attr("id")).has("svg").length then return + histogramData = histogramData.map (d) -> d*100 + + margin = + top: 20 + right: 20 + bottom: 30 + left: 0 + + width = 300 - margin.left - margin.right + height = 125 - margin.top - margin.bottom + + formatCount = d3.format(",.0") + + x = d3.scale.linear().domain([-3000,6000]).range([0,width]) + + data = d3.layout.histogram().bins(x.ticks(20))(histogramData) + y = d3.scale.linear().domain([0,d3.max(data, (d) -> d.y)]).range([height,0]) + + #create the x axis + xAxis = d3.svg.axis().scale(x).orient("bottom").ticks(5).outerTickSize(0) + + svg = d3.select("#"+histogramElement.attr("id")).append("svg") + .attr("width", width + margin.left + margin.right) + .attr("height", height + margin.top + margin.bottom) + .append("g") + .attr("transform","translate(#{margin.left},#{margin.top})") + + bar = svg.selectAll(".bar") + .data(data) + .enter().append("g") + .attr("class","bar") + .attr("transform", (d) -> "translate(#{x(d.x)},#{y(d.y)})") + + bar.append("rect") + .attr("x",1) + .attr("width",width/20) + .attr("height", (d) -> height - y(d.y)) + if @leaderboards[teamName].session? + playerScore = @leaderboards[teamName].session.get('totalScore') * 100 + scorebar = svg.selectAll(".specialbar") + .data([playerScore]) + .enter().append("g") + .attr("class","specialbar") + .attr("transform", "translate(#{x(playerScore)},#{y(9001)})") + + scorebar.append("rect") + .attr("x",1) + .attr("width",3) + .attr("height",height - y(9001)) + + #Translate the x-axis up + svg.append("g") + .attr("class", "x axis") + .attr("transform","translate(0," + height + ")") + .call(xAxis) + + consolidateFriends: -> allFriendSessions = (@facebookFriendSessions or []).concat(@gplusFriendSessions or []) sessions = _.uniq allFriendSessions, false, (session) -> session._id diff --git a/server/levels/level_handler.coffee b/server/levels/level_handler.coffee index c58738d20..ad26fe0e1 100644 --- a/server/levels/level_handler.coffee +++ b/server/levels/level_handler.coffee @@ -36,6 +36,7 @@ LevelHandler = class LevelHandler extends Handler return @getRandomSessionPair(req,res,args[0]) if args[1] is 'random_session_pair' return @getLeaderboardFacebookFriends(req, res, args[0]) if args[1] is 'leaderboard_facebook_friends' return @getLeaderboardGPlusFriends(req, res, args[0]) if args[1] is 'leaderboard_gplus_friends' + return @getHistogramData(req, res, args[0]) if args[1] is 'histogram_data' return @sendNotFoundError(res) @@ -118,6 +119,18 @@ LevelHandler = class LevelHandler extends Handler query = Session.find(sessionQuery).select('-screenshot') query.exec (err, results) => if err then @sendDatabaseError(res, err) else @sendSuccess res, results + + getHistogramData: (req, res,slug) -> + query = Session.aggregate [ + {$match: {"levelID":slug, "submitted": true, "team":req.query.team}} + {$project: {totalScore: 1, _id: 0}} + ] + + query.exec (err, data) => + if err? then return @sendDatabaseError res, err + valueArray = _.pluck data, "totalScore" + @sendSuccess res, valueArray + getLeaderboard: (req, res, id) -> sessionsQueryParameters = @makeLeaderboardQueryParameters(req, id) From 0684bcff9c7cf8b48ed1e7aa9432d7e1dd7a3304 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Fri, 4 Apr 2014 14:22:30 -0700 Subject: [PATCH 10/11] Improved styling on graphs --- app/styles/play/ladder/ladder_tab.sass | 15 +++++++++++---- app/styles/play/ladder/my_matches_tab.sass | 18 +++++++++++++++++- app/views/play/ladder/ladder_tab.coffee | 5 ++++- app/views/play/ladder/my_matches_tab.coffee | 12 ++++++------ 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/app/styles/play/ladder/ladder_tab.sass b/app/styles/play/ladder/ladder_tab.sass index 7e8c261f5..0fe05bc9e 100644 --- a/app/styles/play/ladder/ladder_tab.sass +++ b/app/styles/play/ladder/ladder_tab.sass @@ -13,14 +13,21 @@ fill: #fff .specialbar rect - fill: red + fill: #555555 .axis path, .axis line fill: none - stroke: #000 + stroke: #555555 shape-rendering: crispEdges - .x.axis - color: red + + .humans-bar + fill: #bf3f3f + shape-rendering: crispEdges + .ogres-bar + fill: #3f44bf + shape-rendering: crispEdges + text + fill: #555555 \ No newline at end of file diff --git a/app/styles/play/ladder/my_matches_tab.sass b/app/styles/play/ladder/my_matches_tab.sass index 3483dcf38..a68f12225 100644 --- a/app/styles/play/ladder/my_matches_tab.sass +++ b/app/styles/play/ladder/my_matches_tab.sass @@ -1,7 +1,7 @@ #my-matches-tab-view .axis path, .axis line fill: none - stroke: #000 + stroke: #555 shape-rendering: crispEdges .x.axis.path display: none @@ -10,4 +10,20 @@ fill: none stroke: steelblue stroke-width: 1.5px + + .humans-line + fill: none + stroke: #bf3f3f + stroke-width: 1.5px + + .ogres-line + fill: none + stroke: #3f44bf + stroke-width: 1.5px + .axis text + stroke: none + fill: #555555 + shape-rendering: crispEdges + + \ No newline at end of file diff --git a/app/views/play/ladder/ladder_tab.coffee b/app/views/play/ladder/ladder_tab.coffee index 922e917ba..b4ae1e62f 100644 --- a/app/views/play/ladder/ladder_tab.coffee +++ b/app/views/play/ladder/ladder_tab.coffee @@ -191,11 +191,14 @@ module.exports = class LadderTabView extends CocoView .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform","translate(#{margin.left},#{margin.top})") + barClass = "bar" + if teamName.toLowerCase() is "ogres" then barClass = "ogres-bar" + if teamName.toLowerCase() is "humans" then barClass = "humans-bar" bar = svg.selectAll(".bar") .data(data) .enter().append("g") - .attr("class","bar") + .attr("class",barClass) .attr("transform", (d) -> "translate(#{x(d.x)},#{y(d.y)})") bar.append("rect") diff --git a/app/views/play/ladder/my_matches_tab.coffee b/app/views/play/ladder/my_matches_tab.coffee index 94e4f4731..e3f0fc62a 100644 --- a/app/views/play/ladder/my_matches_tab.coffee +++ b/app/views/play/ladder/my_matches_tab.coffee @@ -117,12 +117,10 @@ module.exports = class MyMatchesTabView extends CocoView @$el.find('.score-chart-wrapper').each (i, el) => scoreWrapper = $(el) team = _.find @teams, name: scoreWrapper.data('team-name') - @generateScoreLineChart(scoreWrapper.attr('id'), team.scoreHistory) + @generateScoreLineChart(scoreWrapper.attr('id'), team.scoreHistory, team.name) - generateScoreLineChart: (wrapperID, scoreHistory) => - - + generateScoreLineChart: (wrapperID, scoreHistory,teamName) => margin = top: 20 right: 20 @@ -167,10 +165,12 @@ module.exports = class MyMatchesTabView extends CocoView .attr("dy", ".75em") .style("text-anchor","end") .text("Score") - + lineClass = "line" + if teamName.toLowerCase() is "ogres" then lineClass = "ogres-line" + if teamName.toLowerCase() is "humans" then lineClass = "humans-line" svg.append("path") .datum(data) - .attr("class","line") + .attr("class",lineClass) .attr("d",line) From 2411269f2b57557f23632428eb3f5333090b5932 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Fri, 4 Apr 2014 14:55:55 -0700 Subject: [PATCH 11/11] Added rank/number of sessions text --- app/styles/play/ladder/ladder_tab.sass | 9 +++++++++ app/views/play/ladder/ladder_tab.coffee | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/styles/play/ladder/ladder_tab.sass b/app/styles/play/ladder/ladder_tab.sass index 0fe05bc9e..6d65cc5a6 100644 --- a/app/styles/play/ladder/ladder_tab.sass +++ b/app/styles/play/ladder/ladder_tab.sass @@ -30,4 +30,13 @@ text fill: #555555 + .rank-text + font-size: 15px + fill: #555555 + + .humans-rank-text + fill: #bf3f3f + + .ogres-rank-text + fill: #3f44bf \ No newline at end of file diff --git a/app/views/play/ladder/ladder_tab.coffee b/app/views/play/ladder/ladder_tab.coffee index b4ae1e62f..635d7c69d 100644 --- a/app/views/play/ladder/ladder_tab.coffee +++ b/app/views/play/ladder/ladder_tab.coffee @@ -217,7 +217,20 @@ module.exports = class LadderTabView extends CocoView .attr("x",1) .attr("width",3) .attr("height",height - y(9001)) - + rankClass = "rank-text" + if teamName.toLowerCase() is "ogres" then rankClass = "rank-text ogres-rank-text" + if teamName.toLowerCase() is "humans" then rankClass = "rank-text humans-rank-text" + + message = "#{histogramData.length} players" + if @leaderboards[teamName].session? then message="#{@leaderboards[teamName].myRank}/#{histogramData.length}" + svg.append("g") + .append("text") + .attr("class",rankClass) + .attr("y",0) + .attr("text-anchor","end") + .attr("x",width) + .text(message) + #Translate the x-axis up svg.append("g") .attr("class", "x axis")