5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 18:56:21 +00:00

feat: usar un grafo dirigido para ordenar las dependencias #10464

This commit is contained in:
f 2023-03-17 18:54:38 -03:00
parent 4f8ea0d9a7
commit db25750ab0
3 changed files with 38 additions and 0 deletions

View file

@ -23,6 +23,7 @@ if ENV['RAILS_GROUPS']&.split(',')&.include? 'assets'
end end
gem 'nokogiri' gem 'nokogiri'
gem 'rgl'
# Turbolinks makes navigating your web application faster. Read more: # Turbolinks makes navigating your web application faster. Read more:
# https://github.com/turbolinks/turbolinks # https://github.com/turbolinks/turbolinks

View file

@ -353,6 +353,7 @@ GEM
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.6.1)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pairing_heap (3.0.0)
parallel (1.21.0) parallel (1.21.0)
parser (3.0.2.0) parser (3.0.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
@ -443,6 +444,10 @@ GEM
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
rexml (3.2.5) rexml (3.2.5)
rgl (0.6.2)
pairing_heap (>= 0.3.0)
rexml (~> 3.2, >= 3.2.4)
stream (~> 0.5.3)
rouge (3.26.1) rouge (3.26.1)
rubocop (1.23.0) rubocop (1.23.0)
parallel (~> 1.10) parallel (~> 1.10)
@ -510,6 +515,7 @@ GEM
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.2-x86_64-linux-musl) sqlite3 (1.4.2-x86_64-linux-musl)
stackprof (0.2.17-x86_64-linux-musl) stackprof (0.2.17-x86_64-linux-musl)
stream (0.5.5)
sucker_punch (3.0.1) sucker_punch (3.0.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
sutty-archives (2.5.4) sutty-archives (2.5.4)
@ -626,6 +632,7 @@ DEPENDENCIES
rails_warden rails_warden
redis redis
redis-rails redis-rails
rgl
rollups! rollups!
rubocop-rails rubocop-rails
rubyzip rubyzip

View file

@ -0,0 +1,30 @@
# frozen_string_literal: true
require 'rgl/adjacency'
class Site
module DeployDependencies
extend ActiveSupport::Concern
included do
# Genera un grafo dirigido de todos los métodos de publicación
#
# @return [RGL::DirectedAdjacencyGraph]
def deployment_graph
@deployment_graph ||= RGL::DirectedAdjacencyGraph.new.tap do |graph|
deploys.each do |deploy|
graph.add_vertex deploy
end
deploys.each do |deploy|
deploy.class::DEPENDENCIES.each do |dependency|
deploys.where(type: "Deploy#{dependency.to_s.classify}").each do |deploy_dependency|
graph.add_edge deploy_dependency, deploy
end
end
end
end
end
end
end
end