radar-app 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3da9a048534d30b8d563d779a92dce4f81763d23
4
- data.tar.gz: d3ad691cfb07c05a584fcfc1e7929ff15c7537ec
3
+ metadata.gz: cc65b453f94ea8cba1db7ff6a8b51f2476bb12ec
4
+ data.tar.gz: dd72925feb92dec18ba51b0e16e4fe5fff524db2
5
5
  SHA512:
6
- metadata.gz: 472a1c6e7debe843d596e84b89d559f7c4f77cc3d5fefd9354a2f6a12f961a68d47d37d7e074b388a1436a10c3b474c598d479c4d4fb1630be60f942edb331b2
7
- data.tar.gz: 61dca7186749496cf2628a65bcb5a3a93c09fe0d2939113950ed768a0b6fb913b6fd4d5534c01318a2551f9bd99d6cee53704c926a81eac449a9baa716cd428c
6
+ metadata.gz: 57bb91a1904a07e57ccff712361e3891958daa04a7f5fb30efa528b58a8b8c891f0cb40458d87e93edf9c364ffee67b02d79cb83b3953731b653e644e67e71ca
7
+ data.tar.gz: 3a875a35f93afc507b5b994ceacaf4de1bead59ccda141931d02cf8574320f762d7ae039c8ff44f75a21fc9549cdd89ee52148321202496f7b16b93d488bd196
data/lib/radar-app.rb CHANGED
@@ -1,19 +1 @@
1
- require "radar/app/version"
2
- require 'analyzer_controller'
3
- require 'radar-api'
4
-
5
- module Radar
6
- module App
7
- class Server
8
- def self.start
9
- handler = Radar::App::AnalyzerController.new
10
- processor = Radar::API::AnalyzerController::Processor.new(handler)
11
- transport = Thrift::ServerSocket.new(5000)
12
- transportFactory = Thrift::BufferedTransportFactory.new
13
- server = Thrift::ThreadedServer.new(processor, transport)
14
- puts "Starting server..."
15
- server.serve()
16
- end
17
- end
18
- end
19
- end
1
+ require 'radar/app'
data/lib/radar/app.rb CHANGED
@@ -1,7 +1,36 @@
1
- require "radar/app/version"
1
+ require 'radar/app/version'
2
+ require 'radar/app/core_ext'
3
+ require 'radar/app/analyzer_controller'
4
+
5
+ require 'connection_pool'
6
+ require 'radar-api'
2
7
 
3
8
  module Radar
4
9
  module App
5
- # Your code goes here...
10
+ def self.security_service
11
+ @security_service ||= connection_pool(Radar::API::Security::Client, 9790)
12
+ end
13
+
14
+ def self.index_service
15
+ @index_service ||= connection_pool(Radar::API::FundService::Client, 9791)
16
+ end
17
+
18
+ def self.fund_service
19
+ @fund_service ||= connection_pool(Radar::API::IndexService::Client, 9792)
20
+ end
21
+
22
+ protected
23
+
24
+ def self.connection_pool(client_class, port)
25
+ ConnectionPool.new { connection(client_class, port) }
26
+ end
27
+
28
+ def self.connection(client_class, port)
29
+ host = ENV['DATA_SERVER_HOST'] || '127.0.0.1'
30
+ transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, port))
31
+ protocol = Thrift::BinaryProtocol.new(transport)
32
+ transport.open
33
+ client_class.new(protocol)
34
+ end
6
35
  end
7
36
  end
@@ -0,0 +1 @@
1
+ require 'radar/app/core_ext/date'
@@ -1,4 +1,4 @@
1
- # -*- coding: utf-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  class Date
4
4
  def to_i
@@ -0,0 +1,17 @@
1
+ require 'radar-api'
2
+
3
+ module Radar
4
+ module App
5
+ class Server
6
+ def self.start
7
+ handler = Radar::App::AnalyzerController.new
8
+ processor = Radar::API::AnalyzerController::Processor.new(handler)
9
+ transport = Thrift::ServerSocket.new(5000)
10
+ transportFactory = Thrift::BufferedTransportFactory.new
11
+ server = Thrift::ThreadedServer.new(processor, transport)
12
+ puts "Starting server..."
13
+ server.serve()
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  module Radar
2
2
  module App
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
data/radar-app.gemspec CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "thor", "~> 0.19"
25
25
  spec.add_dependency "radar-api", "~> 0.1"
26
26
  spec.add_dependency "thin", "1.6.2"
27
-
27
+ spec.add_dependency "connection_pool", "~> 2.0"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radar-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonardo Mendonca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.6.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: connection_pool
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
83
97
  description: generates and run a radar-app.
84
98
  email:
85
99
  - leonardo.mendonca@investtools.com.br
@@ -95,13 +109,12 @@ files:
95
109
  - README.md
96
110
  - Rakefile
97
111
  - bin/radar-app
98
- - lib/analyzer_controller.rb
99
112
  - lib/radar-app.rb
100
113
  - lib/radar/app.rb
114
+ - lib/radar/app/analyzer_controller.rb
115
+ - lib/radar/app/core_ext.rb
101
116
  - lib/radar/app/core_ext/date.rb
102
- - lib/radar/app/fund_service_factory.rb
103
- - lib/radar/app/index_service_factory.rb
104
- - lib/radar/app/security_service_factory.rb
117
+ - lib/radar/app/server.rb
105
118
  - lib/radar/app/version.rb
106
119
  - radar-app.gemspec
107
120
  - templates/Gemfile
@@ -1,9 +0,0 @@
1
- class Radar::App::FundServiceFactory
2
- def self.create
3
- host = ENV['RADAR_HOST'] || '127.0.0.1'
4
- transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, 9791))
5
- protocol = Thrift::BinaryProtocol.new(transport)
6
- transport.open
7
- Radar::API::FundService::Client.new(protocol)
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class Radar::App::IndexServiceFactory
2
- def self.create
3
- host = ENV['RADAR_HOST'] || '127.0.0.1'
4
- transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, 9792))
5
- protocol = Thrift::BinaryProtocol.new(transport)
6
- transport.open
7
- Radar::API::IndexService::Client.new(protocol)
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class Radar::App::SecurityServiceFactory
2
- def self.create
3
- host = ENV['RADAR_HOST'] || '127.0.0.1'
4
- transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, 9790))
5
- protocol = Thrift::BinaryProtocol.new(transport)
6
- transport.open
7
- Radar::API::SecurityService::Client.new(protocol)
8
- end
9
- end