module LocalPac class Initializer private attr_reader :config, :vcs, :options include Fileable public def initialize(options = {}, config = LocalPac.config) @options = options @config = config end def run LocalPac.ui_logger.info "Creating pid directory: #{::File.dirname(config.pid_file)}" Actions::CreateDirectory.new(::File.dirname(config.pid_file), force: options[:force]).run LocalPac.ui_logger.info "Creating log sink: #{config.log_sink}" Actions::CreateDirectory.new(config.log_sink, force: options[:force]).run LocalPac.ui_logger.info "Creating local storage: #{config.local_storage}" Actions::CreateRepository.new(config.local_storage, bare: true, force: options[:force]).run LocalPac.ui_logger.info "Creating pre-receive hook in local storage \"#{config.local_storage}\"." Actions::CreateFile.new(:'git-hook', File.join(config.local_storage, 'hooks', 'pre-receive'), Data.new(config), force: options[:force]).run end end end