Permalink
Browse files

Python -> Scala

Doing some general clean up and applying patch from
 beaugunderson@41348c5
Adding travis ci
  • Loading branch information...
1 parent 75bde43 commit 1ed2b9435aa08ac8ee47218091e1c6c4f164df01 @kelvl kelvl committed Apr 28, 2013
Showing with 5,290 additions and 1,897 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 .travis.yml
  3. +0 −1 MANIFEST.in
  4. +0 −184 ci.xml
  5. +0 −59 debug_shadow.conf.py
  6. +41 −0 project/Build.scala
  7. +1 −0 project/build.properties
  8. +11 −0 project/plugins.sbt
  9. +0 −27 setup.py
  10. +0 −80 shadow.conf.py
  11. +33 −0 src/main/resources/application.conf
  12. 0 src/{shadow/ui → main/resources}/static/css/bootstrap-responsive.css
  13. 0 src/{shadow/ui → main/resources}/static/css/bootstrap-responsive.min.css
  14. 0 src/{shadow/ui → main/resources}/static/css/bootstrap.css
  15. 0 src/{shadow/ui → main/resources}/static/css/bootstrap.min.css
  16. +483 −0 src/main/resources/static/css/ng-grid.css
  17. BIN src/{shadow/ui → main/resources}/static/img/glyphicons-halflings-white.png
  18. BIN src/{shadow/ui → main/resources}/static/img/glyphicons-halflings.png
  19. +312 −0 src/main/resources/static/index.html
  20. 0 src/{shadow/ui → main/resources}/static/js/angular-1.0.1.min.js
  21. +162 −0 src/main/resources/static/js/angular-1.0.6.min.js
  22. 0 src/{shadow/ui → main/resources}/static/js/bootstrap.js
  23. 0 src/{shadow/ui → main/resources}/static/js/bootstrap.min.js
  24. 0 src/{shadow/ui → main/resources}/static/js/diff.js
  25. 0 src/{shadow/ui → main/resources}/static/js/jquery-1.7.2.min.js
  26. +5 −0 src/main/resources/static/js/jquery-1.9.1.min.js
  27. +2 −0 src/main/resources/static/js/ng-grid-2.0.3.min.js
  28. +3,319 −0 src/main/resources/static/js/ng-grid-2.0.4.debug.js
  29. +2 −0 src/main/resources/static/js/ng-grid-2.0.4.min.js
  30. +268 −0 src/main/resources/static/js/shadow.js
  31. 0 src/{shadow/ui → main/resources}/static/js/socket.io.js
  32. 0 src/{shadow/ui → main/resources}/static/js/underscore-min.js
  33. +29 −0 src/main/resources/static/rowTemplate.html
  34. +44 −0 src/main/scala/com/twilio/shadow/Boot.scala
  35. +79 −0 src/main/scala/com/twilio/shadow/HubActor.scala
  36. +79 −0 src/main/scala/com/twilio/shadow/ProxyService.scala
  37. +132 −0 src/main/scala/com/twilio/shadow/UIService.scala
  38. 0 src/shadow/__init__.py
  39. 0 src/shadow/common/__init__.py
  40. +0 −28 src/shadow/common/logfile.py
  41. 0 src/shadow/proxy/__init__.py
  42. +0 −179 src/shadow/proxy/web.py
  43. +0 −45 src/shadow/service.py
  44. 0 src/shadow/services/__init__.py
  45. +0 −53 src/shadow/services/proxy.py
  46. +0 −46 src/shadow/services/ui.py
  47. 0 src/shadow/ui/__init__.py
  48. +0 −336 src/shadow/ui/static/index.html
  49. +0 −203 src/shadow/ui/static/js/shadow.js
  50. +0 −9 src/shadow/ui/web.py
  51. +251 −0 src/test/scala/com/twilio/shadow/ProxySuite.scala
  52. +33 −0 src/test/scala/com/twilio/shadow/UISuite.scala
  53. +0 −4 tests/requirements.txt
  54. +0 −3 tests/scripts/build.sh
  55. +0 −51 tests/scripts/install_python_packages.sh
  56. +0 −26 tests/scripts/make_virtualenv.sh
  57. +0 −10 tests/scripts/test.sh
  58. +0 −470 tests/unit/test_proxy_flask.py
  59. +0 −83 tests/unit/test_proxy_service.py
View
@@ -1,2 +1,3 @@
*.pyc
*.log
+target/
View
@@ -0,0 +1,3 @@
+language: scala
+scala:
+ - 2.10.0
View
@@ -1 +0,0 @@
-recursive-include src/shadow/ui/static *
View
184 ci.xml
@@ -1,184 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<project>
- <actions/>
- <description></description>
- <keepDependencies>false</keepDependencies>
- <properties>
- <com.coravy.hudson.plugins.github.GithubProjectProperty>
- <projectUrl>https://code.corp.twilio.com/{namespace}/{project}/</projectUrl>
- </com.coravy.hudson.plugins.github.GithubProjectProperty>
- </properties>
- <scm class="hudson.plugins.git.GitSCM">
- <configVersion>2</configVersion>
- <userRemoteConfigs>
- <hudson.plugins.git.UserRemoteConfig>
- <name>origin</name>
- <refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
- <url>git@code.corp.twilio.com:{namespace}/{project}.git</url>
- </hudson.plugins.git.UserRemoteConfig>
- </userRemoteConfigs>
- <branches>
- <hudson.plugins.git.BranchSpec>
- <name>{branch}</name>
- </hudson.plugins.git.BranchSpec>
- </branches>
- <recursiveSubmodules>false</recursiveSubmodules>
- <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
- <authorOrCommitter>false</authorOrCommitter>
- <clean>false</clean>
- <wipeOutWorkspace>false</wipeOutWorkspace>
- <pruneBranches>false</pruneBranches>
- <remotePoll>false</remotePoll>
- <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
- <gitTool>Default</gitTool>
- <browser class="hudson.plugins.git.browser.GithubWeb">
- <url>https://code.corp.twilio.com/{namespace}/{project}/</url>
- </browser>
- <submoduleCfg class="list"/>
- <relativeTargetDir></relativeTargetDir>
- <excludedRegions></excludedRegions>
- <excludedUsers></excludedUsers>
- <gitConfigName></gitConfigName>
- <gitConfigEmail></gitConfigEmail>
- <skipTag>false</skipTag>
- <scmName></scmName>
- </scm>
- <canRoam>true</canRoam>
- <disabled>false</disabled>
- <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
- <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
- <triggers class="vector"/>
- <concurrentBuild>false</concurrentBuild>
- <builders>
- <hudson.tasks.Shell>
- <command>./tests/scripts/build.sh</command>
- </hudson.tasks.Shell>
- <hudson.tasks.Shell>
- <command>./tests/scripts/test.sh</command>
- </hudson.tasks.Shell>
- </builders>
- <publishers>
- <hudson.plugins.cobertura.CoberturaPublisher>
- <coberturaReportFile>tests-output/cobertura/*</coberturaReportFile>
- <onlyStable>false</onlyStable>
- <healthyTarget>
- <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>70</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>80</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>METHOD</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>80</int>
- </entry>
- </targets>
- </healthyTarget>
- <unhealthyTarget>
- <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>METHOD</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- </targets>
- </unhealthyTarget>
- <failingTarget>
- <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- <entry>
- <hudson.plugins.cobertura.targets.CoverageMetric>METHOD</hudson.plugins.cobertura.targets.CoverageMetric>
- <int>0</int>
- </entry>
- </targets>
- </failingTarget>
- <sourceEncoding>ASCII</sourceEncoding>
- </hudson.plugins.cobertura.CoberturaPublisher>
- <hudson.tasks.junit.JUnitResultArchiver>
- <testResults>tests-output/xunit/*</testResults>
- <keepLongStdio>false</keepLongStdio>
- <testDataPublishers/>
- </hudson.tasks.junit.JUnitResultArchiver>
- <hudson.plugins.emailext.ExtendedEmailPublisher>
- <recipientList>{recipients}</recipientList>
- <configuredTriggers>
- <hudson.plugins.emailext.plugins.trigger.UnstableTrigger>
- <email>
- <recipientList></recipientList>
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
- <body>$PROJECT_DEFAULT_CONTENT</body>
- <sendToDevelopers>true</sendToDevelopers>
- <sendToRequester>true</sendToRequester>
- <includeCulprits>true</includeCulprits>
- <sendToRecipientList>true</sendToRecipientList>
- </email>
- </hudson.plugins.emailext.plugins.trigger.UnstableTrigger>
- <hudson.plugins.emailext.plugins.trigger.FailureTrigger>
- <email>
- <recipientList></recipientList>
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
- <body>$PROJECT_DEFAULT_CONTENT</body>
- <sendToDevelopers>true</sendToDevelopers>
- <sendToRequester>true</sendToRequester>
- <includeCulprits>true</includeCulprits>
- <sendToRecipientList>true</sendToRecipientList>
- </email>
- </hudson.plugins.emailext.plugins.trigger.FailureTrigger>
- <hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
- <email>
- <recipientList></recipientList>
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
- <body>$PROJECT_DEFAULT_CONTENT</body>
- <sendToDevelopers>true</sendToDevelopers>
- <sendToRequester>true</sendToRequester>
- <includeCulprits>true</includeCulprits>
- <sendToRecipientList>true</sendToRecipientList>
- </email>
- </hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
- <hudson.plugins.emailext.plugins.trigger.FixedTrigger>
- <email>
- <recipientList></recipientList>
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
- <body>$PROJECT_DEFAULT_CONTENT</body>
- <sendToDevelopers>true</sendToDevelopers>
- <sendToRequester>true</sendToRequester>
- <includeCulprits>true</includeCulprits>
- <sendToRecipientList>true</sendToRecipientList>
- </email>
- </hudson.plugins.emailext.plugins.trigger.FixedTrigger>
- <hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger>
- <email>
- <recipientList></recipientList>
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
- <body>$PROJECT_DEFAULT_CONTENT</body>
- <sendToDevelopers>true</sendToDevelopers>
- <sendToRequester>true</sendToRequester>
- <includeCulprits>true</includeCulprits>
- <sendToRecipientList>true</sendToRecipientList>
- </email>
- </hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger>
- </configuredTriggers>
- <contentType>default</contentType>
- <defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
- <defaultContent>$DEFAULT_CONTENT</defaultContent>
- </hudson.plugins.emailext.ExtendedEmailPublisher>
- </publishers>
- <buildWrappers/>
-</project>
View
@@ -1,59 +0,0 @@
-# Application parameters
-ui = {
- 'port': 9000,
- 'address': 'localhost',
-}
-
-proxy = {
- 'address': 'localhost',
- 'port': 8081,
- 'true_servers': ['http://10.4.115.162:8081/'],
- 'true_servers_timeout': 5.0,
- 'shadow_servers': ['http://10.4.67.69:8081/'],
- 'shadow_servers_timeout': 5.0,
-
- 'true_servers_additional_get_params': [],
- 'true_servers_additional_post_params': [],
- 'true_servers_additional_headers': [],
-
- 'shadow_servers_additional_get_params': [],
- 'shadow_servers_additional_post_params': [],
- 'shadow_servers_additional_headers': [],
-}
-
-service = 'shadow.service.ShadowService'
-
-program_name = "shadow"
-
-from pytwilio.log import make_log_config
-import os
-
-debug = True
-
-file_prefix = './log/'
-logconfig = make_log_config('shadow', True, {
- 'handlers': {
- 'console': {
- "class": "logging.StreamHandler",
- "formatter": "twilio",
- "stream": "ext://sys.stderr"
- },
- 'results': {
- 'class': 'pytwilio.log.MultiFileHandler',
- 'formatter': 'twilio_pywsgi_access_fix',
- "filename": os.path.join(file_prefix, "{}-results.log".format(program_name))
- }
- },
- 'loggers': {
- 'shadow': {
- 'level': 'DEBUG',
- 'propogate': 0,
- 'handlers': ['console']
- },
- 'shadow.results': {
- 'level': 'DEBUG',
- 'propogate': 0,
- 'handlers': ['results']
- }
- }
- })
View
@@ -0,0 +1,41 @@
+import sbt._
+import sbt.Keys._
+import sbtassembly.Plugin._
+import AssemblyKeys._
+import spray.revolver.RevolverPlugin._
+
+object ShadowBuild extends Build {
+
+ lazy val shadow = Project(
+ id = "shadow",
+ base = file("."),
+ settings = Project.defaultSettings ++ Revolver.settings ++ assemblySettings ++ Seq(
+ name := "shadow",
+ organization := "com.twilio",
+ scalaVersion := "2.10.0",
+ mainClass in assembly := Some("com.twilio.shadow.Boot"),
+ assembleArtifact in packageScala := true, //exclude scala library from assembly artifact
+ test in assembly := {}, //disable running test when creating assembly aritifact
+ assemblyCacheOutput in assembly := true,
+ libraryDependencies ++= List(
+
+ "io.spray" % "spray-can" % "1.1-M7",
+ "io.spray" % "spray-routing" % "1.1-M7",
+ "io.spray" % "spray-testkit" % "1.1-M7",
+ "com.typesafe.akka" %% "akka-actor" % "2.1.0",
+ "org.json4s" %% "json4s-native" % "3.2.4",
+ "nl.grons" %% "metrics-scala" % "2.2.0",
+
+ // test
+ "org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
+ "com.xebialabs.restito" % "restito" % "0.4-alpha-2" % "test",
+ "com.typesafe.akka" %% "akka-testkit" % "2.1.0" % "test"
+
+ ),
+ compileOrder := CompileOrder.Mixed,
+ mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) => { case x => old(x) }},
+ classpathTypes ~= (_ + "orbit"),
+ resolvers ++= List("Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/")
+ )
+ )
+}
View
@@ -0,0 +1 @@
+sbt.version=0.12.1
View
@@ -0,0 +1,11 @@
+addSbtPlugin("io.spray" % "sbt-revolver" % "0.6.2")
+
+resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
+
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0-SNAPSHOT")
+
+resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
+
+addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.6")
+
+addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7")
View
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-#
-# $Id: $
-
-from setuptools import setup, find_packages
-
-setup(name='shadow',
- version='0.1',
- author='Kelvin Law',
- author_email='kelvin@twilio.com',
- description='Shadow proxy',
- packages = find_packages('src'),
- package_dir = {'': 'src'},
- include_package_data = True,
- install_requires = [
- # 3rd party
- 'gevent==1.0b3',
- 'ginkgo==twilio-rc2',
- 'flask==0.9',
- 'requests==0.13.6',
- 'gevent-socketio==0.3.5-rc2',
-
- # internal dependencies
- 'pytwilio.log==0.1',
- 'pytwilio.shared==0.1',
- ]
- )
Oops, something went wrong.

0 comments on commit 1ed2b94

Please sign in to comment.