class Zarchitect
Constants
- ASSETDIR
- ASSETSDIR
- BUILDIR
- CONFIGDIR
- DEBUGSDIR
- DRAFTDIR
- FILEDIR
- FILESDIR
- HTMLDIR
- LAYOUTDIR
- SHARESDIR
Public Class Methods
new()
click to toggle source
# File lib/zarchitect.rb, line 23 def initialize @@sections = Array.new GPI.app_name = "zarchitect" GPI.extend(:dir) GPI.extend(:file) GPI.extend(:hash) GPI.extend(:numeric) GPI.extend(:string) GPI::CLU.init # Command name | range of parameter num | options GPI::CLU.use_command("u", [0], "rvqdD") GPI::CLU.use_command("update", [0], "rvqdD") GPI::CLU.use_command("ua", [0], "v") GPI::CLU.use_command("update-assets", [0], "v") GPI::CLU.use_command("uf", [0], "v") GPI::CLU.use_command("update-files", [0], "v") GPI::CLU.use_command("setup", [0], "v") GPI::CLU.use_command("new", 2..3, "v") #app_command(0..2, "r") # appname = command.name GPI::CLU.process_args @@rss = ZRSS.new end
Private Class Methods
add_section(conf)
click to toggle source
# File lib/zarchitect.rb, line 137 def Zarchitect.add_section(conf) #@@sections[conf.key] = Section.new(conf) @@sections.push Section.new(conf) end
conf()
click to toggle source
# File lib/zarchitect.rb, line 125 def Zarchitect.conf @@zr_config end
iconf()
click to toggle source
# File lib/zarchitect.rb, line 129 def Zarchitect.iconf @@index_config end
rebuild()
click to toggle source
# File lib/zarchitect.rb, line 84 def self.rebuild # delete all contents of _html Dir[ File.join(HTMLDIR, "**", "*") ].reverse.reject do |fullpath| if File.directory?(fullpath) GPI.print "deleting dir #{fullpath}" Dir.delete(fullpath) GPI.print "deleted dir #{fullpath}" else GPI.print "deleting file #{fullpath}" File.delete(fullpath) GPI.print "deleted file #{fullpath}" end end end
sconf()
click to toggle source
# File lib/zarchitect.rb, line 133 def Zarchitect.sconf @@sec_config end
section(key)
click to toggle source
# File lib/zarchitect.rb, line 146 def Zarchitect.section(key) @@sections.each do |s| return s if s.key == key end nil end
sections()
click to toggle source
# File lib/zarchitect.rb, line 142 def Zarchitect.sections @@sections end
setup_html_tree()
click to toggle source
# File lib/zarchitect.rb, line 99 def self.setup_html_tree Util.mkdir(HTMLDIR) Util.mkdir(File.join(HTMLDIR, ASSETSDIR)) Util.mkdir(File.join(HTMLDIR, FILESDIR)) Util.mkdir(File.join(BUILDDIR, DEBUGSDIR)) if GPI::CLU.check_option('d') end
Public Instance Methods
main()
click to toggle source
# File lib/zarchitect.rb, line 49 def main if GPI::CLU.check_option('v') GPI.print "Verbose Mode" else GPI.print "Non-verbose Mode" end # Load config case GPI::CLU.command when "new" # create md file for new web page load_conf cmd = CMD::New.new cmd.run when "update","u" load_conf cmd = CMD::Update.new cmd.run when "sync" # draw data from mastodon / twitter api when "update-assets","ua" load_conf CMD::Misc.update_assets when "update-files","uf" load_conf CMD::Misc.update_files when "setup" CMD::Misc.setup end end
rss()
click to toggle source
# File lib/zarchitect.rb, line 78 def rss @@rss end
Private Instance Methods
load_conf()
click to toggle source
# File lib/zarchitect.rb, line 106 def load_conf @@zr_config = Config.new("_config/_zarchitect.yaml", "configuration") @@zr_config.validate_zrconf @@zr_config.setup @@index_config = Config.new("_config/_index.yaml", "index") @@index_config.validate @@index_config.setup @@sec_config = Array.new Dir.files("_config").each do |f| next if f[0] == "." # don't read swap files next if f == "_zarchitect.yaml" next if f == "_index.yaml" n = f.sub(".yaml", "") @@sec_config.push Config.new("_config/#{f}", n) @@sec_config.last.validate @@sec_config.last.setup end end