radar-app 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e648ecd75c47516f88de228341b1f3dff46703ee
4
+ data.tar.gz: 39e0bb44c65a7a083cfd7f53a76bb2b4aff866e9
5
+ SHA512:
6
+ metadata.gz: 3faf463547bbbf43e7a6a8b2703850413feac8d72da070a8144e10fcff81b026381f2f01721724d644a3c44174f5016ee4a7ec1ddd919aa92809bddf6cb48b39
7
+ data.tar.gz: 1788c9160c70b0e4debfb9c41b566a256c29cb4119ec3fad856f2714e4956eceb75ea6a26d78de5649e2c584c5645934b976c19af871921bd26729a9eab23d80
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in radar-app.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Leonardo Mendonça
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Radar::App
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'radar-app'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install radar-app
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/radar-app/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/radar-app ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.expand_path("../lib/", __FILE__)
4
+
5
+
6
+ require 'rubygems' # ruby1.9 doesn't "require" it though
7
+ require 'bundler/setup'
8
+ require 'thor'
9
+
10
+ class MyThorCommand < Thor
11
+
12
+ include Thor::Actions
13
+
14
+ def self.source_root
15
+ dir = File.dirname(__FILE__)
16
+ "#{dir}/../templates"
17
+ end
18
+
19
+ desc "new", "Creates a new project with the given name"
20
+ method_option :alias => 'n'
21
+ def new(project_name)
22
+ if File.directory?(project_name.to_s)
23
+ puts "directory already exists"
24
+ return
25
+ end
26
+
27
+ empty_directory project_name.to_s
28
+ copy_file 'Gemfile', "#{project_name}/Gemfile"
29
+ copy_file 'analyzers_registry.rb', "#{project_name}/analyzers_registry.rb"
30
+ end
31
+
32
+ desc 'start_serve', 'Starts the app server'
33
+ method_option :aliases => 's'
34
+ def start_server
35
+ require './analyzers_registry'
36
+ RadarApp::Server.start
37
+ end
38
+
39
+ end
40
+
41
+ MyThorCommand.start
@@ -0,0 +1,44 @@
1
+ module RadarApp
2
+ class AnalyzerController
3
+ attr_reader :sessions
4
+
5
+ def initialize
6
+ @sessions = {}
7
+ end
8
+
9
+ def self.register_analyzer(analyzer_id, analyzer_class)
10
+ (@@analyzers ||= {})[analyzer_id] = analyzer_class
11
+ end
12
+
13
+ def on_each_day(session_id, portfolio)
14
+ @sessions[session_id].on_each_day(portfolio)
15
+ end
16
+
17
+ def on_finish(session_id, portfolio)
18
+ @sessions[session_id].on_finish(portfolio)
19
+ end
20
+
21
+ def create_session(session_id, analyzer_id)
22
+ analyzer = @@analyzers[analyzer_id].new
23
+ @sessions[session_id] = analyzer
24
+ analyzer.config
25
+ end
26
+
27
+ def dump(session_id)
28
+ @sessions[session_id].dump
29
+ end
30
+
31
+ def resume(session_id, data)
32
+ @sessions[session_id].resume(data)
33
+ end
34
+
35
+ def result(session_id)
36
+ @sessions[session_id].result
37
+ end
38
+
39
+ def destroy_session(session_id)
40
+ @sessions.delete(session_id)
41
+ end
42
+
43
+ end
44
+ end
data/lib/radar-app.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "radar/app/version"
2
+ require 'analyzer_controller'
3
+ require 'radar-api'
4
+
5
+ module RadarApp
6
+ class Server
7
+ def self.start
8
+ handler = RadarApp::AnalyzerController.new
9
+ processor = Radar::API::AnalyzerController::Processor.new(handler)
10
+ transport = Thrift::ServerSocket.new(5000)
11
+ transportFactory = Thrift::BufferedTransportFactory.new
12
+ server = Thrift::ThreadedServer.new(processor, transport)
13
+ puts "Starting server..."
14
+ server.serve()
15
+ end
16
+ end
17
+ end
data/lib/radar/app.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "radar/app/version"
2
+
3
+ module Radar
4
+ module App
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Radar
2
+ module App
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/radar-app.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'radar/app/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "radar-app"
8
+ spec.version = Radar::App::VERSION
9
+ spec.authors = ["Leonardo Mendonca"]
10
+ spec.email = ["leonardo.mendonca@investtools.com.br"]
11
+ spec.summary = %q{radar-app generator}
12
+ spec.description = %q{generates and run a radar-app.}
13
+ spec.homepage = "http://www.investtools.com.br/"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "thor", "~> 0.19"
25
+ spec.add_dependency "radar-api"
26
+ end
data/templates/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ gem 'radar-app'
5
+ gem 'thin'
6
+ gem 'i18n'
7
+ gem 'active_support'
8
+
9
+ group :test do
10
+ gem 'rspec'
11
+ end
12
+
@@ -0,0 +1,5 @@
1
+ require 'radar-app'
2
+
3
+ #register your analyzer
4
+ #RadarApp::AnalyzerController.register_analyzer('analyzer_id', AnalyzerClass)
5
+
data/templates/main.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'radar-app'
2
+ require 'radar-api'
3
+
4
+ handler = RadarApp::AnalyzerController.new
5
+ processor = Radar::API::AnalyzerController::Processor.new(handler)
6
+ transport = Thrift::ServerSocket.new(5000)
7
+ transportFactory = Thrift::BufferedTransportFactory.new
8
+ server = Thrift::ThreadedServer.new(processor, transport)
9
+ puts "Starting server..."
10
+ server.serve()
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radar-app
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Leonardo Mendonca
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
55
+ - !ruby/object:Gem::Dependency
56
+ name: radar-api
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: generates and run a radar-app.
70
+ email:
71
+ - leonardo.mendonca@investtools.com.br
72
+ executables:
73
+ - radar-app
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/radar-app
83
+ - lib/analyzer_controller.rb
84
+ - lib/radar-app.rb
85
+ - lib/radar/app.rb
86
+ - lib/radar/app/version.rb
87
+ - radar-app.gemspec
88
+ - templates/Gemfile
89
+ - templates/analyzers_registry.rb
90
+ - templates/main.rb
91
+ homepage: http://www.investtools.com.br/
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: radar-app generator
115
+ test_files: []