class DidGood::Repo
This is a repo of everything DidGood
saves between runs. It includes downloaded Git repos, Goods files and more.
Attributes
didgood_dir[R]
Public Class Methods
new()
click to toggle source
# File lib/didgood.rb, line 30 def initialize @home = ENV["HOME"] @didgood_dir = "#{@home}/.didgood" Dir.mkdir(@didgood_dir) unless File.directory?(@didgood_dir) ["git", "goods"].each do |subdir| full_subdir = "#{@didgood_dir}/#{subdir}" Dir.mkdir(full_subdir) unless File.directory?(full_subdir) end unless File.exist?("#{@didgood_dir}/dgd/bin/dgd") dgd_dir = "#{@didgood_dir}/dgd" if File.directory?(dgd_dir) # Not clear to me what to do here... else DidGood.system_call("git clone https://github.com/ChatTheatre/dgd.git #{dgd_dir}") Dir.chdir("#{@didgood_dir}/dgd/src") do DidGood.system_call(DGD_BUILD_COMMAND) end end end end
Public Instance Methods
assemble_app(location)
click to toggle source
# File lib/didgood.rb, line 63 def assemble_app(location) dgd_root = "#{File.expand_path(location)}/#{GENERATED_ROOT}" FileUtils.rm_rf(dgd_root) Dir.mkdir(dgd_root) write_config_file("#{location}/dgd.config") specs = @didgood_file.specs specs.each do |spec| git_repo = spec.source git_repo.use_details(spec.source_details) spec.paths.each do |from, to| from_path = "#{git_repo.local_dir}/#{from}" to_path = "#{dgd_root}/#{to}" FileUtils.mkdir_p to_path FileUtils.cp_r(from_path, to_path) end end end
didgood_file(path)
click to toggle source
# File lib/didgood.rb, line 57 def didgood_file(path) raise "Already have a dgd.didgood file!" if @didgood_file @didgood_file ||= AppFile.new(self, path) end
git_repo(git_url)
click to toggle source
# File lib/didgood.rb, line 52 def git_repo(git_url) @git_repos ||= {} @git_repos[git_url] ||= GitRepo.new(self, git_url) end
write_config_file(path)
click to toggle source
# File lib/didgood.rb, line 85 def write_config_file(path) File.open(path, "wb") do |f| f.write <<CONTENTS /* These are SkotOS limits. They are enormous. They should be configurable but they are not yet. */ telnet_port = ([ "*":50100 /* telnet port number */ ]); binary_port = ([ "*":50110, /* Failsafe */ ]); /* binary ports */ directory = "./#{GENERATED_ROOT}"; users = 100; /* max # of users */ editors = 40; /* max # of editor sessions */ ed_tmpfile = "../state/ed"; /* proto editor tmpfile */ swap_file = "../state/swap"; /* swap file */ swap_size = 1048576; /* # sectors in swap file */ sector_size = 512; /* swap sector size */ swap_fragment = 4096; /* fragment to swap out */ static_chunk = 64512; /* static memory chunk */ dynamic_chunk = 261120; /* dynamic memory chunk */ dump_file = "../state/dump"; /* dump file */ dump_interval = 3600; /* dump interval */ typechecking = 2; /* highest level of typechecking */ include_file = "/include/std.h"; /* standard include file */ include_dirs = ({ "/include", "~/include" }); /* directories to search */ auto_object = "/kernel/lib/auto"; /* auto inherited object */ driver_object = "/kernel/sys/driver"; /* driver object */ create = "_F_create"; /* name of create function */ array_size = 16384; /* max array size */ objects = 262144; /* max # of objects */ call_outs = 16384; /* max # of call_outs */ CONTENTS end end