forcast 0.0.110
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 +7 -0
- data/.gitignore +1 -0
- data/COPYRIGHTS +11 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +166 -0
- data/PENDIENTES +39 -0
- data/README.md +35 -0
- data/Rakefile +7 -0
- data/VERSION +1 -0
- data/bin/console +14 -0
- data/bin/rake +28 -0
- data/bin/setup +8 -0
- data/forcast.gemspec +73 -0
- data/lib/forcast.rb +5 -0
- data/lib/forcast/controllers/all.rb +2 -0
- data/lib/forcast/controllers/application/all.rb +12 -0
- data/lib/forcast/controllers/application/crud.rb +91 -0
- data/lib/forcast/controllers/application/database.rb +34 -0
- data/lib/forcast/controllers/application/error.rb +18 -0
- data/lib/forcast/controllers/application/exception_handler.rb +25 -0
- data/lib/forcast/controllers/application/json.rb +83 -0
- data/lib/forcast/controllers/application/locale.rb +30 -0
- data/lib/forcast/controllers/application/log.rb +22 -0
- data/lib/forcast/controllers/application/login.rb +41 -0
- data/lib/forcast/controllers/application/meta.rb +61 -0
- data/lib/forcast/controllers/application/model.rb +17 -0
- data/lib/forcast/controllers/application/permitirtodo.rb +27 -0
- data/lib/forcast/controllers/application/utils.rb +28 -0
- data/lib/forcast/controllers/controller/all.rb +8 -0
- data/lib/forcast/controllers/controller/asociar.rb +121 -0
- data/lib/forcast/controllers/controller/busqueda.rb +151 -0
- data/lib/forcast/controllers/controller/definitor/definitor.rb +322 -0
- data/lib/forcast/controllers/controller/definitor/definitor_page.rb +40 -0
- data/lib/forcast/controllers/controller/definitor_all.rb +2 -0
- data/lib/forcast/controllers/controller/filtro.rb +48 -0
- data/lib/forcast/controllers/controller/login/controllers/base_controller.rb +135 -0
- data/lib/forcast/controllers/controller/login/controllers/login_controller.rb +38 -0
- data/lib/forcast/controllers/controller/login/login.rb +71 -0
- data/lib/forcast/controllers/controller/login_all.rb +1 -0
- data/lib/forcast/controllers/controller/paper_trail/paper_trail.rb +21 -0
- data/lib/forcast/controllers/controller/paper_trail_all.rb +1 -0
- data/lib/forcast/controllers/controller/relacion.rb +157 -0
- data/lib/forcast/controllers/controller/rule_engine/action_engine.rb +92 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/action_logs_controller.rb +12 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/actions_controller.rb +10 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/pollings_controller.rb +13 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/rule_logs_controller.rb +12 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/rules_controller.rb +19 -0
- data/lib/forcast/controllers/controller/rule_engine/controllers/webhooks_controller.rb +27 -0
- data/lib/forcast/controllers/controller/rule_engine/polling_engine.rb +76 -0
- data/lib/forcast/controllers/controller/rule_engine/rule_controller.rb +27 -0
- data/lib/forcast/controllers/controller/rule_engine/rule_engine.rb +88 -0
- data/lib/forcast/controllers/controller/rule_engine/webhook_engine.rb +38 -0
- data/lib/forcast/controllers/controller/rule_engine_all.rb +5 -0
- data/lib/forcast/jobs/all.rb +2 -0
- data/lib/forcast/jobs/jobs_assets.rb +25 -0
- data/lib/forcast/jobs/jobs_wrapper.rb +25 -0
- data/lib/forcast/jobs/rule_engine/jobs_actions.rb +73 -0
- data/lib/forcast/jobs/rule_engine/jobs_pollings.rb +77 -0
- data/lib/forcast/jobs/rule_engine/jobs_webhooks.rb +54 -0
- data/lib/forcast/migrations/0_migracion_general.rb +44 -0
- data/lib/forcast/migrations/paper_trail/versions.rb +61 -0
- data/lib/forcast/migrations/rule_engine/action_logs.rb +15 -0
- data/lib/forcast/migrations/rule_engine/actions.rb +15 -0
- data/lib/forcast/migrations/rule_engine/pollings.rb +26 -0
- data/lib/forcast/migrations/rule_engine/rule_logs.rb +22 -0
- data/lib/forcast/migrations/rule_engine/rules.rb +27 -0
- data/lib/forcast/migrations/rule_engine/webhooks.rb +25 -0
- data/lib/forcast/models/all.rb +8 -0
- data/lib/forcast/models/asociar.rb +74 -0
- data/lib/forcast/models/busqueda.rb +17 -0
- data/lib/forcast/models/login/authorization.rb +37 -0
- data/lib/forcast/models/login/json_web_token.rb +15 -0
- data/lib/forcast/models/login/login.rb +26 -0
- data/lib/forcast/models/login_all.rb +2 -0
- data/lib/forcast/models/meta.rb +19 -0
- data/lib/forcast/models/modelo.rb +125 -0
- data/lib/forcast/models/models/meta.rb +6 -0
- data/lib/forcast/models/paper_trail/paper_trail.rb +13 -0
- data/lib/forcast/models/paper_trail_all.rb +1 -0
- data/lib/forcast/models/permitirtodo.rb +57 -0
- data/lib/forcast/models/rule_engine/action_engine.rb +19 -0
- data/lib/forcast/models/rule_engine/models/action.rb +41 -0
- data/lib/forcast/models/rule_engine/models/action_log.rb +40 -0
- data/lib/forcast/models/rule_engine/models/polling.rb +43 -0
- data/lib/forcast/models/rule_engine/models/rule.rb +44 -0
- data/lib/forcast/models/rule_engine/models/rule_log.rb +39 -0
- data/lib/forcast/models/rule_engine/models/webhook.rb +43 -0
- data/lib/forcast/models/rule_engine/polling_engine.rb +113 -0
- data/lib/forcast/models/rule_engine/rule.rb +62 -0
- data/lib/forcast/models/rule_engine/rule_engine.rb +137 -0
- data/lib/forcast/models/rule_engine/rule_scope.rb +35 -0
- data/lib/forcast/models/rule_engine/webhook_engine.rb +55 -0
- data/lib/forcast/models/rule_engine_all.rb +6 -0
- data/lib/forcast/routes/concerns/asociar.rb +15 -0
- data/lib/forcast/routes/concerns/buscar.rb +6 -0
- data/lib/forcast/routes/concerns/definitor.rb +3 -0
- data/lib/forcast/routes/concerns/modelo.rb +6 -0
- data/lib/forcast/routes/database.rb +4 -0
- data/lib/forcast/routes/login.rb +4 -0
- data/lib/forcast/routes/paper_trail/paper_trail.rb +3 -0
- data/lib/forcast/routes/rule_engine/rule.rb +5 -0
- data/lib/forcast/tasks/.giosaveZr0hbs +21 -0
- data/lib/forcast/tasks/.keep +0 -0
- data/lib/forcast/tasks/all.rb +16 -0
- data/lib/forcast/tasks/diagramas.rake +32 -0
- data/lib/forcast/tasks/documentation/documentation.rb +100 -0
- data/lib/forcast/tasks/env.rake +10 -0
- data/lib/forcast/tasks/git.rake +22 -0
- data/lib/forcast/tasks/indy/indy.rb +28 -0
- data/lib/forcast/tasks/logs.rake +13 -0
- data/lib/forcast/tasks/process.rake +18 -0
- data/lib/forcast/tasks/schema.rake +17 -0
- data/lib/forcast/tasks/schema/recips/action.rb +18 -0
- data/lib/forcast/tasks/schema/recips/controller.rb +29 -0
- data/lib/forcast/tasks/schema/recips/definitor.rb +38 -0
- data/lib/forcast/tasks/schema/recips/model.rb +43 -0
- data/lib/forcast/tasks/schema/recips/project.rb +19 -0
- data/lib/forcast/tasks/schema/recips/route.rb +9 -0
- data/lib/forcast/tasks/schema/recips/tmp/controller.rb +0 -0
- data/lib/forcast/tasks/schema/recips/tmp/model.rb +0 -0
- data/lib/forcast/tasks/schema/recips/tmp/model/.keep +0 -0
- data/lib/forcast/tasks/schema/rule_engine/rule_engine.rb +98 -0
- data/lib/forcast/tasks/schema/schema.rb +346 -0
- data/lib/forcast/tasks/test.rake +129 -0
- data/lib/forcast/tasks/utils.rake +68 -0
- data/lib/forcast/tasks/yard.rake +18 -0
- data/lib/forcast/utils/all.rb +4 -0
- data/lib/forcast/utils/email.rb +49 -0
- data/lib/forcast/utils/email/forcast/utils/email/layout/default.html.erb +3 -0
- data/lib/forcast/utils/email/forcast/utils/email/layout/default.text.erb +5 -0
- data/lib/forcast/utils/firebase.rb +60 -0
- data/lib/forcast/utils/firebase_database.rb +117 -0
- data/lib/forcast/utils/measure.rb +44 -0
- data/lib/forcast/utils/qvo.rb +141 -0
- data/lib/forcast/utils/server.rb +296 -0
- data/lib/forcast/utils/telegram.rb +82 -0
- data/lib/forcast/utils/thing.rb +180 -0
- data/lib/forcast/version.rb +15 -0
- data/lib/lib/backup.rb +42 -0
- data/lib/lib/deploy.sh +40 -0
- data/lib/lib/forcast_servidor_rails.sh +11 -0
- data/lib/lib/pg_generator.sh +10 -0
- data/lib/lib/production.rb +66 -0
- data/lib/lib/production/production.rb +30 -0
- data/lib/lib/systemctl_maker.rb +88 -0
- data/lib/lib/update.rb +100 -0
- data/production.rb +31 -0
- metadata +301 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'active_support'
|
|
2
|
+
module Forcast
|
|
3
|
+
module Model
|
|
4
|
+
module RuleEngine
|
|
5
|
+
module RuleScope
|
|
6
|
+
extend ActiveSupport::Concern
|
|
7
|
+
|
|
8
|
+
included do
|
|
9
|
+
scope :actives, -> { where(active?: true) }
|
|
10
|
+
scope :for_attributes, ->(attr_names) { where(attr_comparable: attr_names) }
|
|
11
|
+
scope :for_class, ->(class_name) { where(class_rule?: true, rule_model: class_name) }
|
|
12
|
+
scope :for_object, ->(object) {
|
|
13
|
+
where(class_rule?: false, rule_model: object.class.name, rule_model_id: object.id)
|
|
14
|
+
}
|
|
15
|
+
scope :for_object_and_class, ->(object) {
|
|
16
|
+
where(self._for_class(object.class.name).or(self._for_object(object)))
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class_methods do
|
|
21
|
+
def _for_class(class_name)
|
|
22
|
+
arel_table[:class_rule?].eq(true).and(arel_table[:rule_model].eq(class_name))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def _for_object(object)
|
|
26
|
+
arel_table[:class_rule?]
|
|
27
|
+
.eq(false)
|
|
28
|
+
.and(arel_table[:rule_model].eq(object.class.name))
|
|
29
|
+
.and(arel_table[:rule_model_id].eq(object.id))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'active_support'
|
|
2
|
+
module Forcast
|
|
3
|
+
module Model
|
|
4
|
+
module RuleEngine
|
|
5
|
+
module WebhookEngine
|
|
6
|
+
extend ActiveSupport::Concern
|
|
7
|
+
included do
|
|
8
|
+
def self.duplicate_object?(object)
|
|
9
|
+
return self.exists?(object)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
def validate_duration_time
|
|
13
|
+
puts "validate_duration_time"
|
|
14
|
+
return true if self.rule.class_rule?
|
|
15
|
+
if self.forever_true?
|
|
16
|
+
puts "Forever True Duration"
|
|
17
|
+
return true
|
|
18
|
+
end
|
|
19
|
+
webhook_duration_time = self.duration_time
|
|
20
|
+
webhook_duration_time ||= 1
|
|
21
|
+
testing_time = self.created_at + webhook_duration_time.minutes
|
|
22
|
+
if testing_time.to_i < Time.now.to_i
|
|
23
|
+
self.update_columns(:active? => false)
|
|
24
|
+
puts "Duration period expire"
|
|
25
|
+
return false
|
|
26
|
+
else
|
|
27
|
+
puts "Duration period still active"
|
|
28
|
+
return true
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def validate_send_time
|
|
33
|
+
puts "validate_send_time"
|
|
34
|
+
send_time = self.send_time
|
|
35
|
+
send_time ||= 30
|
|
36
|
+
last_review_send = self.last_review_send
|
|
37
|
+
last_review_send ||= Time.now
|
|
38
|
+
testing_time = last_review_send + send_time.second
|
|
39
|
+
remain = testing_time.to_i - Time.now.to_i
|
|
40
|
+
if testing_time.to_i > Time.now.to_i
|
|
41
|
+
puts "Dont send yet, remains #{remain} seconds"
|
|
42
|
+
self.update_columns( :last_review_send => Time.now,
|
|
43
|
+
:send? => false)
|
|
44
|
+
return false
|
|
45
|
+
else
|
|
46
|
+
puts "Send now"
|
|
47
|
+
self.update_columns(:last_send => Time.now,
|
|
48
|
+
:send? => true)
|
|
49
|
+
return true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require 'forcast/models/rule_engine/action_engine'
|
|
2
|
+
require 'forcast/models/rule_engine/rule_scope'
|
|
3
|
+
require 'forcast/models/rule_engine/rule_engine'
|
|
4
|
+
require 'forcast/models/rule_engine/polling_engine'
|
|
5
|
+
require 'forcast/models/rule_engine/webhook_engine'
|
|
6
|
+
require 'forcast/models/rule_engine/rule'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "#{Rails.root}/app/jobs/concerns/jobs_camaras.rb"
|
|
2
|
+
require "#{Rails.root}/app/jobs/concerns/jobs_hubs.rb"
|
|
3
|
+
|
|
4
|
+
include JobsHubs
|
|
5
|
+
include JobsCamaras
|
|
6
|
+
|
|
7
|
+
namespace :jobs do
|
|
8
|
+
desc 'Login Sync'
|
|
9
|
+
task :login_things do
|
|
10
|
+
Hubs::LoginThings.perform_async("Login")
|
|
11
|
+
end
|
|
12
|
+
desc 'Sync alertas camaras'
|
|
13
|
+
task :sync_camaras do
|
|
14
|
+
Camaras::SyncCamaras.perform_async("Camaras")
|
|
15
|
+
end
|
|
16
|
+
desc 'Sync alertas Hubs'
|
|
17
|
+
task :sync_hubs do
|
|
18
|
+
Hubs::SyncHubs.perform_async("Hubs")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Forcast
|
|
2
|
+
module Tasks
|
|
3
|
+
class Railtie
|
|
4
|
+
def self.tasks
|
|
5
|
+
path = File.expand_path(__dir__)
|
|
6
|
+
arr = Dir.glob("#{path}/**/*.rake")
|
|
7
|
+
puts arr
|
|
8
|
+
return arr
|
|
9
|
+
end
|
|
10
|
+
def self.load_all_tasks
|
|
11
|
+
path = File.expand_path(__dir__)
|
|
12
|
+
Dir.glob("#{path}/**/*.rake").each { |t| load t}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
|
|
3
|
+
namespace :diagrama do
|
|
4
|
+
|
|
5
|
+
desc 'Generar modelo con railroady'
|
|
6
|
+
task :roadymodel do
|
|
7
|
+
sh "railroady -i -l -a -m -M | dot -Tpng | sed 's/font-size:14.00/font-size:11.00/g' > diagramas/roadymodel.pdf"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
desc 'Generar modelo con ERD'
|
|
11
|
+
task :erdmodel do
|
|
12
|
+
sh "bundle exec rake erd filename=diagramas/erdmodel"
|
|
13
|
+
#Rake::Task['rake erd filename=diagramas/erd'].invoke
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc 'Generar modelo con railroady'
|
|
17
|
+
task :roadycontroller do
|
|
18
|
+
sh "railroady -i -l -C | neato -Tpng | sed 's/font-size:14.00/font-size:11.00/g' > diagramas/roadycontroller.pdf"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
desc 'Generar modelo con railroady'
|
|
22
|
+
task :all do
|
|
23
|
+
|
|
24
|
+
Rake::Task['diagrama:roadymodel'].invoke
|
|
25
|
+
Rake::Task['diagrama:erdmodel'].invoke
|
|
26
|
+
Rake::Task['diagrama:roadycontroller'].invoke
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
def copy_to_documentation(file_path,relative_path_document)
|
|
5
|
+
FileUtils.mkpath("#{relative_path_document}")
|
|
6
|
+
system("cp #{file_path} #{relative_path_document}")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def open_file_and_find_lines_to(file_path,lines_to_scan)
|
|
10
|
+
text = File.open(file_path).read
|
|
11
|
+
positions_lines = []
|
|
12
|
+
line_num = 0
|
|
13
|
+
i = 0
|
|
14
|
+
text.gsub!(/\r\n?/, "\n")
|
|
15
|
+
text.each_line do |line|
|
|
16
|
+
line_num += 1
|
|
17
|
+
line_match = lines_to_scan[i]
|
|
18
|
+
next unless line_match
|
|
19
|
+
if line.match(line_match)
|
|
20
|
+
positions_lines[i] = {:line_num => line_num, :line_match => line_match}
|
|
21
|
+
i += 1
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
return positions_lines
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def add_comment_to_top(file_path_documentation,comments)
|
|
28
|
+
open(file_path_documentation, 'r+') do |f|
|
|
29
|
+
line = 0
|
|
30
|
+
while (line-=1) > 0
|
|
31
|
+
f.readline
|
|
32
|
+
end
|
|
33
|
+
pos = f.pos
|
|
34
|
+
rest = f.read
|
|
35
|
+
f.seek(pos)
|
|
36
|
+
comments = comments.split("&")
|
|
37
|
+
comments.each do |line|
|
|
38
|
+
f.write(line+"\n")
|
|
39
|
+
end
|
|
40
|
+
f.write(rest)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def add_documentation_to_line(file_path_documentation,line,new_lines_lines)
|
|
46
|
+
|
|
47
|
+
new_lines = 0
|
|
48
|
+
open(file_path_documentation, 'r+') do |f|
|
|
49
|
+
line_num = line[:line_num]-1
|
|
50
|
+
while (line_num-=1) > 0 # read up to the line you want to write after
|
|
51
|
+
f.readline
|
|
52
|
+
end
|
|
53
|
+
pos = f.pos # save your position in the file
|
|
54
|
+
rest = f.read # save the rest of the file
|
|
55
|
+
f.seek(pos) # go back to the old position
|
|
56
|
+
documentation = line[:documentation].split("//")
|
|
57
|
+
documentation.each do |line|
|
|
58
|
+
new_lines += 1
|
|
59
|
+
f.write(line+"\n") # write new data
|
|
60
|
+
end
|
|
61
|
+
f.write(rest) # write rest of file
|
|
62
|
+
end
|
|
63
|
+
return new_lines + new_lines_lines
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def init_documentation(root)
|
|
67
|
+
system("rm -R #{root}/documentation/")
|
|
68
|
+
documents = YAML.load_file("#{root}/config/documentation_files.yml")
|
|
69
|
+
documents.each do |document|
|
|
70
|
+
begin
|
|
71
|
+
document = YAML.load_file("#{root}/"+document["file"]+".yml")
|
|
72
|
+
relative_path_document = document["relative_path"]
|
|
73
|
+
files = document["files"]
|
|
74
|
+
@absolute_path = "#{root}/"+relative_path_document.to_s
|
|
75
|
+
files.each do |documentation_file|
|
|
76
|
+
documentation_file = documentation_file["file"]
|
|
77
|
+
file_path = @absolute_path + documentation_file["path"]+".rb"
|
|
78
|
+
copy_to_documentation(file_path,"#{root}/"+"documentation"+relative_path_document)
|
|
79
|
+
file_path_documentation = "#{root}/"+"documentation"+relative_path_document+documentation_file["path"]+".rb"
|
|
80
|
+
#Agregar comentarios al inicio del archivo
|
|
81
|
+
comments = documentation_file["comments"]
|
|
82
|
+
#Agregar documentation YARN
|
|
83
|
+
body = documentation_file["body"]
|
|
84
|
+
lines_to_scan = body.keys
|
|
85
|
+
positions_lines = open_file_and_find_lines_to(file_path,lines_to_scan)
|
|
86
|
+
new_lines = 0
|
|
87
|
+
positions_lines.each_with_index do |line,index|
|
|
88
|
+
line[:documentation] = body[line[:line_match]]["documentation"]
|
|
89
|
+
line[:line_num] += new_lines
|
|
90
|
+
new_lines = add_documentation_to_line(file_path_documentation,line,new_lines)
|
|
91
|
+
end
|
|
92
|
+
add_comment_to_top(file_path_documentation,comments)
|
|
93
|
+
puts "Terminado archivo: "+file_path_documentation.to_s
|
|
94
|
+
end
|
|
95
|
+
rescue Exception => e
|
|
96
|
+
puts e
|
|
97
|
+
next
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
|
|
3
|
+
namespace :git do
|
|
4
|
+
desc 'Git push origin'
|
|
5
|
+
|
|
6
|
+
task :push, [:comment] do |task, option|
|
|
7
|
+
comment = option[:comment]
|
|
8
|
+
comment ||= DateTime.now.strftime('%d/%m/%Y %I:%M:%S %p')
|
|
9
|
+
sh "git add ."
|
|
10
|
+
sh "git commit -m '#{comment}'"
|
|
11
|
+
sh "git push origin"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task :fetch do
|
|
15
|
+
sh "git fetch origin"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
task :pull do
|
|
19
|
+
sh "git pull origin"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'indy'
|
|
2
|
+
|
|
3
|
+
log_file = './log/development.log'
|
|
4
|
+
log_contents = File.open(log_file, 'r').read
|
|
5
|
+
|
|
6
|
+
# Given this log file:
|
|
7
|
+
#
|
|
8
|
+
# 2015/09/08 INFO #index Indexing application.
|
|
9
|
+
# 2015/09/11 ERROR #search Searching application.
|
|
10
|
+
# ...
|
|
11
|
+
|
|
12
|
+
#Started GET "/api/usuarios/1/recintos/10/hubs/10" for 127.0.0.1 at 2018-06-28 21:37:39 -0400
|
|
13
|
+
pattern = /^(Completed)\s+(.+)$/
|
|
14
|
+
#pattern = /^(\d{4}\/\d{2}\/\d{2})\s+(INFO|DEBUG|WARN|ERROR)\s+(#\S+)\s+(.+)$/
|
|
15
|
+
fields = [:metodo, :message]
|
|
16
|
+
custom_time_format = '%Y/%m/%d'
|
|
17
|
+
|
|
18
|
+
indy = Indy.search(
|
|
19
|
+
|
|
20
|
+
:source => log_contents,
|
|
21
|
+
:entry_regexp => pattern,
|
|
22
|
+
:entry_fields => fields,
|
|
23
|
+
:time_format => custom_time_format
|
|
24
|
+
)
|
|
25
|
+
indy.like(:metodo => 'Completed') do |entry|
|
|
26
|
+
puts "#{entry.metodo} #{entry.message}"
|
|
27
|
+
end
|
|
28
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
namespace :process do
|
|
3
|
+
desc 'Stop rails server'
|
|
4
|
+
task :stop do
|
|
5
|
+
File.new("tmp/pids/server.pid").tap { |f| Process.kill 9, f.read.to_i }.delete
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
desc 'Starts rails server'
|
|
9
|
+
task :start do
|
|
10
|
+
Process.exec("rails s puma -d")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
desc "Restarts rails server"
|
|
14
|
+
task :restart do
|
|
15
|
+
Rake::Task[:stop].invoke
|
|
16
|
+
Rake::Task[:start].invoke
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require_relative 'schema/schema.rb'
|
|
3
|
+
require_relative 'schema/rule_engine/rule_engine.rb'
|
|
4
|
+
|
|
5
|
+
namespace :schema do
|
|
6
|
+
desc 'Parse Schema'
|
|
7
|
+
task :parse do
|
|
8
|
+
@root = Rails.root
|
|
9
|
+
init_schema
|
|
10
|
+
end
|
|
11
|
+
desc 'Create Rule Engine Schema'
|
|
12
|
+
task :rule_engine do
|
|
13
|
+
@root = Rails.root
|
|
14
|
+
init_rule_engine
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|