From 587d650032e09183a5af471e10eded0d25a1ac12 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 10 Jan 2019 01:14:14 +0530 Subject: [PATCH 01/12] renamed `content` to `contentdb` --- content/add_document_to_index.lua | 12 ++++++------ content/base.lua | 14 +++++++------- content/documents.lua | 6 +++--- content/get_document_path.lua | 6 +++--- content/get_validator.lua | 2 +- content/mod.lua | 18 +++++++++--------- content/query.lua | 8 ++++---- content/read_document.lua | 4 ++-- content/read_log.lua | 8 ++++---- content/setup_index.lua | 26 +++++++++++++------------- content/setup_schema.lua | 16 ++++++++-------- content/split_header.lua | 2 +- content/validate_document.lua | 4 ++-- content/walk_documents.lua | 12 ++++++------ content/write_file.lua | 8 ++++---- 15 files changed, 73 insertions(+), 73 deletions(-) diff --git a/content/add_document_to_index.lua b/content/add_document_to_index.lua index fff895f..fbb0624 100644 --- a/content/add_document_to_index.lua +++ b/content/add_document_to_index.lua @@ -1,13 +1,13 @@ -function content.add_document_to_index (doc_id, store_id, file_content, model) +function contentdb.add_document_to_index (doc_id, store_id, file_contentdb, model) if not model then log.warn("Document " .. doc_id .. " in " .. store_id .. " does not have a model") return end local doc = tan.new_document() - doc:add_text(content.fields.uuid, doc_id) - doc:add_text(content.fields.store, store_id) - doc:add_text(content.fields.model, model) - doc:add_text(content.fields.content, file_content) - content.index_writer:add_document(doc) + doc:add_text(contentdb.fields.uuid, doc_id) + doc:add_text(contentdb.fields.store, store_id) + doc:add_text(contentdb.fields.model, model) + doc:add_text(contentdb.fields.contentdb, file_contentdb) + contentdb.index_writer:add_document(doc) end \ No newline at end of file diff --git a/content/base.lua b/content/base.lua index 610cf7f..aa302c9 100644 --- a/content/base.lua +++ b/content/base.lua @@ -1,6 +1,6 @@ -content = { +contentdb = { stores = { - home = "content/home/" + home = "contentdb/home/" } } @@ -17,12 +17,12 @@ function model_metatable:validate (object) return true end --- Add all directories in content to the stores table -for entry in fs.entries("content/") do - if fs.metadata("content/" .. entry).type == "directory" then - content.stores[entry] = "content/" .. entry .. "/" +-- Add all directories in contentdb to the stores table +for entry in fs.entries("contentdb/") do + if fs.metadata("contentdb/" .. entry).type == "directory" then + contentdb.stores[entry] = "contentdb/" .. entry .. "/" end end - fs.create_dir("content/home", true) + fs.create_dir("contentdb/home", true) diff --git a/content/documents.lua b/content/documents.lua index 7b1d96b..4c9a196 100644 --- a/content/documents.lua +++ b/content/documents.lua @@ -1,6 +1,6 @@ -function content.documents (store_id) +function contentdb.documents (store_id) if store_id then - local dir = content.stores[store_id] + local dir = contentdb.stores[store_id] local f = fs.entries(dir) @@ -13,7 +13,7 @@ function content.documents (store_id) else local docs_co = coroutine.create(function () - for store_id, dir in pairs(content.stores) do + for store_id, dir in pairs(contentdb.stores) do if fs.exists(dir) then for entry in fs.entries(dir) do coroutine.yield(entry, store_id) diff --git a/content/get_document_path.lua b/content/get_document_path.lua index 972ef9b..299e199 100644 --- a/content/get_document_path.lua +++ b/content/get_document_path.lua @@ -1,8 +1,8 @@ -function content.get_document_path (doc_uuid, store_id) +function contentdb.get_document_path (doc_uuid, store_id) if store_id then - return (content.stores[store_id] or "content/" .. store_id) .. doc_uuid + return (contentdb.stores[store_id] or "contentdb/" .. store_id) .. doc_uuid else - for store_id, dir in content.stores_iter() do + for store_id, dir in contentdb.stores_iter() do end end diff --git a/content/get_validator.lua b/content/get_validator.lua index 1b72fab..834b000 100644 --- a/content/get_validator.lua +++ b/content/get_validator.lua @@ -1,4 +1,4 @@ -function content.get_validator (name) +function contentdb.get_validator (name) local model_def = models[name] if not model_def then return nil, "Model " .. name .. " not found" diff --git a/content/mod.lua b/content/mod.lua index a1252cc..c9003bb 100644 --- a/content/mod.lua +++ b/content/mod.lua @@ -1,11 +1,11 @@ -require "content.base" -require "content.split_header" -require "content.get_validator" -require "content.validate_document" -require "content.read_document" -require "content.documents" -require "content.walk_documents" -require "content.write_file" +require "contentdb.base" +require "contentdb.split_header" +require "contentdb.get_validator" +require "contentdb.validate_document" +require "contentdb.read_document" +require "contentdb.documents" +require "contentdb.walk_documents" +require "contentdb.write_file" local valua = require "third-party.valua" -return content +return contentdb diff --git a/content/query.lua b/content/query.lua index 0b18dbd..9713439 100644 --- a/content/query.lua +++ b/content/query.lua @@ -1,14 +1,14 @@ -function content.query (query_str) +function contentdb.query (query_str) log.trace("Start tantivy search") local fields = {} - for _, v in pairs(content.fields) do + for _, v in pairs(contentdb.fields) do table.insert(fields, v) end - local parser = tan.query_parser_for_index(content.index, fields) + local parser = tan.query_parser_for_index(contentdb.index, fields) local coll = tan.top_collector_with_limit(500) - local result = content.index:search(parser, query_str, coll) + local result = contentdb.index:search(parser, query_str, coll) return result --[[ diff --git a/content/read_document.lua b/content/read_document.lua index ceb4e75..bbff3ee 100644 --- a/content/read_document.lua +++ b/content/read_document.lua @@ -1,6 +1,6 @@ -function content.read_document (in_uuid) +function contentdb.read_document (in_uuid) log.trace("Running: " .. debug.getinfo(1, 'S').source) - return content.walk_documents(nil, function (file_uuid, header, body, profile) + return contentdb.walk_documents(nil, function (file_uuid, header, body, profile) if file_uuid == in_uuid then return header, body, profile end diff --git a/content/read_log.lua b/content/read_log.lua index 88da6d3..1dab9ab 100644 --- a/content/read_log.lua +++ b/content/read_log.lua @@ -1,15 +1,15 @@ -function content.read_log (log_uuid) +function contentdb.read_log (log_uuid) -- It's getting just the request logs, it should read all logs but this -- function is not completely thought trough yet local dir = "log/incoming-request/" for _, file_uuid in ipairs(fs.get_all_files_in(dir)) do local path = dir .. file_uuid - local file_content = fs.read_file(path) - if not file_content then + local file_contentdb = fs.read_file(path) + if not file_contentdb then error("could not open " .. path) end - return scl.to_table(file_content) + return scl.to_table(file_contentdb) end end diff --git a/content/setup_index.lua b/content/setup_index.lua index 6ab3343..43106a3 100644 --- a/content/setup_index.lua +++ b/content/setup_index.lua @@ -1,39 +1,39 @@ -function content.setup_index (path) +function contentdb.setup_index (path) path = path or "./tantivy-index" --TODO: implement fs.remove_dir(path, true) --os.execute("rm -r " .. path) --fs.create_dir(path, true) - content.index = tan.index_in_ram(content.schema) + contentdb.index = tan.index_in_ram(contentdb.schema) - content.index_writer = content.index:writer(50000000) + contentdb.index_writer = contentdb.index:writer(50000000) -- Walk through all documents and add them to the index - for store_id, dir in pairs(content.stores) do + for store_id, dir in pairs(contentdb.stores) do if fs.exists(dir) then for doc_id in fs.entries(dir) do - -- Would use content.read_document but it doesn't return the file contents - local path = content.stores[store_id] .. doc_id + -- Would use contentdb.read_document but it doesn't return the file contentdbs + local path = contentdb.stores[store_id] .. doc_id - local file_content = fs.read_file(path) - if not file_content then + local file_contentdb = fs.read_file(path) + if not file_contentdb then error("could not open " .. path) end - local doc_fields = content.split_header(file_content) + local doc_fields = contentdb.split_header(file_contentdb) - content.add_document_to_index( + contentdb.add_document_to_index( doc_id, store_id, - file_content, + file_contentdb, doc_fields.model ) end end end - content.index_writer:commit() - content.index:load_searchers() + contentdb.index_writer:commit() + contentdb.index:load_searchers() end \ No newline at end of file diff --git a/content/setup_schema.lua b/content/setup_schema.lua index 6bb2bc0..27de922 100644 --- a/content/setup_schema.lua +++ b/content/setup_schema.lua @@ -1,17 +1,17 @@ -function content.setup_schema () +function contentdb.setup_schema () local builder = tan.new_schema_builder() builder:add_text_field("uuid", {tan.STRING, tan.STORED}) builder:add_text_field("store", {tan.STRING, tan.STORED}) builder:add_text_field("model", {tan.STRING, tan.STORED}) - builder:add_text_field("content", {tan.TEXT}) + builder:add_text_field("contentdb", {tan.TEXT}) - content.schema = builder:build() + contentdb.schema = builder:build() - content.fields = { - uuid = content.schema:get_field("uuid"), - store = content.schema:get_field("store"), - model = content.schema:get_field("model"), - content = content.schema:get_field("content"), + contentdb.fields = { + uuid = contentdb.schema:get_field("uuid"), + store = contentdb.schema:get_field("store"), + model = contentdb.schema:get_field("model"), + contentdb = contentdb.schema:get_field("contentdb"), } end diff --git a/content/split_header.lua b/content/split_header.lua index 9c753b3..30917c2 100644 --- a/content/split_header.lua +++ b/content/split_header.lua @@ -1,4 +1,4 @@ -function content.split_header (document_text) +function contentdb.split_header (document_text) log.trace("Running: " .. debug.getinfo(1, 'S').source) local scl_text, body = document_text:match("---\n(.*)\n+...\n(.*)") if scl_text == nil then diff --git a/content/validate_document.lua b/content/validate_document.lua index 47c2b0a..5e7546d 100644 --- a/content/validate_document.lua +++ b/content/validate_document.lua @@ -1,9 +1,9 @@ -function content.validate_document (header) +function contentdb.validate_document (header) if not header.model then return false, "document does not define a model" end - local model, err = content.get_validator(header.model) + local model, err = contentdb.get_validator(header.model) if not model then return false, err end diff --git a/content/walk_documents.lua b/content/walk_documents.lua index 83278cb..c4e0878 100644 --- a/content/walk_documents.lua +++ b/content/walk_documents.lua @@ -1,14 +1,14 @@ -function content.walk_documents (_store_id, fn) +function contentdb.walk_documents (_store_id, fn) log.trace("Running: " .. debug.getinfo(1, 'S').source) - for doc_id, store_id in content.documents(_store_id) do + for doc_id, store_id in contentdb.documents(_store_id) do - local path = content.stores[store_id] .. doc_id - local file_content = fs.read_file(path) - if not file_content then + local path = contentdb.stores[store_id] .. doc_id + local file_contentdb = fs.read_file(path) + if not file_contentdb then log.error("could not open " .. path) end - local header, body = content.split_header(file_content) + local header, body = contentdb.split_header(file_contentdb) -- If the fn applied on this file returns values, stop walking local results = { fn(doc_id, header, body, store_id) } diff --git a/content/write_file.lua b/content/write_file.lua index b0d7b32..a6dbe2f 100644 --- a/content/write_file.lua +++ b/content/write_file.lua @@ -1,11 +1,11 @@ -function content.write_file (store_id, file_uuid, fields, body_param) +function contentdb.write_file (store_id, file_uuid, fields, body_param) log.trace("Running: " .. debug.getinfo(1, 'S').source) - local dir = content.stores[store_id] + local dir = contentdb.stores[store_id] if not dir then - dir = "content/" .. store_id .. "/" + dir = "contentdb/" .. store_id .. "/" fs.create_dir(dir, true) - content.stores[store_id] = dir + contentdb.stores[store_id] = dir end local path = dir .. file_uuid From 034c076191b688fcbc2b4e7085e7ce66645ab908 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 10 Jan 2019 01:33:55 +0530 Subject: [PATCH 02/12] refactored wrong names --- content/add_document_to_index.lua | 4 ++-- content/read_log.lua | 6 +++--- content/setup_index.lua | 8 ++++---- content/walk_documents.lua | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/content/add_document_to_index.lua b/content/add_document_to_index.lua index fbb0624..0912fbd 100644 --- a/content/add_document_to_index.lua +++ b/content/add_document_to_index.lua @@ -1,4 +1,4 @@ -function contentdb.add_document_to_index (doc_id, store_id, file_contentdb, model) +function contentdb.add_document_to_index (doc_id, store_id, file_content, model) if not model then log.warn("Document " .. doc_id .. " in " .. store_id .. " does not have a model") return @@ -8,6 +8,6 @@ function contentdb.add_document_to_index (doc_id, store_id, file_contentdb, mode doc:add_text(contentdb.fields.uuid, doc_id) doc:add_text(contentdb.fields.store, store_id) doc:add_text(contentdb.fields.model, model) - doc:add_text(contentdb.fields.contentdb, file_contentdb) + doc:add_text(contentdb.fields.content, file_content) contentdb.index_writer:add_document(doc) end \ No newline at end of file diff --git a/content/read_log.lua b/content/read_log.lua index 1dab9ab..cb35656 100644 --- a/content/read_log.lua +++ b/content/read_log.lua @@ -5,11 +5,11 @@ function contentdb.read_log (log_uuid) for _, file_uuid in ipairs(fs.get_all_files_in(dir)) do local path = dir .. file_uuid - local file_contentdb = fs.read_file(path) - if not file_contentdb then + local file_content = fs.read_file(path) + if not file_content then error("could not open " .. path) end - return scl.to_table(file_contentdb) + return scl.to_table(file_content) end end diff --git a/content/setup_index.lua b/content/setup_index.lua index 43106a3..b5676ff 100644 --- a/content/setup_index.lua +++ b/content/setup_index.lua @@ -17,17 +17,17 @@ function contentdb.setup_index (path) -- Would use contentdb.read_document but it doesn't return the file contentdbs local path = contentdb.stores[store_id] .. doc_id - local file_contentdb = fs.read_file(path) - if not file_contentdb then + local file_content = fs.read_file(path) + if not file_content then error("could not open " .. path) end - local doc_fields = contentdb.split_header(file_contentdb) + local doc_fields = contentdb.split_header(file_content) contentdb.add_document_to_index( doc_id, store_id, - file_contentdb, + file_content, doc_fields.model ) end diff --git a/content/walk_documents.lua b/content/walk_documents.lua index c4e0878..e235983 100644 --- a/content/walk_documents.lua +++ b/content/walk_documents.lua @@ -3,12 +3,12 @@ function contentdb.walk_documents (_store_id, fn) for doc_id, store_id in contentdb.documents(_store_id) do local path = contentdb.stores[store_id] .. doc_id - local file_contentdb = fs.read_file(path) - if not file_contentdb then + local file_content = fs.read_file(path) + if not file_content then log.error("could not open " .. path) end - local header, body = contentdb.split_header(file_contentdb) + local header, body = contentdb.split_header(file_content) -- If the fn applied on this file returns values, stop walking local results = { fn(doc_id, header, body, store_id) } From 8c3f21f3021fe5143c1057cd6a9730166f14b6b3 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 10 Jan 2019 04:26:30 +0530 Subject: [PATCH 03/12] migrated to contentdb.lua --- content/add_document_to_index.lua | 13 ----------- content/base.lua | 28 ---------------------- content/documents.lua | 33 -------------------------- content/get_document_path.lua | 9 ------- content/get_validator.lua | 32 ------------------------- content/mod.lua | 11 --------- content/query.lua | 24 ------------------- content/read_document.lua | 8 ------- content/read_log.lua | 15 ------------ content/setup_index.lua | 39 ------------------------------- content/setup_schema.lua | 17 -------------- content/split_header.lua | 9 ------- content/validate_document.lua | 12 ---------- content/walk_documents.lua | 19 --------------- content/write_file.lua | 30 ------------------------ import.scl | 7 +++++- 16 files changed, 6 insertions(+), 300 deletions(-) delete mode 100644 content/add_document_to_index.lua delete mode 100644 content/base.lua delete mode 100644 content/documents.lua delete mode 100644 content/get_document_path.lua delete mode 100644 content/get_validator.lua delete mode 100644 content/mod.lua delete mode 100644 content/query.lua delete mode 100644 content/read_document.lua delete mode 100644 content/read_log.lua delete mode 100644 content/setup_index.lua delete mode 100644 content/setup_schema.lua delete mode 100644 content/split_header.lua delete mode 100644 content/validate_document.lua delete mode 100644 content/walk_documents.lua delete mode 100644 content/write_file.lua diff --git a/content/add_document_to_index.lua b/content/add_document_to_index.lua deleted file mode 100644 index 0912fbd..0000000 --- a/content/add_document_to_index.lua +++ /dev/null @@ -1,13 +0,0 @@ -function contentdb.add_document_to_index (doc_id, store_id, file_content, model) - if not model then - log.warn("Document " .. doc_id .. " in " .. store_id .. " does not have a model") - return - end - - local doc = tan.new_document() - doc:add_text(contentdb.fields.uuid, doc_id) - doc:add_text(contentdb.fields.store, store_id) - doc:add_text(contentdb.fields.model, model) - doc:add_text(contentdb.fields.content, file_content) - contentdb.index_writer:add_document(doc) -end \ No newline at end of file diff --git a/content/base.lua b/content/base.lua deleted file mode 100644 index aa302c9..0000000 --- a/content/base.lua +++ /dev/null @@ -1,28 +0,0 @@ -contentdb = { - stores = { - home = "contentdb/home/" - } -} - --- Methods for the model class -local model_metatable = {} -model_metatable.__index = model_metatable -function model_metatable:validate (object) - for name, validator in pairs(self.fields) do - local result, err = validator(object[name]) - if not result then - return result, name .. ": " .. err - end - end - return true -end - --- Add all directories in contentdb to the stores table -for entry in fs.entries("contentdb/") do - if fs.metadata("contentdb/" .. entry).type == "directory" then - contentdb.stores[entry] = "contentdb/" .. entry .. "/" - end -end - - - fs.create_dir("contentdb/home", true) diff --git a/content/documents.lua b/content/documents.lua deleted file mode 100644 index 4c9a196..0000000 --- a/content/documents.lua +++ /dev/null @@ -1,33 +0,0 @@ -function contentdb.documents (store_id) - if store_id then - local dir = contentdb.stores[store_id] - - local f = fs.entries(dir) - - return function () - local entry = f() - if entry then - return entry, store_id - end - end - else - - local docs_co = coroutine.create(function () - for store_id, dir in pairs(contentdb.stores) do - if fs.exists(dir) then - for entry in fs.entries(dir) do - coroutine.yield(entry, store_id) - end - end - end - end) - - return function () - local cont, uuid, store_id = coroutine.resume(docs_co) - if cont then - return uuid, store_id - end - end - - end -end \ No newline at end of file diff --git a/content/get_document_path.lua b/content/get_document_path.lua deleted file mode 100644 index 299e199..0000000 --- a/content/get_document_path.lua +++ /dev/null @@ -1,9 +0,0 @@ -function contentdb.get_document_path (doc_uuid, store_id) - if store_id then - return (contentdb.stores[store_id] or "contentdb/" .. store_id) .. doc_uuid - else - for store_id, dir in contentdb.stores_iter() do - - end - end -end \ No newline at end of file diff --git a/content/get_validator.lua b/content/get_validator.lua deleted file mode 100644 index 834b000..0000000 --- a/content/get_validator.lua +++ /dev/null @@ -1,32 +0,0 @@ -function contentdb.get_validator (name) - local model_def = models[name] - if not model_def then - return nil, "Model " .. name .. " not found" - end - - for name, field_def in pairs(model_def.fields) do - local validator = valua:new() - - if field_def.optional then - validator.optional(true) - end - - if field_def.type == "number" then - validator.number() - elseif field_def.type == "integer" then - validator.integer() - elseif field_def.type == "string" then - validator.string() - else - return nil, "missing type in field " .. name - end - - fields[name] = validator - end - - local model = setmetatable({ - fields = fields - }, model_metatable) - - return model -end \ No newline at end of file diff --git a/content/mod.lua b/content/mod.lua deleted file mode 100644 index c9003bb..0000000 --- a/content/mod.lua +++ /dev/null @@ -1,11 +0,0 @@ -require "contentdb.base" -require "contentdb.split_header" -require "contentdb.get_validator" -require "contentdb.validate_document" -require "contentdb.read_document" -require "contentdb.documents" -require "contentdb.walk_documents" -require "contentdb.write_file" -local valua = require "third-party.valua" - -return contentdb diff --git a/content/query.lua b/content/query.lua deleted file mode 100644 index 9713439..0000000 --- a/content/query.lua +++ /dev/null @@ -1,24 +0,0 @@ -function contentdb.query (query_str) - log.trace("Start tantivy search") - - local fields = {} - for _, v in pairs(contentdb.fields) do - table.insert(fields, v) - end - - local parser = tan.query_parser_for_index(contentdb.index, fields) - local coll = tan.top_collector_with_limit(500) - local result = contentdb.index:search(parser, query_str, coll) - - return result - --[[ - for i = 1, #result do - local doc = result[i] - table.insert(uuids, { - file = doc:get_first(uuid_field), - profile = "unknown_profile" - }) - end - log.trace("End tantivy search") - --]] -end \ No newline at end of file diff --git a/content/read_document.lua b/content/read_document.lua deleted file mode 100644 index bbff3ee..0000000 --- a/content/read_document.lua +++ /dev/null @@ -1,8 +0,0 @@ -function contentdb.read_document (in_uuid) - log.trace("Running: " .. debug.getinfo(1, 'S').source) - return contentdb.walk_documents(nil, function (file_uuid, header, body, profile) - if file_uuid == in_uuid then - return header, body, profile - end - end) -end diff --git a/content/read_log.lua b/content/read_log.lua deleted file mode 100644 index cb35656..0000000 --- a/content/read_log.lua +++ /dev/null @@ -1,15 +0,0 @@ -function contentdb.read_log (log_uuid) - -- It's getting just the request logs, it should read all logs but this - -- function is not completely thought trough yet - local dir = "log/incoming-request/" - - for _, file_uuid in ipairs(fs.get_all_files_in(dir)) do - local path = dir .. file_uuid - local file_content = fs.read_file(path) - if not file_content then - error("could not open " .. path) - end - - return scl.to_table(file_content) - end -end diff --git a/content/setup_index.lua b/content/setup_index.lua deleted file mode 100644 index b5676ff..0000000 --- a/content/setup_index.lua +++ /dev/null @@ -1,39 +0,0 @@ -function contentdb.setup_index (path) - path = path or "./tantivy-index" - - --TODO: implement fs.remove_dir(path, true) - --os.execute("rm -r " .. path) - --fs.create_dir(path, true) - - contentdb.index = tan.index_in_ram(contentdb.schema) - - contentdb.index_writer = contentdb.index:writer(50000000) - - -- Walk through all documents and add them to the index - for store_id, dir in pairs(contentdb.stores) do - if fs.exists(dir) then - for doc_id in fs.entries(dir) do - - -- Would use contentdb.read_document but it doesn't return the file contentdbs - local path = contentdb.stores[store_id] .. doc_id - - local file_content = fs.read_file(path) - if not file_content then - error("could not open " .. path) - end - - local doc_fields = contentdb.split_header(file_content) - - contentdb.add_document_to_index( - doc_id, - store_id, - file_content, - doc_fields.model - ) - end - end - end - - contentdb.index_writer:commit() - contentdb.index:load_searchers() -end \ No newline at end of file diff --git a/content/setup_schema.lua b/content/setup_schema.lua deleted file mode 100644 index 27de922..0000000 --- a/content/setup_schema.lua +++ /dev/null @@ -1,17 +0,0 @@ -function contentdb.setup_schema () - local builder = tan.new_schema_builder() - - builder:add_text_field("uuid", {tan.STRING, tan.STORED}) - builder:add_text_field("store", {tan.STRING, tan.STORED}) - builder:add_text_field("model", {tan.STRING, tan.STORED}) - builder:add_text_field("contentdb", {tan.TEXT}) - - contentdb.schema = builder:build() - - contentdb.fields = { - uuid = contentdb.schema:get_field("uuid"), - store = contentdb.schema:get_field("store"), - model = contentdb.schema:get_field("model"), - contentdb = contentdb.schema:get_field("contentdb"), - } -end diff --git a/content/split_header.lua b/content/split_header.lua deleted file mode 100644 index 30917c2..0000000 --- a/content/split_header.lua +++ /dev/null @@ -1,9 +0,0 @@ -function contentdb.split_header (document_text) - log.trace("Running: " .. debug.getinfo(1, 'S').source) - local scl_text, body = document_text:match("---\n(.*)\n+...\n(.*)") - if scl_text == nil then - scl_text = "" - end - local header = scl.to_table(scl_text) - return header, body -end diff --git a/content/validate_document.lua b/content/validate_document.lua deleted file mode 100644 index 5e7546d..0000000 --- a/content/validate_document.lua +++ /dev/null @@ -1,12 +0,0 @@ -function contentdb.validate_document (header) - if not header.model then - return false, "document does not define a model" - end - - local model, err = contentdb.get_validator(header.model) - if not model then - return false, err - end - - return model:validate(header) -end \ No newline at end of file diff --git a/content/walk_documents.lua b/content/walk_documents.lua deleted file mode 100644 index e235983..0000000 --- a/content/walk_documents.lua +++ /dev/null @@ -1,19 +0,0 @@ -function contentdb.walk_documents (_store_id, fn) - log.trace("Running: " .. debug.getinfo(1, 'S').source) - for doc_id, store_id in contentdb.documents(_store_id) do - - local path = contentdb.stores[store_id] .. doc_id - local file_content = fs.read_file(path) - if not file_content then - log.error("could not open " .. path) - end - - local header, body = contentdb.split_header(file_content) - - -- If the fn applied on this file returns values, stop walking - local results = { fn(doc_id, header, body, store_id) } - if results[1] then - return table.unpack(results) - end - end -end diff --git a/content/write_file.lua b/content/write_file.lua deleted file mode 100644 index a6dbe2f..0000000 --- a/content/write_file.lua +++ /dev/null @@ -1,30 +0,0 @@ -function contentdb.write_file (store_id, file_uuid, fields, body_param) - log.trace("Running: " .. debug.getinfo(1, 'S').source) - - local dir = contentdb.stores[store_id] - if not dir then - dir = "contentdb/" .. store_id .. "/" - fs.create_dir(dir, true) - contentdb.stores[store_id] = dir - end - local path = dir .. file_uuid - - if not fields.creation_time then - fields.creation_time = tostring(time.now()) - end - - local body = "---\n" .. scl.from_table(fields) .. "...\n" .. (body_param or "") - local file = io.open(path, "w") - if not file then - log.error("Could not open file", path) - end - file:write(body) - file:close() - - events["document_created"]:trigger({ - store_id = store_id, - file_uuid = file_uuid, - fields = header, - body = body - }) -end diff --git a/import.scl b/import.scl index e8bb511..945cb5f 100644 --- a/import.scl +++ b/import.scl @@ -1,7 +1,8 @@ imports = { luvent = "third-party/", valua = "third-party/", - torchbear-libs = "third-party/", + torchbear-libs = "third-party/", + contentdb-lua = "content", # torchbear-libs-dev = "third-party/", } @@ -23,3 +24,7 @@ valua = { url = "https://github.com/sailorproject/valua", pluck = "valua.lua", } + +contentdb-lua = { + url = "https://github.com/foundpatterns/contentdb.lua", +} From 7680b83bafdee18ff6f6f05d4abad2d84dc7f5c8 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 10 Jan 2019 05:20:41 +0530 Subject: [PATCH 04/12] updated dependencies --- import.scl | 4 ++-- mod.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/import.scl b/import.scl index 945cb5f..1cfdb1e 100644 --- a/import.scl +++ b/import.scl @@ -2,8 +2,8 @@ imports = { luvent = "third-party/", valua = "third-party/", torchbear-libs = "third-party/", - contentdb-lua = "content", - # torchbear-libs-dev = "third-party/", + contentdb-lua = "contentdb", + torchbear-libs-dev = "third-party/", } torchbear-libs = { diff --git a/mod.lua b/mod.lua index a8d34de..b725c99 100644 --- a/mod.lua +++ b/mod.lua @@ -6,8 +6,8 @@ _G.fs = require "fs" require "table_ext" require "string_ext" require "underscore_alias" -_G.content = require "content.mod" +_G.content = require "contentdb.mod" _G.keys = require "keys.mod" require "loaders.package" theme_loader = require "loaders.themes.base" -class_loader = require "loaders.classes" \ No newline at end of file +class_loader = require "loaders.classes" From a922232c7ac38d1e0bdc88cdec27475561b961ee Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 10 Jan 2019 05:29:44 +0530 Subject: [PATCH 05/12] renamed variable to `contentdb` --- base.lua | 4 ++-- mod.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base.lua b/base.lua index 18a46f1..ecfc7d6 100644 --- a/base.lua +++ b/base.lua @@ -21,7 +21,7 @@ if not home_store then file:write(home_store) file:close() end -content.home = home_store +contentdb.home = home_store if torchbear.settings.theme then theme_loader.load_themes("themes/", torchbear.settings.theme) @@ -51,4 +51,4 @@ outgoing_response_event:setActionPriority(response_process_action, 100) log.info("[loaded] LightTouch") -events["lighttouch_loaded"]:trigger() \ No newline at end of file +events["lighttouch_loaded"]:trigger() diff --git a/mod.lua b/mod.lua index b725c99..f19dd76 100644 --- a/mod.lua +++ b/mod.lua @@ -6,7 +6,7 @@ _G.fs = require "fs" require "table_ext" require "string_ext" require "underscore_alias" -_G.content = require "contentdb.mod" +_G.contentdb = require "contentdb.mod" _G.keys = require "keys.mod" require "loaders.package" theme_loader = require "loaders.themes.base" From 65d3a7cdbff9dfe20e1fcc2e0c019bca64ec319e Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Sat, 12 Jan 2019 00:56:50 +0530 Subject: [PATCH 06/12] fs-extras-lua library used instead of `fs.lua` --- fs.lua | 109 ----------------------------------------------------- import.scl | 18 ++++----- mod.lua | 2 +- 3 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 fs.lua diff --git a/fs.lua b/fs.lua deleted file mode 100644 index ba777fa..0000000 --- a/fs.lua +++ /dev/null @@ -1,109 +0,0 @@ -function fs.to_dir_name (path) - if path.sub(-1, -1) ~= "/" then - path = path .. "/" - end - return path -end - -function fs.read_file(path) - local file = io.open(path, "r") - - if not file then - return nil - end - - local file_content = file:read("*all") - file:close() - return file_content -end - --- Basically io.lines except it doesn't fails if the file doesn't exist -function fs.read_lines(path, ...) - local file = io.open(path, "r") - - -- Returning an empty function makes the for loop do nothing - if not file then - return function () end - end - - local _f, s, var = file:lines(...) - - -- Returns the parameters as they are but if the first parameter is nil closes the file - -- (lua loops stop after the first result of the iterator function is nil) - local function bridge (var1, ...) - if var1 == nil then - file:close() - end - return var1, ... - end - - -- A wrapper that closes the file when the iterator ends - local function f (s, var) - return bridge(_f(s, var)) - end - - return f, s, var -end - -function fs.get_all_files_in(directory) - - if directory.sub(-1, -1) ~= "/" then - directory = directory .. "/" - end - - local filenames = {} - - for filename in fs.entries(directory) do - if fs.metadata(directory .. filename).type == "file" then - table.insert(filenames, filename) - end - end - - return filenames -end - -function fs.directory_list(directory) - - if directory.sub(-1, -1) ~= "/" then - directory = directory .. "/" - end - - local filenames = {} - - for filename in fs.entries(directory) do - if fs.metadata(directory .. filename).type == "directory" then - table.insert(filenames, filename) - end - end - - return filenames -end - -function fs.copy(src_path, dest_path) - local src_file = assert(io.open(src_path, "r")) - local dest_file = assert(io.open(dest_path, "w+")) - - dest_file:write(src_file:read("*all")) - - src_file:close() - dest_file:close() -end - -function fs.append_to_start(file_path, to_append) - local file = assert(io.open(file_path, "r")) - local file_content = file:read("*all") - file:close() - - file = assert(io.open(file_path, "w")) - file:write(to_append) - file:write("\n") - file:write(file_content) - - file:close() -end - -function fs.exists (path) - return fs.metadata(path) ~= nil -end - -return fs \ No newline at end of file diff --git a/import.scl b/import.scl index 1cfdb1e..5b64bd6 100644 --- a/import.scl +++ b/import.scl @@ -7,24 +7,24 @@ imports = { } torchbear-libs = { - url = "https://github.com/foundpatterns/torchbear-libs", - repo = true, + url = "https://github.com/foundpatterns/torchbear-libs", + repo = true, } torchbear-libs-dev = { - url = "https://github.com/foundpatterns/torchbear-libs-dev", - repo = true, + url = "https://github.com/foundpatterns/torchbear-libs-dev", + repo = true, } luvent = { - url = "https://github.com/ejmr/Luvent", - export = "src" + url = "https://github.com/ejmr/Luvent", + export = "src" } valua = { - url = "https://github.com/sailorproject/valua", - pluck = "valua.lua", + url = "https://github.com/sailorproject/valua", + pluck = "valua.lua", } contentdb-lua = { - url = "https://github.com/foundpatterns/contentdb.lua", + url = "https://github.com/foundpatterns/contentdb.lua", } diff --git a/mod.lua b/mod.lua index f19dd76..0c5786b 100644 --- a/mod.lua +++ b/mod.lua @@ -2,7 +2,7 @@ _G.log = require "third-party.log" _G.inspect = require "third-party.inspect" _G.luvent = require "third-party.Luvent" require "third-party.base64" -_G.fs = require "fs" +_G.fs = require "third-party.fs" require "table_ext" require "string_ext" require "underscore_alias" From 50805d774f3d440bb96e36d0c30ae7a9ab824345 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Wed, 30 Jan 2019 00:56:55 +0530 Subject: [PATCH 07/12] updated dependencies for new version of fs-extras-lua --- .gitignore | 5 ++++- mod.lua | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a18ab58..ad54090 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.peru +/.peru +/.mp +/contentdb +/third-party diff --git a/mod.lua b/mod.lua index 0c5786b..a96a015 100644 --- a/mod.lua +++ b/mod.lua @@ -2,12 +2,21 @@ _G.log = require "third-party.log" _G.inspect = require "third-party.inspect" _G.luvent = require "third-party.Luvent" require "third-party.base64" -_G.fs = require "third-party.fs" require "table_ext" require "string_ext" require "underscore_alias" +require "third-party.append_to_start" +require "third-party.copy" +require "third-party.directory_list" +require "third-party.formatter" +require "third-party.get_all_files" +require "third-party.read_file" +require "third-party.read_lines" +require "third-party.path_separator" _G.contentdb = require "contentdb.mod" _G.keys = require "keys.mod" require "loaders.package" -theme_loader = require "loaders.themes.base" -class_loader = require "loaders.classes" +theme_loader = require "loaders.themes" +class_loader = require "loaders.styles" +require "helpers/render" +require "helpers/send_request" From a00aa5957baacd62f148649946feef75d2a8d388 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Wed, 30 Jan 2019 03:40:11 +0530 Subject: [PATCH 08/12] Migration to lighttouch app --- .gitignore | 1 + Readme.md | 65 +++++++++++++++++++ .../3825ab63-c8c0-4152-b286-71f301408fe6 | 7 ++ .../620eb83e-a8cb-4f97-9fbd-8dffd111e74e | 7 ++ .../94cdb493-9326-4dcc-b99f-9c1a4bb23888 | 7 ++ .../c800a360-d198-4a87-877e-b353f7dd0a9d | 4 ++ .../03ff7d93-6865-4c8b-8a4b-0144bd9ee755 | 6 ++ .../47e423cc-1ba5-4d85-9d68-c1afa169f08f | 6 ++ .../4f28d841-4e63-4ba4-8531-212d0425af48 | 5 ++ .../d3562615-c6c9-4a41-8fb9-f39117ed55cd | 4 ++ home-store.txt | 1 + import.scl | 63 ++++++++++++++---- init.lua | 1 + torchbear.scl | 15 +++++ 14 files changed, 178 insertions(+), 14 deletions(-) create mode 100644 Readme.md create mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 create mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e create mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 create mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d create mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 create mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f create mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 create mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd create mode 100644 home-store.txt create mode 100644 torchbear.scl diff --git a/.gitignore b/.gitignore index ad54090..56fc422 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /.mp /contentdb /third-party +/log diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..0550787 --- /dev/null +++ b/Readme.md @@ -0,0 +1,65 @@ +

lighttouch logo
This Project is Currently in Stealth Mode.
please do not post a news story until v0.1 is released very shortly.
thank you.

+ +

+ Contributions Welcome + Chat +

+ +Lighttouch is a framework that makes complex application development simpler. It does this through broad use of [component-oriented design](https://en.wikipedia.org/wiki/Component-based_software_engineering) intended to offer programmers a well-researched alternative to starting with a blank canvas - "put your code anywhere". + +[Code organized](https://en.wikipedia.org/wiki/Structured_programming) this way is: +- easier to program +- unlimited in its reusability of implementations +- easier to extend with other developers' plugins +- possible to socially cross-pollenate diverse and complex applications +- possible to use as a base for [visual programming environments](https://en.wikipedia.org/wiki/Visual_programming_language) + +Without this, applications tend to: +- get walled into handling only a single use case +- grow, but at huge cost and pain while extending +- repetively [make messy mistakes](https://news.ycombinator.com/item?id=18443327), like [spaghetti code](http://wiki.c2.com/?SpaghettiCode) and [code duplication](http://wiki.c2.com/?DuplicatedCode) +- suffer too many layers of abstraction + +Below you'll learn what is ECA-Rules, but to begin let's start with a simple diagram from the [Drupal Rules module](https://drupal.org/project/rules), a project which greatly influenced this one. + +ECA-Rules diagram + +### Lighttouch Packages + +Packages are Lighttouch's main unit of addon functionality. They leverage [event-driven](https://en.wikipedia.org/wiki/Event-driven_programming), [rule-based](https://en.wikipedia.org/wiki/Rule-based_system) programming. This basically means that packages have actions, events, and rules. Events are like [hooks](https://stackoverflow.com/questions/467557/what-is-meant-by-the-term-hook-in-programming) where additional logic can run. Rules check a conditional statement of any complexity and trigger events. When an event triggers, its actions run in weight order. Actions are the individual mechanisms of additional functionality that have a distilled purpose and can run on any associated event. + +80% of this functionality builds on top of [Luvent: A Simple Event Library for Lua](https://github.com/ejmr/Luvent). You could probably get away with the summary below of Lighttouch's use of its API, but it's still worth checking out. It has a great Readme. The basic difference between what Luvent does and what Lighttouch does is that while writing a Lighttouch app, you put functionality into individual files, and Lighttouch sets everything up for you. + +Events are very simple. They get loaded into a global list by reading each package's `events.txt` file. They can be disabled in a `disabled_events.txt` file. (aside: Potential improvements include a simpler interface and ordering execution by weight.) + +Rules are basically an `IF` statement with some metadata. If the configured conditions, specified in the body of a rule as Lua code are `TRUE`, then the specified events will trigger and the objects specified in the input parameters will get passed to the attached actions. + +Actions are individual, [lazy loaded functions](https://whatis.techtarget.com/definition/lazy-loading-dynamic-function-loading) that can run where they are needed. You simply code what you want to do, and leave the parts about when it will run and in what order to the other logic connected through the yaml header. Actions should not have conditions in them. + +### Core Modules (including third-party) + +Lighttouch also provides modules for content management, robust logging, syntax sugar, and more. These core modules + loaders mentioned for packages + and init script make up [Lighttouch Base](https://github.com/foundpatterns/lighttouch-base), which has: +- Packaged ECA-Rules Loaders: described above +- Content Module: file-based, document-oriented databases (see Grav) with data models in YAML, similar to JSON Schema (content types), and validation +- Logging: automatically setup out of the box (set log level in `config.toml`, default is `INFO`) +- ... + +### Packages + +- Lighttouch Web Logging: (for web automation) log every incoming request, outgoing response, outgoing request, and incoming response (server and client logging out of the box.. makes debugging web applications much easier) to log directory (log entries are content, btw) +- Lighttouch JSON Interface: REST API built on content module +- Lighttouch HTTP Interface: form-driven content entry mechanism, username:password protected (autogenerated at each initialization) +- Lighttouch Crypto Tools: setup a profile with cryptographic signing keys for yourself and friends to verify incoming responses and requests, and sign outgoing requests and responses + and more + +### Installation + +Lightouch has 3 dependencies: +* **[torchbear](https://github.com/foundpatterns/torchbear)** (an [application framework](https://stackoverflow.com/questions/4241919/what-is-meant-by-application-framework)) +* **[git](https://git-scm.com)** (a [version control manager](https://en.wikipedia.org/wiki/Version_control)) +* **[peru](https://github.com/buildinspace/peru)** (a [package manager](https://en.wikipedia.org/wiki/Package_manager)) + +Once these are installed, clone the repo with git, run `peru sync` to install its components, and run it with `torchbear`. To update, use `git pull` and `peru reup`. + +### Developing + +To modify any functionality in Lighttouch, create a git repo outside of it for the component your are modifying, and add an override in `peru.yaml` so that it will use that source directory. For example, to modify `lightouch-base`, clone it somewhere else, then run `peru override add lighttouch-base {{ path to lighttouch-base repo }}`. Then, after making each change to the source, run `peru sync` to update your Lighttouch. diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 b/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 new file mode 100644 index 0000000..9509cb1 --- /dev/null +++ b/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 @@ -0,0 +1,7 @@ +--- +title = "Fast" +model = "slide" +slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" +image-address = "http://unsplash.com/photos/CpkOjOcXdUY/download?force=true" +weight = 1 +... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e b/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e new file mode 100644 index 0000000..daefff7 --- /dev/null +++ b/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e @@ -0,0 +1,7 @@ +--- +title = "Simple" +model = "slide" +slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" +image-address = "http://unsplash.com/photos/x2Tmfd1-SgA/download?force=true" +weight = 2 +... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 b/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 new file mode 100644 index 0000000..bf37fd3 --- /dev/null +++ b/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 @@ -0,0 +1,7 @@ +--- +title = "Powerful" +model = "slide" +slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" +image-address = "http://unsplash.com/photos/pqvp1P7re-w/download?force=true" +weight = 3 +... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d b/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d new file mode 100644 index 0000000..50795af --- /dev/null +++ b/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d @@ -0,0 +1,4 @@ +--- +title = "Found Patterns Introduction" +model = "slideshow" +... diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 new file mode 100644 index 0000000..a5c1594 --- /dev/null +++ b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 @@ -0,0 +1,6 @@ +--- +model = "key" +kind = "sign_private" +profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" +... ++qEY1pRSYy7gTfJ58GLrDQTuhgiTf49Cy9yEgvix3vHGkq2b5t55E36RPtVYgnTn+2SF0Of8nEeVOyTvcvlnnQ== diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f new file mode 100644 index 0000000..aa630d5 --- /dev/null +++ b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f @@ -0,0 +1,6 @@ +--- +model = "key" +kind = "sign_public" +profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" +... +xpKtm+beeRN+kT7VWIJ05/tkhdDn/JxHlTsk73L5Z50= diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 new file mode 100644 index 0000000..87f686d --- /dev/null +++ b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 @@ -0,0 +1,5 @@ +--- +host = "http://foundpatterns.com:3000/" +model = "place" +profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" +... diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd new file mode 100644 index 0000000..47f4a44 --- /dev/null +++ b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd @@ -0,0 +1,4 @@ +--- +model = "profile" +name = "foundpatterns" +... diff --git a/home-store.txt b/home-store.txt new file mode 100644 index 0000000..013db87 --- /dev/null +++ b/home-store.txt @@ -0,0 +1 @@ +0382e080-dd03-46e2-9610-115b72b3af27 \ No newline at end of file diff --git a/import.scl b/import.scl index 5b64bd6..891b1e7 100644 --- a/import.scl +++ b/import.scl @@ -1,30 +1,65 @@ imports = { - luvent = "third-party/", - valua = "third-party/", - torchbear-libs = "third-party/", - contentdb-lua = "contentdb", - torchbear-libs-dev = "third-party/", + lighttouch-logging = "packages/lighttouch-logging", + lighttouch-json-interface = "packages/lighttouch-json-interface", + lighttouch-html-interface = "packages/lighttouch-html-interface", + homepage-package = "packages/homepage-package", + base-theme = "themes/base-theme", + send-file-package = "packages/send-file-package", + lighttouch-change-management = "packages/lighttouch-change-management", + luvent = "third-party/", + valua = "third-party/", + torchbear-libs = "third-party/", + contentdb-lua = "contentdb", + torchbear-libs-dev = "third-party/", } torchbear-libs = { - url = "https://github.com/foundpatterns/torchbear-libs", - repo = true, + url = "https://github.com/foundpatterns/torchbear-libs", + repo = true, } torchbear-libs-dev = { - url = "https://github.com/foundpatterns/torchbear-libs-dev", - repo = true, + url = "https://github.com/foundpatterns/torchbear-libs-dev", + repo = true, } luvent = { - url = "https://github.com/ejmr/Luvent", - export = "src" + url = "https://github.com/ejmr/Luvent", + export = "src" } valua = { - url = "https://github.com/sailorproject/valua", - pluck = "valua.lua", + url = "https://github.com/sailorproject/valua", + pluck = "valua.lua", } contentdb-lua = { - url = "https://github.com/foundpatterns/contentdb.lua", + url = "https://github.com/foundpatterns/contentdb-lua", +} + +lighttouch-logging = { + url = "https://github.com/foundpatterns/lighttouch-logging", +} + +lighttouch-json-interface = { + url = "https://github.com/foundpatterns/lighttouch-json-interface", +} + +lighttouch-html-interface = { + url = "https://github.com/foundpatterns/lighttouch-html-interface", +} + +homepage-package = { + url = "https://github.com/foundpatterns/homepage-package", +} + +base-theme = { + url = "https://github.com/foundpatterns/base-theme", +} + +send-file-package = { + url = "https://github.com/foundpatterns/send-file-package", +} + +lighttouch-change-management = { + url = "https://github.com/foundpatterns/lighttouch-change-management", } diff --git a/init.lua b/init.lua index 293563f..506de9c 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ +#!/usr/bin/env torchbear -- Lighttouch · Torchbear App -- this config must be before requires diff --git a/torchbear.scl b/torchbear.scl new file mode 100644 index 0000000..7fb2eb4 --- /dev/null +++ b/torchbear.scl @@ -0,0 +1,15 @@ +web-server = { + address = "0.0.0.0", + port = "3000", + single_actor = true, +} + +general = { + init = "lighttouch-base/init.lua", + theme = "base-theme", + log_level = "trace", + sitename = "Lighttouch", + slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d", + user = "admin", + password = "admin", +} From 305576d7e359eac09b324855474efffbdeb0b3ee Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Thu, 31 Jan 2019 03:23:07 +0530 Subject: [PATCH 09/12] changed hardcoded values into config used `contentdb` instead of `content` --- .gitignore | 2 ++ base.lua | 14 +++++++------- config.lua | 10 ++++++++++ init.lua | 4 +++- keys/connect_profile.lua | 6 +++--- keys/get_private_key.lua | 2 +- keys/get_profile.lua | 2 +- keys/get_profile_data.lua | 4 ++-- keys/verify_http_signature.lua | 2 +- keys/witness_document.lua | 4 ++-- loaders/actions/custom_require.lua | 4 ++-- loaders/package.lua | 4 ++-- loaders/rules/custom_require.lua | 2 +- mod.lua | 3 +++ 14 files changed, 40 insertions(+), 23 deletions(-) create mode 100644 config.lua mode change 100644 => 100755 init.lua diff --git a/.gitignore b/.gitignore index 56fc422..9e4227d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /contentdb /third-party /log +/packages +/themes diff --git a/base.lua b/base.lua index 60be327..9e66050 100644 --- a/base.lua +++ b/base.lua @@ -2,30 +2,30 @@ log.trace("[loading] libraries") lua_math.randomseed(os.time()) -tera.instance = tera.new(torchbear.settings.templates_path or "templates/**/*") +tera.instance = tera.new(_G.templates) log.level = torchbear.settings.log_level or "info" -fs.create_dir("log") -log.outfile = "log/lighttouch" +fs.create_dir(_G.log_dir) +log.outfile = _G.log_dir.."/lighttouch" -- Get home-store uuid -local home_store = fs.read_file("home-store.txt") +local home_store = fs.read_file(_G.home_store) if not home_store then home_store = uuid.v4() log.info("No home content store found. Creating new one with uuid " .. home_store) - local file = io.open("home-store.txt", "w") + local file = io.open(_G.home_store, "w") if not file then log.error("Could not open home-store.txt") end file:write(home_store) file:close() - fs.create_dir("content/" .. home_store, true) + fs.create_dir(_G.content .. home_store, true) end contentdb.home = home_store if torchbear.settings.theme then - theme_loader.load_themes("themes/", torchbear.settings.theme) + theme_loader.load_themes(_G.themes_dir, _G.main_theme) end local incoming_request_event = events["incoming_request_received"] diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..284d476 --- /dev/null +++ b/config.lua @@ -0,0 +1,10 @@ +-- config +_G.app_path = fs.canonicalize(arg[1]:match(".+/")) .. "/" +_G.db_path = app_path.."/contentdb/" +_G.templates = app_path..(torchbear.settings.templates_path or "templates/**/*") +_G.log_dir = app_path.."log" +_G.content = app_path.."content/" +_G.home_store = app_path.."home-store.txt" +_G.main_theme = torchbear.settings.theme +_G.themes_dir = app_path.."themes/" +-- \ No newline at end of file diff --git a/init.lua b/init.lua old mode 100644 new mode 100755 index 506de9c..fd480df --- a/init.lua +++ b/init.lua @@ -1,10 +1,12 @@ #!/usr/bin/env torchbear -- Lighttouch · Torchbear App +require "config" + -- this config must be before requires local address = torchbear.settings.address or "localhost" local port = torchbear.settings.port or "3000" -package.path = package.path..";lighttouch-base/?.lua;" +package.path = package.path..";" .. _G.app_path.."?.lua;" -- require "mod" diff --git a/keys/connect_profile.lua b/keys/connect_profile.lua index b910c4a..aca2ffd 100644 --- a/keys/connect_profile.lua +++ b/keys/connect_profile.lua @@ -5,7 +5,7 @@ function keys.connect_profile (data) local profile_uuid = data.uuid result.profile = profile_uuid - content.write_file(profile_uuid, profile_uuid, { + contentdb.write_file(profile_uuid, profile_uuid, { type = "profile", name = data.name }) @@ -13,7 +13,7 @@ function keys.connect_profile (data) if data.sign_public_key then local sign_pub_id = uuid.v4() - content.write_file(profile_uuid, uuid.v4(), { + contentdb.write_file(profile_uuid, uuid.v4(), { type = "key", kind = "sign_public", }, data.sign_public_key) @@ -24,7 +24,7 @@ function keys.connect_profile (data) if data.place then local place_id = uuid.v4() - content.write_file(profile_uuid, uuid.v4(), { + contentdb.write_file(profile_uuid, uuid.v4(), { type = "place", host = data.place, }) diff --git a/keys/get_private_key.lua b/keys/get_private_key.lua index 92a5eff..21d053c 100644 --- a/keys/get_private_key.lua +++ b/keys/get_private_key.lua @@ -1,5 +1,5 @@ function keys.get_private_key () - local priv_key = content.walk_documents(content.home, + local priv_key = contentdb.walk_documents(contentdb.home, function (file_uuid, header, body) if header.model == "key" and header.kind == "sign_private" diff --git a/keys/get_profile.lua b/keys/get_profile.lua index c5d7a39..957b0c0 100644 --- a/keys/get_profile.lua +++ b/keys/get_profile.lua @@ -1,5 +1,5 @@ function keys.get_profile (profile) - return content.walk_documents(profile or content.home, + return contentdb.walk_documents(profile or contentdb.home, function (file_uuid, header, body) if header.model == "profile" then return file_uuid, header.name diff --git a/keys/get_profile_data.lua b/keys/get_profile_data.lua index 00ab8f8..b591673 100644 --- a/keys/get_profile_data.lua +++ b/keys/get_profile_data.lua @@ -4,7 +4,7 @@ function keys.get_profile_data () local uuid, name = keys.get_profile() log.debug("UUID: " .. tostring(uuid)) - data.sign_public_key = content.walk_documents(uuid, + data.sign_public_key = contentdb.walk_documents(uuid, function (file_uuid, header, body) if header.model == "key" and header.kind == "sign_private" @@ -12,7 +12,7 @@ function keys.get_profile_data () end ) - data.place = content.walk_documents(uuid, + data.place = contentdb.walk_documents(uuid, function (file_uuid, header, body) if header.model == "place" then return header.host diff --git a/keys/verify_http_signature.lua b/keys/verify_http_signature.lua index 140eb13..72018d9 100644 --- a/keys/verify_http_signature.lua +++ b/keys/verify_http_signature.lua @@ -19,7 +19,7 @@ function keys.verify_http_signature (message) log.debug("keyId " .. keyId) log.debug("signature" .. signature) - local pub_key = content.walk_documents(keyId, + local pub_key = contentdb.walk_documents(keyId, function (file_uuid, header, body) if header.model == "key" and header.kind == "sign_public" then return body diff --git a/keys/witness_document.lua b/keys/witness_document.lua index ed5dba3..8a95454 100644 --- a/keys/witness_document.lua +++ b/keys/witness_document.lua @@ -4,7 +4,7 @@ function keys.witness_document (document_id) local profile_uuid = get_profile() if not profile_uuid then return nil, "Profile not found" end - local fields, body, store = content.read_document(document_id) + local fields, body, store = contentdb.read_document(document_id) if not fields then return nil, "Document not found" end local priv_key = keys.get_private_key() @@ -32,7 +32,7 @@ function keys.witness_document (document_id) signature = signature } - content.write_file("home", witness_id, witness_fields, "") + contentdb.write_file("home", witness_id, witness_fields, "") return witness_id end \ No newline at end of file diff --git a/loaders/actions/custom_require.lua b/loaders/actions/custom_require.lua index a9807d5..2ff4a7a 100644 --- a/loaders/actions/custom_require.lua +++ b/loaders/actions/custom_require.lua @@ -1,8 +1,8 @@ function actions_loader.custom_require(name) if string.match( name, "actions") then package.preload[name] = function(modulename) - local created_file = io.open("module.lua", "w+") - local modulepath = string.gsub(modulename, "%.", "/") + local created_file = io.open("module.lua", "w+") + local modulepath = _G.app_path .. string.gsub(modulename, "%.", "/") local path = "/" local filename = string.gsub(path, "%?", modulepath) local file = io.open(filename, "rb") diff --git a/loaders/package.lua b/loaders/package.lua index 7e2ad09..e6347fb 100644 --- a/loaders/package.lua +++ b/loaders/package.lua @@ -1,7 +1,7 @@ -- Foreach package in packages path, get a list of every component from -- events.txt, disabled_actions.txt, rules/, and actions/ -- then run each loader -_G.packages_path = "packages" -- directory where packages are stored +_G.packages_path = fs.sanitize(_G.app_path.."/packages/") -- directory where packages are stored -- Split packages path to more easily determine current package name local packages_path_modules = _G.packages_path:split( "/" ) -- Count packages so to process the loop in the correct number of iterations? @@ -9,7 +9,7 @@ local packages_path_length = #packages_path_modules -- Add the packages to the Lua search path, so that each package's components -- can be required using its name as if it was a Lua module, eg: -- require "lighttouch-libs.actions.create_key" -package.path = package.path..";./packages/?.lua" +package.path = package.path.. packages_path .. "?.lua" -- Foreach event, get its associated actions and the parameters needed for its actions _G.events = { } -- events table diff --git a/loaders/rules/custom_require.lua b/loaders/rules/custom_require.lua index 3750148..74e91d9 100644 --- a/loaders/rules/custom_require.lua +++ b/loaders/rules/custom_require.lua @@ -2,7 +2,7 @@ function rules_loader.custom_require(name) if string.match( name, "rules") then package.preload[name] = function(modulename) local created_file = io.open("module.lua", "w+") - local modulepath = string.gsub(modulename, "%.", "/") + local modulepath = _G.app_path .. string.gsub(modulename, "%.", "/") local path = "/" local filename = string.gsub(path, "%?", modulepath) local file = io.open(filename, "rb") diff --git a/mod.lua b/mod.lua index ebfa3df..393957c 100644 --- a/mod.lua +++ b/mod.lua @@ -1,3 +1,4 @@ + _G.log = require "third-party.log" -- _G.inspect = require "third-party.inspect" _G.luvent = require "third-party.Luvent" @@ -13,6 +14,8 @@ require "third-party.get_all_files" require "third-party.read_file" require "third-party.read_lines" require "third-party.path_separator" +require "third-party.join" +require "third-party.sanitize" _G.contentdb = require "contentdb.mod" _G.keys = require "keys.mod" require "loaders.package" From 0515b939d21f82e48a6aae6d07a025af1e06653b Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Fri, 1 Feb 2019 01:34:54 +0530 Subject: [PATCH 10/12] minor bug fix if `torchbear init.lua` is run then regex in `config.lua` would return nil --- config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.lua b/config.lua index 284d476..0d1d057 100644 --- a/config.lua +++ b/config.lua @@ -1,5 +1,5 @@ -- config -_G.app_path = fs.canonicalize(arg[1]:match(".+/")) .. "/" +_G.app_path = fs.canonicalize(arg[1]:match(".+/") or ".").. "/" _G.db_path = app_path.."/contentdb/" _G.templates = app_path..(torchbear.settings.templates_path or "templates/**/*") _G.log_dir = app_path.."log" @@ -7,4 +7,4 @@ _G.content = app_path.."content/" _G.home_store = app_path.."home-store.txt" _G.main_theme = torchbear.settings.theme _G.themes_dir = app_path.."themes/" --- \ No newline at end of file +-- From f5e62c503e62c90c8bdd9c648eba87c9b8e38b72 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Wed, 6 Feb 2019 02:43:57 +0530 Subject: [PATCH 11/12] Renamed import.scl to manifest.scl --- import.scl => manifest.scl | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename import.scl => manifest.scl (100%) diff --git a/import.scl b/manifest.scl similarity index 100% rename from import.scl rename to manifest.scl From 214af3e87ae5e40c6a6634d1e09febfb3b30527c Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Wed, 6 Feb 2019 03:24:05 +0530 Subject: [PATCH 12/12] used lighttouch-default-content --- .../3825ab63-c8c0-4152-b286-71f301408fe6 | 7 ------- .../620eb83e-a8cb-4f97-9fbd-8dffd111e74e | 7 ------- .../94cdb493-9326-4dcc-b99f-9c1a4bb23888 | 7 ------- .../c800a360-d198-4a87-877e-b353f7dd0a9d | 4 ---- .../03ff7d93-6865-4c8b-8a4b-0144bd9ee755 | 6 ------ .../47e423cc-1ba5-4d85-9d68-c1afa169f08f | 6 ------ .../4f28d841-4e63-4ba4-8531-212d0425af48 | 5 ----- .../d3562615-c6c9-4a41-8fb9-f39117ed55cd | 4 ---- manifest.scl | 7 ++++++- 9 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 delete mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e delete mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 delete mode 100644 content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d delete mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 delete mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f delete mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 delete mode 100644 content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 b/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 deleted file mode 100644 index 9509cb1..0000000 --- a/content/811332fb-2b80-4e99-950d-3b76f3719e80/3825ab63-c8c0-4152-b286-71f301408fe6 +++ /dev/null @@ -1,7 +0,0 @@ ---- -title = "Fast" -model = "slide" -slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" -image-address = "http://unsplash.com/photos/CpkOjOcXdUY/download?force=true" -weight = 1 -... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e b/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e deleted file mode 100644 index daefff7..0000000 --- a/content/811332fb-2b80-4e99-950d-3b76f3719e80/620eb83e-a8cb-4f97-9fbd-8dffd111e74e +++ /dev/null @@ -1,7 +0,0 @@ ---- -title = "Simple" -model = "slide" -slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" -image-address = "http://unsplash.com/photos/x2Tmfd1-SgA/download?force=true" -weight = 2 -... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 b/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 deleted file mode 100644 index bf37fd3..0000000 --- a/content/811332fb-2b80-4e99-950d-3b76f3719e80/94cdb493-9326-4dcc-b99f-9c1a4bb23888 +++ /dev/null @@ -1,7 +0,0 @@ ---- -title = "Powerful" -model = "slide" -slideshow = "c800a360-d198-4a87-877e-b353f7dd0a9d" -image-address = "http://unsplash.com/photos/pqvp1P7re-w/download?force=true" -weight = 3 -... diff --git a/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d b/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d deleted file mode 100644 index 50795af..0000000 --- a/content/811332fb-2b80-4e99-950d-3b76f3719e80/c800a360-d198-4a87-877e-b353f7dd0a9d +++ /dev/null @@ -1,4 +0,0 @@ ---- -title = "Found Patterns Introduction" -model = "slideshow" -... diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 deleted file mode 100644 index a5c1594..0000000 --- a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/03ff7d93-6865-4c8b-8a4b-0144bd9ee755 +++ /dev/null @@ -1,6 +0,0 @@ ---- -model = "key" -kind = "sign_private" -profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" -... -+qEY1pRSYy7gTfJ58GLrDQTuhgiTf49Cy9yEgvix3vHGkq2b5t55E36RPtVYgnTn+2SF0Of8nEeVOyTvcvlnnQ== diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f deleted file mode 100644 index aa630d5..0000000 --- a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/47e423cc-1ba5-4d85-9d68-c1afa169f08f +++ /dev/null @@ -1,6 +0,0 @@ ---- -model = "key" -kind = "sign_public" -profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" -... -xpKtm+beeRN+kT7VWIJ05/tkhdDn/JxHlTsk73L5Z50= diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 deleted file mode 100644 index 87f686d..0000000 --- a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/4f28d841-4e63-4ba4-8531-212d0425af48 +++ /dev/null @@ -1,5 +0,0 @@ ---- -host = "http://foundpatterns.com:3000/" -model = "place" -profile = "d3562615-c6c9-4a41-8fb9-f39117ed55cd" -... diff --git a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd b/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd deleted file mode 100644 index 47f4a44..0000000 --- a/content/d3562615-c6c9-4a41-8fb9-f39117ed55cd/d3562615-c6c9-4a41-8fb9-f39117ed55cd +++ /dev/null @@ -1,4 +0,0 @@ ---- -model = "profile" -name = "foundpatterns" -... diff --git a/manifest.scl b/manifest.scl index 891b1e7..f1668a2 100644 --- a/manifest.scl +++ b/manifest.scl @@ -9,8 +9,9 @@ imports = { luvent = "third-party/", valua = "third-party/", torchbear-libs = "third-party/", - contentdb-lua = "contentdb", + contentdb-lua = "contentdb/", torchbear-libs-dev = "third-party/", + lighttouch-default-content = "content/", } torchbear-libs = { @@ -63,3 +64,7 @@ send-file-package = { lighttouch-change-management = { url = "https://github.com/foundpatterns/lighttouch-change-management", } + +lighttouch-default-content = { + url = "https://github.com/foundpatterns/lighttouch-default-content", +}