class SdocAll::BaseTask
Public Instance Methods
clobber?()
click to toggle source
# File lib/sdoc_all/task.rb, line 21 def clobber? full_doc_path = Base.docs_path + doc_path return true unless full_doc_path.exist? created_hash = config_hash_path.read rescue nil if created_hash != config_hash puts "#{title}: config changed, rebuilding".red return true end end
config_hash()
click to toggle source
# File lib/sdoc_all/task.rb, line 5 def config_hash Digest::SHA1.hexdigest(for_hash.inspect) end
config_hash_path()
click to toggle source
# File lib/sdoc_all/task.rb, line 9 def config_hash_path Base.docs_path + doc_path + 'config.hash' end
created_rid_path()
click to toggle source
# File lib/sdoc_all/task.rb, line 13 def created_rid_path Base.docs_path + doc_path + 'created.rid' end
last_build_time()
click to toggle source
# File lib/sdoc_all/task.rb, line 17 def last_build_time Time.parse(created_rid_path.read) rescue nil end
run_if_clobber() { || ... }
click to toggle source
# File lib/sdoc_all/task.rb, line 32 def run_if_clobber if clobber? Base.remove_if_present(Base.docs_path + doc_path) yield if (Base.docs_path + doc_path).directory? config_hash_path.open('w') do |f| f.write(config_hash) end end end end