Permalink
Browse files

Merge branch 'scrooge'

  • Loading branch information...
2 parents 7356d60 + 41454f2 commit af944c5074d745215cac6e3d6979dce05b543c62 Robey Pointer committed Nov 18, 2011
View
@@ -86,7 +86,7 @@ end
root = File.expand_path(File.dirname(__FILE__) + "/../lib/template")
-Dir["#{root}/**/*"].select{|path| File.file?(path)}.each do |path|
+Dir["#{root}/**/*"].select { |path| File.file?(path) }.each do |path|
relative = path.sub("#{root}/", "")
content = File.read(path)
template = ERB.new(content, nil, nil, "@output")
@@ -115,7 +115,12 @@ if File.exists?("src/scripts/startup.sh")
$files << startup
end
-[ "src/scripts/#{project_name.downcase}.sh", "src/scripts/console", "run" ].each do |executable|
+[
+ "src/scripts/#{project_name.downcase}.sh",
+ "src/scripts/console",
+ "src/scripts/devel.sh",
+ "run"
+].each do |executable|
`chmod +x #{executable}` if File.exists?(executable)
end
@@ -10,25 +10,22 @@ import com.twitter.sbt._
* mean to add a dependency on exampleland version 1.0.3 from provider "com.example".
*/
class BirdNameProject(info: ProjectInfo) extends StandardServiceProject(info)
- with CompileThriftScala
with NoisyDependencies
with DefaultRepos
with SubversionPublisher
with PublishSourcesAndJavadocs
with PublishSite
+ with CompileThriftRuby
+ with CompileThriftScroogeMixin
{
- val finagleVersion = "1.9.1"
+ val finagleVersion = "1.9.6"
val finagleC = "com.twitter" % "finagle-core" % finagleVersion
val finagleT = "com.twitter" % "finagle-thrift" % finagleVersion
val finagleO = "com.twitter" % "finagle-ostrich4" % finagleVersion
- override def originalThriftNamespaces = Map("BirdName" -> "com.twitter.birdname.thrift")
- override val scalaThriftTargetNamespace = "com.twitter.birdname"
-
- val slf4jVersion = "1.5.11"
- val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion withSources() intransitive()
- val slf4jBindings = "org.slf4j" % "slf4j-jdk14" % slf4jVersion withSources() intransitive()
+ val scrooge_runtime = "com.twitter" % "scrooge-runtime" % "1.0.3"
+ override def scroogeVersion = "2.2.0"
// for tests
val specs = "org.scala-tools.testing" % "specs_2.8.1" % "1.6.7" % "test" withSources()
@@ -19,6 +19,7 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
}
override def ivyRepositories = Seq(Resolver.defaultLocal(None)) ++ repositories
- val standardProject = "com.twitter" % "standard-project" % "0.12.7"
- val sbtThrift = "com.twitter" % "sbt-thrift" % "1.4.4"
+ val standardProject = "com.twitter" % "standard-project" % "1.0.0"
+ val sbtThrift = "com.twitter" % "sbt-thrift" % "2.0.1"
+ val sbtScrooge = "com.twitter" % "sbt-scrooge" % "2.2.0"
}
@@ -1,21 +1,23 @@
package com.twitter.birdname
+import com.twitter.logging.Logger
+import com.twitter.util._
import java.util.concurrent.Executors
import scala.collection.mutable
-import com.twitter.util._
import config._
+import thrift._
-class BirdNameServiceImpl(config: BirdNameServiceConfig) extends BirdNameServiceServer {
+class BirdNameServiceImpl(config: BirdNameServiceConfig) extends BirdNameService.ThriftServer {
val serverName = "BirdName"
val thriftPort = config.thriftPort
+ override val tracerFactory = config.tracerFactory
/**
* These services are based on finagle, which implements a nonblocking server. If you
* are making blocking rpc calls, it's really important that you run these actions in
* a thread pool, so that you don't block the main event loop. This thread pool is only
* needed for these blocking actions. The code looks like:
*
- * // Depends on com.twitter.util >= 1.6.10
* val futurePool = new FuturePool(Executors.newFixedThreadPool(config.threadPoolSize))
*
* def hello() = futurePool {
@@ -40,6 +42,6 @@ class BirdNameServiceImpl(config: BirdNameServiceConfig) extends BirdNameService
def put(key: String, value: String) = {
log.debug("put %s", key)
database(key) = value
- Future.void
+ Future.Unit
}
}
@@ -1,12 +1,16 @@
package com.twitter.birdname
+import com.twitter.logging.Logger
import com.twitter.ostrich.admin.RuntimeEnvironment
+import thrift._
object Main {
+ private val log = Logger.get(getClass)
+
def main(args: Array[String]) {
val env = RuntimeEnvironment(this, args)
- val service = env.loadRuntimeConfig[BirdNameServiceServer]
+ val service = env.loadRuntimeConfig[BirdNameService.ThriftServer]()
service.start()
+ log.info("BirdName %s started.", env.jarVersion)
}
}
-
@@ -1,14 +1,17 @@
package com.twitter.birdname
package config
+import com.twitter.finagle.tracing.{NullTracer, Tracer}
import com.twitter.logging.Logger
import com.twitter.logging.config._
import com.twitter.ostrich.admin.{RuntimeEnvironment, ServiceTracker}
import com.twitter.ostrich.admin.config._
import com.twitter.util.Config
+import thrift._
-class BirdNameServiceConfig extends ServerConfig[BirdNameServiceServer] {
+class BirdNameServiceConfig extends ServerConfig[BirdNameService.ThriftServer] {
var thriftPort: Int = 9999
+ var tracerFactory: Tracer.Factory = NullTracer.factory
def apply(runtime: RuntimeEnvironment) = new BirdNameServiceImpl(this)
}
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo "Starting birdname in development mode..."
+java -server -Xmx1024m -Dstage=development -jar ./dist/birdname/birdname-@VERSION@.jar
@@ -1,18 +1,20 @@
package com.twitter.birdname
-import org.specs.Specification
+import com.twitter.conversions.time._
import com.twitter.ostrich.admin._
import com.twitter.util._
-import com.twitter.conversions.time._
+import org.specs.Specification
+import thrift._
abstract class AbstractSpec extends Specification {
val env = RuntimeEnvironment(this, Array("-f", "config/test.scala"))
+
lazy val birdName = {
- val out = env.loadRuntimeConfig[BirdNameService]
+ val out = env.loadRuntimeConfig[BirdNameService.ThriftServer]
// You don't really want the thrift server active, particularly if you
// are running repetitively via ~test
- ServiceTracker.shutdown // all services
+ ServiceTracker.shutdown() // all services
out
}
}
View
@@ -4,15 +4,15 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = %q{scala-bootstrapper}
+ s.name = "scala-bootstrapper"
s.version = "0.9.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = [%q{Kyle Maxwell}]
- s.date = %q{2011-10-14}
- s.description = %q{Twitter scala project init}
- s.email = %q{kmaxwell@twitter.com}
- s.executables = [%q{scala-bootstrapper}]
+ s.authors = ["Kyle Maxwell"]
+ s.date = "2011-11-17"
+ s.description = "Twitter scala project init"
+ s.email = "kmaxwell@twitter.com"
+ s.executables = ["scala-bootstrapper"]
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
@@ -44,16 +44,17 @@ Gem::Specification.new do |s|
"lib/template/src/main/scala/com/twitter/birdname/config/BirdNameServiceConfig.scala.erb",
"lib/template/src/main/thrift/birdname.thrift.erb",
"lib/template/src/scripts/console.erb",
+ "lib/template/src/scripts/devel.sh",
"lib/template/src/scripts/startup.sh",
"lib/template/src/test/scala/com/twitter/birdname/AbstractSpec.scala.erb",
"lib/template/src/test/scala/com/twitter/birdname/BirdNameServiceSpec.scala.erb",
"scala-bootstrapper.gemspec",
"vendor/trollop.rb"
]
- s.homepage = %q{http://github.com/fizx/scala-bootstrapper}
- s.require_paths = [%q{lib}]
- s.rubygems_version = %q{1.8.5}
- s.summary = %q{Twitter scala project init}
+ s.homepage = "http://github.com/fizx/scala-bootstrapper"
+ s.require_paths = ["lib"]
+ s.rubygems_version = "1.8.11"
+ s.summary = "Twitter scala project init"
if s.respond_to? :specification_version then
s.specification_version = 3

0 comments on commit af944c5

Please sign in to comment.