scala-bootstrapper 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -0,0 +1,27 @@
1
+ # Docs at http://confluence.local.twitter.com/display/RELEASE/Twitter-cap-utils+README
2
+ begin
3
+ require 'rubygems'
4
+ require "bundler/setup"
5
+ require "railsless-deploy"
6
+ require 'twitter_cap_utils'
7
+ rescue LoadError => e
8
+ puts e.message
9
+ abort "Please gem install twitter-cap-utils railsless-deploy"
10
+ end
11
+
12
+ set :user, :twitter
13
+ set :application, "birdname"
14
+ set :repository, "http://git.local.twitter.com/ro/#{application}"
15
+
16
+ task :staging do
17
+ role :app, "server1", "server2", "etc"
18
+ end
19
+
20
+ task :canary do
21
+ role :app, "server1"
22
+ end
23
+
24
+ task :production do
25
+ role :app, "server1", "server2", "etc"
26
+ end
27
+
data/lib/template/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source :rubygems
2
+ source "http://gems.local.twitter.com"
2
3
  gem "thrift_client", "0.6"
3
- gem "thrift", "0.5"
4
+ gem "thrift", "0.5"
5
+ gem "railsless-deploy"
6
+ gem "twitter-cap-utils", "~>0.8.0"
@@ -13,8 +13,8 @@ class BirdNameClient < ThriftClient
13
13
  DEFAULTS = { :transport_wrapper => Thrift::FramedTransport }
14
14
  def initialize(servers = nil, options = {})
15
15
  if servers.nil? or servers.empty?
16
- STDERR.puts "No servers specified, using 127.0.0.1:13007"
17
- servers = ['127.0.0.1:13007']
16
+ STDERR.puts "No servers specified, using 127.0.0.1:9999"
17
+ servers = ['127.0.0.1:9999']
18
18
  else
19
19
  servers = Array(servers)
20
20
  end
@@ -26,4 +26,4 @@ end
26
26
  puts "Hint: the client is in the variable `$client`"
27
27
  $client = BirdNameClient.new ARGV.shift
28
28
 
29
- IRB.start
29
+ IRB.start
@@ -1,7 +1,44 @@
1
- import com.twitter.birdname._
1
+ import com.twitter.admin.config._
2
+ import com.twitter.conversions.time._
3
+ import com.twitter.logging.config._
4
+ import com.twitter.birdname.config._
2
5
 
6
+ // development mode.
3
7
  new BirdNameServiceConfig {
4
- // TODO: Please implement environment-specific config, e.g.:
5
- //
6
- // override val thriftPort = 31337
7
- }
8
+
9
+ // Add your own config here
10
+
11
+ // Where your service will be exposed.
12
+ thriftPort = 9999
13
+
14
+ // Ostrich http admin port. Curl this for stats, etc
15
+ admin.httpPort = 9900
16
+
17
+ // End user configuration
18
+
19
+ // Expert-only: Ostrich stats and logger configuration.
20
+
21
+ admin.statsNodes = new StatsConfig {
22
+ reporters = new JsonStatsLoggerConfig {
23
+ loggerName = "stats"
24
+ serviceName = "birdname"
25
+ } :: new TimeSeriesCollectorConfig
26
+ }
27
+
28
+ loggers =
29
+ new LoggerConfig {
30
+ level = Level.INFO
31
+ handlers = new FileHandlerConfig {
32
+ filename = "birdname.log"
33
+ roll = Policy.SigHup
34
+ }
35
+ } :: new LoggerConfig {
36
+ node = "stats"
37
+ level = Level.INFO
38
+ useParents = false
39
+ handlers = new FileHandlerConfig {
40
+ filename = "stats.log"
41
+ formatter = BareFormatterConfig
42
+ }
43
+ }
44
+ }
@@ -1,7 +1,43 @@
1
- import com.twitter.birdname._
1
+ import com.twitter.admin.config._
2
+ import com.twitter.conversions.time._
3
+ import com.twitter.logging.config._
4
+ import com.twitter.birdname.config._
2
5
 
6
+ // production mode.
3
7
  new BirdNameServiceConfig {
4
- // TODO: Please implement environment-specific config, e.g.:
5
- //
6
- // override val thriftPort = 31337
7
- }
8
+
9
+ // Add your own config here
10
+
11
+ // Where your service will be exposed.
12
+ thriftPort = 9999
13
+
14
+ // Ostrich http admin port. Curl this for stats, etc
15
+ admin.httpPort = 9900
16
+
17
+ // End user configuration
18
+
19
+ // Expert-only: Ostrich stats and logger configuration.
20
+ admin.statsNodes = new StatsConfig {
21
+ reporters = new JsonStatsLoggerConfig {
22
+ loggerName = "stats"
23
+ serviceName = "birdname"
24
+ } :: new TimeSeriesCollectorConfig
25
+ }
26
+
27
+ loggers =
28
+ new LoggerConfig {
29
+ level = Level.INFO
30
+ handlers = new FileHandlerConfig {
31
+ filename = "/var/log/birdname/production.log"
32
+ roll = Policy.SigHup
33
+ }
34
+ } :: new LoggerConfig {
35
+ node = "stats"
36
+ level = Level.INFO
37
+ useParents = false
38
+ handlers = new FileHandlerConfig {
39
+ filename = "stats.log"
40
+ formatter = BareFormatterConfig
41
+ }
42
+ }
43
+ }
@@ -1,7 +1,43 @@
1
- import com.twitter.birdname._
1
+ import com.twitter.admin.config._
2
+ import com.twitter.conversions.time._
3
+ import com.twitter.logging.config._
4
+ import com.twitter.birdname.config._
2
5
 
6
+ // staging mode.
3
7
  new BirdNameServiceConfig {
4
- // TODO: Please implement environment-specific config, e.g.:
5
- //
6
- // override val thriftPort = 31337
7
- }
8
+
9
+ // Add your own config here
10
+
11
+ // Where your service will be exposed.
12
+ thriftPort = 9999
13
+
14
+ // Ostrich http admin port. Curl this for stats, etc
15
+ admin.httpPort = 9900
16
+
17
+ // End user configuration
18
+
19
+ // Expert-only: Ostrich stats and logger configuration.
20
+ admin.statsNodes = new StatsConfig {
21
+ reporters = new JsonStatsLoggerConfig {
22
+ loggerName = "stats"
23
+ serviceName = "birdname"
24
+ } :: new TimeSeriesCollectorConfig
25
+ }
26
+
27
+ loggers =
28
+ new LoggerConfig {
29
+ level = Level.INFO
30
+ handlers = new FileHandlerConfig {
31
+ filename = "/var/log/birdname/production.log"
32
+ roll = Policy.SigHup
33
+ }
34
+ } :: new LoggerConfig {
35
+ node = "stats"
36
+ level = Level.INFO
37
+ useParents = false
38
+ handlers = new FileHandlerConfig {
39
+ filename = "stats.log"
40
+ formatter = BareFormatterConfig
41
+ }
42
+ }
43
+ }
@@ -1,7 +1,32 @@
1
- import com.twitter.birdname._
1
+ import com.twitter.admin.config._
2
+ import com.twitter.conversions.time._
3
+ import com.twitter.logging.config._
4
+ import com.twitter.birdname.config._
2
5
 
6
+ // test mode.
3
7
  new BirdNameServiceConfig {
4
- // TODO: Please implement environment-specific config, e.g.:
5
- //
6
- // override val thriftPort = 31337
7
- }
8
+
9
+ // Add your own config here
10
+
11
+ // Where your service will be exposed.
12
+ thriftPort = 9999
13
+
14
+ // Ostrich http admin port. Curl this for stats, etc
15
+ admin.httpPort = 9900
16
+
17
+ // End user configuration
18
+
19
+ // Expert-only: Ostrich stats and logger configuration.
20
+ admin.statsNodes = new StatsConfig {
21
+ reporters = new JsonStatsLoggerConfig {
22
+ loggerName = "stats"
23
+ serviceName = "birdname"
24
+ } :: new TimeSeriesCollectorConfig
25
+ }
26
+
27
+ loggers =
28
+ new LoggerConfig {
29
+ level = Level.INFO
30
+ handlers = new ConsoleHandlerConfig
31
+ }
32
+ }
@@ -2,37 +2,34 @@ import sbt._
2
2
  import Process._
3
3
  import com.twitter.sbt._
4
4
 
5
- class BirdNameProject(info: ProjectInfo) extends StandardProject(info)
6
- with CompileScalaWrappers
7
- with SubversionPublisher
8
- with NoisyDependencies
9
- with DefaultRepos
10
- with LibDirClasspath
11
- with PackageDist
12
- with AdhocInlines {
13
-
14
- val scalaTools = "org.scala-lang" % "scala-compiler" % "2.8.1"
15
-
16
- val util = "com.twitter" % "util" % "1.6.9"
17
-
18
- val finagleC = "com.twitter" % "finagle-core" % "1.1.23"
19
- val finagleT = "com.twitter" % "finagle-thrift" % "1.1.23"
20
- val finagleO = "com.twitter" % "finagle-ostrich3" % "1.1.23"
21
-
22
- val ostrich = "com.twitter" % "ostrich" % "3.0.5"
23
-
5
+ class BirdNameProject(info: ProjectInfo) extends StandardServiceProject(info)
6
+ with CompileScalaWrappers with NoisyDependencies with DefaultRepos with SubversionPublisher {
7
+
8
+ val finagleVersion = "1.1.23"
9
+ val finagleC = "com.twitter" % "finagle-core" % finagleVersion
10
+ val finagleT = "com.twitter" % "finagle-thrift" % finagleVersion
11
+ val finagleO = "com.twitter" % "finagle-ostrich3" % finagleVersion
12
+
13
+ val ostrich = "com.twitter" % "ostrich" % "3.0.6"
14
+
15
+ // thrift
16
+ val libthrift = "thrift" % "libthrift" % "0.5.0"
24
17
  val slf4jVersion = "1.5.11"
25
18
  val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion withSources() intransitive()
26
19
  val slf4jBindings = "org.slf4j" % "slf4j-jdk14" % slf4jVersion withSources() intransitive()
27
20
 
28
- val specs = "org.scala-tools.testing" % "specs_2.8.1" % "1.6.7" % "test" withSources()
29
- val jmock = "org.jmock" % "jmock" % "2.4.0" % "test"
30
-
31
21
  val scalaThriftTargetNamespace = "com.twitter.birdname"
32
22
  val rubyThriftNamespace = "BirdName"
33
-
23
+
24
+ // for tests
25
+ val specs = "org.scala-tools.testing" % "specs_2.8.1" % "1.6.7" % "test" withSources()
26
+ val jmock = "org.jmock" % "jmock" % "2.4.0" % "test"
27
+ val hamcrest_all = "org.hamcrest" % "hamcrest-all" % "1.1" % "test"
28
+ val cglib = "cglib" % "cglib" % "2.1_3" % "test"
29
+ val asm = "asm" % "asm" % "1.5.3" % "test"
30
+ val objenesis = "org.objenesis" % "objenesis" % "1.1" % "test"
31
+
34
32
  override def mainClass = Some("com.twitter.birdname.Main")
35
-
36
-
33
+
37
34
  override def subversionRepository = Some("http://svn.local.twitter.com/maven<%= '-public' if is_public %>")
38
35
  }
@@ -1,8 +1,8 @@
1
1
  #Project properties
2
2
  #Thu Feb 24 16:45:35 PST 2011
3
3
  project.organization=com.twitter
4
- project.name=BirdName
4
+ project.name=birdname
5
5
  sbt.version=0.7.4
6
- project.version=0.1
6
+ project.version=1.0-SNAPSHOT
7
7
  build.scala.versions=2.8.1
8
8
  project.initialize=false
@@ -2,6 +2,7 @@ package com.twitter.birdname
2
2
 
3
3
  import com.twitter.util._
4
4
  import java.util.concurrent.Executors
5
+ import config._
5
6
 
6
7
  class BirdNameServiceImpl(config: BirdNameServiceConfig) extends BirdNameService {
7
8
  val serverName = "BirdName"
@@ -5,8 +5,8 @@ import com.twitter.admin._
5
5
  object Main {
6
6
  def main(args: Array[String]) {
7
7
  val env = RuntimeEnvironment(this, args)
8
- val impl = env.loadRuntimeConfig[BirdNameService]
9
- impl.start
8
+ val service = env.loadRuntimeConfig[BirdNameService]
9
+ service.start()
10
10
  }
11
11
  }
12
12
 
@@ -0,0 +1,14 @@
1
+ package com.twitter.birdname
2
+ package config
3
+
4
+ import com.twitter.admin.{RuntimeEnvironment, ServiceTracker}
5
+ import com.twitter.admin.config._
6
+ import com.twitter.logging.Logger
7
+ import com.twitter.config._
8
+ import com.twitter.logging.config._
9
+
10
+ class BirdNameServiceConfig extends ServerConfig[BirdNameService] {
11
+ var thriftPort: Int = 9999
12
+
13
+ def apply(runtime: RuntimeEnvironment) = new BirdNameServiceImpl(this)
14
+ }
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scala-bootstrapper}
8
- s.version = "0.4.0"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Maxwell"]
12
- s.date = %q{2011-03-01}
12
+ s.date = %q{2011-03-02}
13
13
  s.description = %q{Twitter scala project init}
14
14
  s.email = %q{kmaxwell@twitter.com}
15
15
  s.executables = ["sbt", "scala-bootstrapper"]
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "bin/sbt",
28
28
  "bin/scala-bootstrapper",
29
29
  "lib/template/.gitignore",
30
+ "lib/template/Capfile",
30
31
  "lib/template/Gemfile",
31
32
  "lib/template/bin/console.erb",
32
33
  "lib/template/config/development.scala.erb",
@@ -36,9 +37,9 @@ Gem::Specification.new do |s|
36
37
  "lib/template/project/build.properties",
37
38
  "lib/template/project/build/BirdNameProject.scala.erb",
38
39
  "lib/template/project/plugins/Plugins.scala.erb",
39
- "lib/template/src/main/scala/com/twitter/birdname/BirdNameServiceConfig.scala.erb",
40
40
  "lib/template/src/main/scala/com/twitter/birdname/BirdNameServiceImpl.scala.erb",
41
41
  "lib/template/src/main/scala/com/twitter/birdname/Main.scala.erb",
42
+ "lib/template/src/main/scala/com/twitter/birdname/config/BirdNameServiceConfig.scala.erb",
42
43
  "lib/template/src/main/thrift/birdname.thrift.erb",
43
44
  "lib/template/src/test/scala/com/twitter/birdname/AbstractSpec.scala.erb",
44
45
  "lib/template/src/test/scala/com/twitter/birdname/BirdNameServiceSpec.scala.erb",
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
7
+ - 5
8
8
  - 0
9
- version: 0.4.0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kyle Maxwell
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-01 00:00:00 -08:00
17
+ date: 2011-03-02 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - bin/sbt
50
50
  - bin/scala-bootstrapper
51
51
  - lib/template/.gitignore
52
+ - lib/template/Capfile
52
53
  - lib/template/Gemfile
53
54
  - lib/template/bin/console.erb
54
55
  - lib/template/config/development.scala.erb
@@ -58,9 +59,9 @@ files:
58
59
  - lib/template/project/build.properties
59
60
  - lib/template/project/build/BirdNameProject.scala.erb
60
61
  - lib/template/project/plugins/Plugins.scala.erb
61
- - lib/template/src/main/scala/com/twitter/birdname/BirdNameServiceConfig.scala.erb
62
62
  - lib/template/src/main/scala/com/twitter/birdname/BirdNameServiceImpl.scala.erb
63
63
  - lib/template/src/main/scala/com/twitter/birdname/Main.scala.erb
64
+ - lib/template/src/main/scala/com/twitter/birdname/config/BirdNameServiceConfig.scala.erb
64
65
  - lib/template/src/main/thrift/birdname.thrift.erb
65
66
  - lib/template/src/test/scala/com/twitter/birdname/AbstractSpec.scala.erb
66
67
  - lib/template/src/test/scala/com/twitter/birdname/BirdNameServiceSpec.scala.erb
@@ -1,24 +0,0 @@
1
- package com.twitter.birdname
2
-
3
- import com.twitter.admin.config._
4
- import com.twitter.admin._
5
-
6
- class BirdNameServiceConfig extends ServerConfig[BirdNameService] {
7
-
8
- val thriftPort = 1337
9
- admin.httpPort = Some(9999)
10
-
11
- // TODO: Please implement application-specific config.
12
-
13
- /**
14
- * Used if you need to integrate synchronous clients, e.g. querulous. If you
15
- * are using an async client like cassie, you can ignore this.
16
- *
17
- * val threadPoolSize = 10
18
- */
19
-
20
- /**
21
- * This is a factory method that will construct the related service.
22
- */
23
- def apply(env: RuntimeEnvironment) = new BirdNameServiceImpl(this)
24
- }