Sha256: 1c90424ef3ed71eda89e7591704dc37f4b52dfe3b90e60a0040e117ef221bf01
Contents?: true
Size: 986 Bytes
Versions: 29
Compression:
Stored size: 986 Bytes
Contents
module UniverseCompiler module Package module Bootstrap DEFAULT_BOOTSTRAP_FILE = 'main.rb'.freeze attr_reader :path def path=(path) @path = path if path_valid? path end def path_valid?(path = self.path) return false unless path.is_a?(String) && File.readable?(path) return true if File.file? path File.exist? default_bootstrap_file(path) end def bootstrap_file return nil unless path_valid? if File.file? path path else default_bootstrap_file end end def load require bootstrap_file rescue ScriptError => e msg = "Invalid package: '#{bootstrap_file}': #{e.message}" UniverseCompiler.logger.error msg raise UniverseCompiler::Error.from(e, msg) end private def default_bootstrap_file(path = self.path) File.join(path, DEFAULT_BOOTSTRAP_FILE) end end end end
Version data entries
29 entries across 29 versions & 1 rubygems