radar-app 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/radar-app +57 -9
- data/lib/radar/app/version.rb +1 -1
- data/templates/analyzer.rb +33 -0
- data/templates/spec/analyzer_spec.rb +6 -0
- metadata +4 -3
- data/templates/main.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9730dfa668d43c9980dd5b5c978a3b8ed49fd57f
|
4
|
+
data.tar.gz: df4d42bb45c2ed512882609ab369b347b8d947fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b47f5ec1735bab38fc1f1eee47786e29bb894fd7918e381db6ed653ee3117abf8642efbc6570c447124f11e1d96e4880bea1df3a5da7a2a62ca63cc72083e7b3
|
7
|
+
data.tar.gz: 1e3dc79e649773ba3c9b6c887fb0b2ef7e2343c23f4306eb2689e72018639e3b4ba11e250f6e56378d5a319e0e31b312f852c5873617b0f8ec79584130a15cd5
|
data/bin/radar-app
CHANGED
@@ -7,7 +7,7 @@ require 'rubygems' # ruby1.9 doesn't "require" it though
|
|
7
7
|
require 'bundler/setup'
|
8
8
|
require 'thor'
|
9
9
|
|
10
|
-
class
|
10
|
+
class RadarApp < Thor
|
11
11
|
|
12
12
|
include Thor::Actions
|
13
13
|
|
@@ -16,26 +16,74 @@ class MyThorCommand < Thor
|
|
16
16
|
"#{dir}/../templates"
|
17
17
|
end
|
18
18
|
|
19
|
-
desc
|
19
|
+
desc 'new', 'Creates a new project with the given name'
|
20
20
|
method_option :alias => 'n'
|
21
|
+
method_option :language, :type => :string, :aliases => "-l", :default => 'ruby',
|
22
|
+
:desc => 'Choose the project language. Available options [Java, Ruby]'
|
21
23
|
def new(project_name)
|
22
24
|
if File.directory?(project_name.to_s)
|
23
|
-
puts
|
25
|
+
puts 'directory already exists'
|
24
26
|
return
|
25
27
|
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
language = options[:language].downcase
|
30
|
+
case language
|
31
|
+
when 'ruby'
|
32
|
+
new_ruby_project project_name
|
33
|
+
when 'java'
|
34
|
+
new_java_project project_name
|
35
|
+
else
|
36
|
+
puts 'language not available'
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
|
-
desc '
|
40
|
+
desc 'server', 'Starts the app server'
|
33
41
|
method_option :aliases => 's'
|
34
|
-
def
|
42
|
+
def server
|
35
43
|
require './analyzers_registry'
|
36
44
|
RadarApp::Server.start
|
37
45
|
end
|
38
46
|
|
47
|
+
desc 'generate', 'generates an analyzer'
|
48
|
+
method_option :alias => 'g'
|
49
|
+
def generate(command, analzyer_name)
|
50
|
+
case command.to_s.downcase
|
51
|
+
when 'analyzer'
|
52
|
+
generate_analyzer(analzyer_name) if command == 'analyzer'
|
53
|
+
else
|
54
|
+
puts 'invalid command'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
no_commands do
|
60
|
+
def generate_analyzer(analyzer_name)
|
61
|
+
file_name = "#{analyzer_name}.rb"
|
62
|
+
copy_file 'analyzer.rb', file_name
|
63
|
+
|
64
|
+
names = analyzer_name.split '_'
|
65
|
+
class_name = ''
|
66
|
+
names.each {|name| class_name = class_name + name.capitalize}
|
67
|
+
gsub_file file_name, 'ClassName', class_name
|
68
|
+
|
69
|
+
empty_directory 'spec' unless File.directory?('spec')
|
70
|
+
spec_file_name = "spec/#{analyzer_name}_spec.rb"
|
71
|
+
copy_file 'spec/analyzer_spec.rb', spec_file_name
|
72
|
+
gsub_file spec_file_name, 'file_name', analyzer_name
|
73
|
+
gsub_file spec_file_name, 'ClassName', class_name
|
74
|
+
end
|
75
|
+
|
76
|
+
def new_ruby_project(project_name)
|
77
|
+
empty_directory project_name.to_s
|
78
|
+
copy_file 'Gemfile', "#{project_name}/Gemfile"
|
79
|
+
copy_file 'analyzers_registry.rb', "#{project_name}/analyzers_registry.rb"
|
80
|
+
end
|
81
|
+
|
82
|
+
def new_java_project(project_name)
|
83
|
+
puts "java #{project_name}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
39
87
|
end
|
40
88
|
|
41
|
-
|
89
|
+
RadarApp.start
|
data/lib/radar/app/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'radar-api'
|
2
|
+
|
3
|
+
class ClassName
|
4
|
+
|
5
|
+
def config
|
6
|
+
Radar::API::AnalyzerConfig.new(
|
7
|
+
result_type: Radar::API::ResultType::TABLE,
|
8
|
+
accepted_events: Set.new([Radar::API::Event::EACH_DAY, Radar::API::Event::EACH_MONTH, Radar::API::Event::FINISH])
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_each_day(portfolio)
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_finish(portfolio)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_session(analyzer_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
def dump()
|
22
|
+
end
|
23
|
+
|
24
|
+
def resume(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def result()
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy_session()
|
31
|
+
end
|
32
|
+
|
33
|
+
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.
|
4
|
+
version: 0.0.2
|
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-
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,8 +86,9 @@ files:
|
|
86
86
|
- lib/radar/app/version.rb
|
87
87
|
- radar-app.gemspec
|
88
88
|
- templates/Gemfile
|
89
|
+
- templates/analyzer.rb
|
89
90
|
- templates/analyzers_registry.rb
|
90
|
-
- templates/
|
91
|
+
- templates/spec/analyzer_spec.rb
|
91
92
|
homepage: http://www.investtools.com.br/
|
92
93
|
licenses:
|
93
94
|
- MIT
|
data/templates/main.rb
DELETED
@@ -1,10 +0,0 @@
|
|
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()
|