forked from suparna-khamaru/rps-ant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cameron
committed
Nov 26, 2020
1 parent
490f388
commit 6aae104
Showing
49 changed files
with
2,141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- ====================================================================== --> | ||
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. --> | ||
<!-- ====================================================================== --> | ||
|
||
<project name="roshambo" default="package" basedir="."> | ||
|
||
<!-- ====================================================================== --> | ||
<!-- Import maven-build.xml into the current project --> | ||
<!-- ====================================================================== --> | ||
|
||
<import file="maven-build.xml"/> | ||
|
||
<!-- ====================================================================== --> | ||
<!-- Help target --> | ||
<!-- ====================================================================== --> | ||
|
||
<target name="help"> | ||
<echo message="Please run: $ant -projecthelp"/> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
<html> | ||
<head> | ||
<title>Rock Paper Scissors!!!</title> <html> | ||
</head> | ||
|
||
<body> | ||
|
||
Which one will it be?<br/> | ||
<a href="#" onclick="playRoshambo('rock')"> rock </a> | ||
<a href="#" onclick="playRoshambo('paper')"> paper </a> | ||
<a href="#" onclick="playRoshambo('scissors')"> scissors </a> | ||
|
||
<br/> | ||
<div id="results"></div> | ||
<div id="wins"></div> | ||
<div id="losses"></div> | ||
<div id="ties"></div> | ||
<div id="history"></div> | ||
|
||
</body> | ||
</html> | ||
|
||
<script> | ||
|
||
playRoshambo = function(clientGesture) { | ||
console.log("************** Playing Roshambo *****************"); | ||
let gameService = new GameService(); | ||
let gameSummary = gameService.playGame(clientGesture); | ||
let theScore = gameService.getScore(); | ||
|
||
console.log("Here is the returned gs: " + gameSummary + " :---:"); | ||
|
||
document.getElementById('results').innerHTML = gameSummary.result; | ||
document.getElementById('wins').innerHTML = theScore.wins; | ||
document.getElementById('losses').innerHTML = theScore.losses; | ||
document.getElementById('ties').innerHTML = theScore.ties; | ||
|
||
renderGameHistory(gameService.getGameHistory()); | ||
|
||
} | ||
|
||
|
||
renderGameHistory = function(gameHistory){ | ||
console.log("************** RENDERING GAME HISTORY *****************"); | ||
let output = "<table><tr><th>Client</th><th>Server</th><th>Result</th><th>Date</th></tr>"; | ||
for (let i=0; i < gameHistory.length; i++){ | ||
let gameSummary = gameHistory[i]; | ||
let date = gameSummary.date; | ||
console.log(gameSummary); | ||
output = output + " <tr>"; | ||
output = output + " <td> " + gameSummary.clientGesture + " </td> "; | ||
output = output + " <td> " + gameSummary.serverGesture + " </td> "; | ||
output = output + " <td> " + gameSummary.result + " </td> "; | ||
output = output + " <td> " + date + " </td> "; | ||
output = output + " </tr>"; | ||
console.log(output); | ||
} | ||
output = output + "</table>"; | ||
document.getElementById('history').innerHTML = output; | ||
|
||
} | ||
|
||
</script> | ||
|
||
|
||
<script> | ||
function Score() { | ||
|
||
this.wins=0; | ||
this.losses=0; | ||
this.ties=0; | ||
|
||
this.increaseWins = function(){ | ||
this.wins++; | ||
} | ||
this.increaseLosses = function(){ | ||
this.losses++; | ||
} | ||
this.increaseTies = function(){ | ||
this.ties++; | ||
} | ||
this.toString = function(){ | ||
output = "Wins: " + this.wins + " Ties: " + this.ties + " Losses: " + this.losses; | ||
return output; | ||
} | ||
} | ||
</script> | ||
|
||
<script> | ||
function GameSummary(client, server, result) { | ||
|
||
this.clientGesture=client; | ||
this.serverGesture=server; | ||
this.result=result; | ||
this.date=new Date(); | ||
|
||
this.getClientGesture = function(){ | ||
this.clientGesture; | ||
} | ||
|
||
this.getServerGesture = function(){ | ||
this.serverGesture; | ||
} | ||
|
||
this.getResult = function(){ | ||
this.result; | ||
} | ||
|
||
this.getDate = function(){ | ||
this.date; | ||
} | ||
|
||
this.toString = function() { | ||
let output = "Client :: " + this.clientGesture; | ||
let simpleDate = this.date.toLocaleDateString("en-US"); | ||
output = output + " :: Server :: " + this.serverGesture; | ||
output = output + " :: Result :: " + this.result; | ||
output = output + " :: Time played :: " + simpleDate; | ||
return output; | ||
} | ||
} | ||
</script> | ||
|
||
<script> | ||
let theScore = new Score(); | ||
var gameHistory =[]; | ||
function GameService() { | ||
|
||
this.getScore = function() { | ||
return theScore; | ||
} | ||
|
||
this.getGameHistory = function() { | ||
return gameHistory; | ||
} | ||
|
||
this.playGame = function(input) { | ||
|
||
let result = "error"; | ||
|
||
if (input==("scissors")) { | ||
result = "lose"; | ||
theScore.increaseLosses(); | ||
} | ||
|
||
if (input==("paper")) { | ||
result = "win"; | ||
theScore.increaseWins(); | ||
} | ||
|
||
if (input==("rock")) { | ||
result = "tie"; | ||
theScore.increaseTies(); | ||
} | ||
|
||
if (result == "error") { return; } | ||
console.log("The is the result: " + result); | ||
|
||
let gameSummary = new GameSummary(input, "rock", result); | ||
gameHistory.unshift(gameSummary); | ||
this.printGameHistory(gameHistory); | ||
|
||
console.log(theScore.toString()); | ||
console.log("Number of wins: " + theScore.wins); | ||
console.log(gameSummary + " :: "); | ||
return gameSummary; | ||
|
||
} | ||
|
||
this.printGameHistory = function(gameHistory){ | ||
console.log("************** GAME HISTORY *****************"); | ||
let aggregate = ""; | ||
for (let i=0; i < gameHistory.length; i++){ | ||
let gameSummary = gameHistory[i]; | ||
console.log(gameSummary); | ||
let output = "Client :: " + gameSummary.clientGesture; | ||
output = output + " :: Server :: " + gameSummary.serverGesture; | ||
output = output + " :: Result :: " + gameSummary.result; | ||
output = output + " :: Time played :: " + gameSummary.date; | ||
console.log(output); | ||
aggregate = aggregate + output + "<br/>"; | ||
} | ||
document.getElementById('history').innerHTML = aggregate; | ||
console.log("***********END OF GAME HISTORY *****************"); | ||
|
||
} | ||
} | ||
|
||
</script> | ||
|
||
<script> | ||
|
||
/* | ||
let gs = new GameService(); | ||
gs.playGame("paper"); | ||
var gameHistory =[]; | ||
{ | ||
let gameSummary = new GameSummary("rock","rock","tie"); | ||
gameHistory.unshift(gameSummary); | ||
} | ||
{ | ||
let gameSummary = new GameSummary("paper","rock","loss"); | ||
gameHistory.unshift(gameSummary); | ||
} | ||
{ | ||
let gameSummary = new GameSummary("scissors","paper","win"); | ||
gameHistory.unshift(gameSummary); | ||
} | ||
console.log(gameHistory); | ||
var score = new Score(); | ||
score.increaseWins(); | ||
score.increaseWins(); | ||
score.increaseTies(); | ||
score.increaseLosses(); | ||
console.log(score.wins); | ||
console.log(score.toString()); | ||
*/ | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
#stop any running services | ||
sudo service apache2 stop | ||
sudo service jenkins stop | ||
sudo service nginx stop | ||
|
||
#Java | ||
sudo add-apt-repository ppa:webupd8team/java | ||
sudo apt update | ||
sudo apt install oracle-java8-installer -y | ||
|
||
#Git and Maven | ||
sudo apt update | ||
sudo apt install git-all -y | ||
sudo apt-get install maven | ||
git config --global user.name "Triple Baconator" | ||
git config --global user.email [email protected] | ||
sudo apt-get install tree | ||
sudo apt-get install git-flow | ||
|
||
#Jenkins | ||
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - | ||
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' | ||
sudo apt-get update | ||
sudo apt-get install jenkins -y | ||
|
||
#Artifactory | ||
|
||
wget https://bintray.com/jfrog/artifactory/download_file?file_path=jfrog-artifactory-oss-6.5.2.zip | ||
# unzip jfrog-artifactory-oss-6.5.2.zip | ||
unzip download_file?file_path=jfrog-artifactory-oss-6.5.2.zip | ||
cd art* | ||
cd bin* | ||
sudo ./installService.sh | ||
# sudo service artifactory start | ||
|
||
#Docker | ||
sudo apt-get update | ||
sudo apt-get -y install docker.io | ||
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker | ||
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io | ||
sudo update-rc.d docker.io defaults | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE! | ||
#Thu Nov 26 17:44:22 EST 2020 | ||
project.build.directory=${maven.build.dir} | ||
maven.build.testDir.0=src/test/java | ||
maven.build.finalName=roshambo | ||
maven.compiler.source=1.8 | ||
maven.reporting.outputDirectory=${maven.build.dir}/site | ||
maven.test.reports=${maven.build.dir}/test-reports | ||
maven.build.testOutputDir=${maven.build.dir}/test-classes | ||
maven.settings.offline=false | ||
maven.settings.interactiveMode=true | ||
maven.build.srcDir.0=src/main/java | ||
maven.compiler.target=1.8 | ||
maven.build.outputDir=${maven.build.dir}/classes | ||
project.build.outputDirectory=${maven.build.outputDir} | ||
project.build.sourceEncoding=UTF-8 | ||
maven.build.testResourceDir.0=src/test/resources | ||
maven.repo.local=${user.home}/.m2/repository | ||
maven.build.resourceDir.0=src/main/resources | ||
maven.build.dir=target |
Oops, something went wrong.