require "parser/parse.rb" require "parser/protections_table.rb" require "database/dir_tree.rb" require "configuration/config.rb" require "optimiser/transformer.rb" require "optimiser/outputter.rb" require "rubygems" require 'P4' require 'pry' include Config class Re_prot_setup attr_accessor :ft, :p4, :prot, :cp, :trans, :out def initialize @ft = Dir_Tree.new @p4 = P4.new @prot = Protections_Table.new(@p4, @ft) @cp = Parse.new(Config::CHECKPOINT, @ft, @prot) end def read_in while true unless @cp.read_line break end end end def ft_remove_client_trees @ft.remove_client_trees end def ft_print_tree @ft.root.print_tree end def prot_apply_protections_to_tree @prot.apply_protections_to_tree end def create_transformer @trans = Transformer.new(@ft.root, @prot) end def trans_calculate_protections @trans.calculate_protections end def create_outputter @out = Outputter.new(@trans.calculated_ft) end end if __FILE__ == $0 rps = Re_prot_setup.new p "read in" rps.cp.read_in p "remove client trees" rps.ft_remove_client_trees p "apply protections to tree" rps.prot_apply_protections_to_tree p "create_transformer" rps.create_transformer p "calculate protections" rps.trans_calculate_protections p "create outputter" rps.create_outputter p "output tree" out = rps.out out.output_tree(rps.prot, rps.ft) end