From 6457f669b8b903f61a3f215da79a0cc37fe53713 Mon Sep 17 00:00:00 2001 From: saniyanajeeb Date: Mon, 13 Apr 2020 12:09:43 +0530 Subject: [PATCH 1/5] Configure Dr Elephant to publish to bintray --- build.sbt | 4 ++++ project/plugins.sbt | 3 +++ 2 files changed, 7 insertions(+) diff --git a/build.sbt b/build.sbt index 32b8a3be9..ff8cc55c9 100644 --- a/build.sbt +++ b/build.sbt @@ -38,3 +38,7 @@ playJavaSettings scalaVersion := "2.10.4" envVars in Test := Map("PSO_DIR_PATH" -> (baseDirectory.value / "scripts/pso").getAbsolutePath) + +licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")) + +bintrayOrganization := Some("linkedin") \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index f40af3113..80a40796e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -24,3 +24,6 @@ addSbtPlugin("com.typesafe.play" % "sbt-plugin" % Option(System.getProperty("pla // Jacoco code coverage plugin addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6") + +// An sbt plugin for publishing bintray packages. +addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6") \ No newline at end of file From f5026f1134a8e69faf7428faf75a5708c64e8548 Mon Sep 17 00:00:00 2001 From: saniyanajeeb Date: Mon, 13 Apr 2020 12:12:25 +0530 Subject: [PATCH 2/5] indentation fix --- build.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index ff8cc55c9..44a22326e 100644 --- a/build.sbt +++ b/build.sbt @@ -41,4 +41,4 @@ envVars in Test := Map("PSO_DIR_PATH" -> (baseDirectory.value / "scripts/pso").g licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")) -bintrayOrganization := Some("linkedin") \ No newline at end of file +bintrayOrganization := Some("linkedin") diff --git a/project/plugins.sbt b/project/plugins.sbt index 80a40796e..1bf5b0290 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -26,4 +26,4 @@ addSbtPlugin("com.typesafe.play" % "sbt-plugin" % Option(System.getProperty("pla addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6") // An sbt plugin for publishing bintray packages. -addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6") \ No newline at end of file +addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6") From 05e4c1e0259912f93c5d96990f865970bc3485c8 Mon Sep 17 00:00:00 2001 From: saniyanajeeb Date: Fri, 17 Apr 2020 13:19:00 +0530 Subject: [PATCH 3/5] Adding a script to automate build and publish --- build.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..b5df760c7 --- /dev/null +++ b/build.sh @@ -0,0 +1,27 @@ +BUILD_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +# Enable analytics in the conf file. +sed -i.bak 's/^enable_analytics=false$/enable_analytics=true/' $BUILD_PATH/app-conf/elephant.conf +rm -rf "$BUILD_PATH"/app-conf/elephant.conf.bak + +cd $BUILD_PATH/ + +# Compile the Dr Elephant code +bash ./compile.sh + +# Generate the pom file (other artifacts are disabled) and publish to bintray +sbt clean 'set publishArtifact in (Compile, packageBin) := false' 'set publishArtifact in (Compile, packageDoc) := false' 'set publishArtifact in (Compile, packageSrc) := false' publish + +MODULE=dr-elephant_2.10 + +VERSION=`sed -n 's/.*version := \"\([^"]*\)\".*/\1/p' $BUILD_PATH/build.sbt` + +mv $BUILD_PATH/dist/dr-elephant*.zip $BUILD_PATH/dist/$MODULE-$VERSION.zip + +cd dist/ + +echo "Uploading the distribution to bintray" +curl -T $MODULE-"$VERSION".zip -u"$1":"$2" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/com/linkedin/drelephant/$MODULE/"$VERSION"/ --verbose + +echo "Publishing the uploaded distribution" +curl -X POST -u"$1":"$2" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/publish --verbose \ No newline at end of file From 25ff778339ecbe72c43325f17bf3109180fd4e06 Mon Sep 17 00:00:00 2001 From: saniyanajeeb Date: Fri, 17 Apr 2020 17:39:26 +0530 Subject: [PATCH 4/5] fix in build.sh to take values from env variables --- build.sh | 14 ++++++++++---- public/assets/analytics/track.js | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index b5df760c7..38cfebc29 100755 --- a/build.sh +++ b/build.sh @@ -6,8 +6,14 @@ rm -rf "$BUILD_PATH"/app-conf/elephant.conf.bak cd $BUILD_PATH/ -# Compile the Dr Elephant code -bash ./compile.sh + +# Compile Dr Elephant code with the script provided. An optional conf file can be passed in. +if [ -z "$1" ]; +then + bash ./compile.sh +else + bash ./compile.sh $1 +fi # Generate the pom file (other artifacts are disabled) and publish to bintray sbt clean 'set publishArtifact in (Compile, packageBin) := false' 'set publishArtifact in (Compile, packageDoc) := false' 'set publishArtifact in (Compile, packageSrc) := false' publish @@ -21,7 +27,7 @@ mv $BUILD_PATH/dist/dr-elephant*.zip $BUILD_PATH/dist/$MODULE-$VERSION.zip cd dist/ echo "Uploading the distribution to bintray" -curl -T $MODULE-"$VERSION".zip -u"$1":"$2" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/com/linkedin/drelephant/$MODULE/"$VERSION"/ --verbose +curl -T $MODULE-"$VERSION".zip -u"$BINTRAY_USER":"$BINTRAY_PASS" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/com/linkedin/drelephant/$MODULE/"$VERSION"/ --verbose echo "Publishing the uploaded distribution" -curl -X POST -u"$1":"$2" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/publish --verbose \ No newline at end of file +curl -X POST -u"$BINTRAY_USER":"$BINTRAY_PASS" https://api.bintray.com/content/linkedin/maven/dr-elephant/"$VERSION"/publish --verbose \ No newline at end of file diff --git a/public/assets/analytics/track.js b/public/assets/analytics/track.js index e5e099f45..07ddeb9e9 100644 --- a/public/assets/analytics/track.js +++ b/public/assets/analytics/track.js @@ -1,6 +1,12 @@ -/* - Paste the tracking javascript snippet into this file for web analytics. - This javascript file will be included into every page in the application. - See comments section above 'enable.analytics' in the application.conf file for - more information. -*/ \ No newline at end of file +// Piwik + var _paq = _paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="//piwik.corp.linkedin.com/piwik/"; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', 86]); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + })(); +// End Piwik Code \ No newline at end of file From 0301419b1733779396dad01a08931cd5077fd32a Mon Sep 17 00:00:00 2001 From: saniyanajeeb Date: Fri, 17 Apr 2020 17:40:48 +0530 Subject: [PATCH 5/5] fix --- public/assets/analytics/track.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/assets/analytics/track.js b/public/assets/analytics/track.js index 07ddeb9e9..bd2bdda08 100644 --- a/public/assets/analytics/track.js +++ b/public/assets/analytics/track.js @@ -1,3 +1,4 @@ + // Piwik var _paq = _paq || []; _paq.push(['trackPageView']); @@ -9,4 +10,4 @@ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); -// End Piwik Code \ No newline at end of file +// End Piwik Code