commit b3ada85c04eba4330068b660c277fcb8ed436787
parent 3769b7d7d024242a23a194d65d2b35c67b298791
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date: Fri, 3 Aug 2018 17:14:53 -0400
Add the `makesite` method and the `start` option.
Diffstat:
3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/cornelius b/cornelius
@@ -3,10 +3,6 @@
-- Cornelius Ferron is the CLI of Ferron SSG and it's a WIP.
-- <https://en.wikipedia.org/wiki/Cornelius_the_First>
--- Commands :
--- ./cornelius install - Install ferron and his dependencies
--- ./cornelius build [--dev] - Build your site in prod or dev
--- ./cornelius create - Create content from archetypes
local config = require "config"
if arg[1] == "install" and tonumber(_VERSION:match("%d+%.%d+")) >= config.dependencies.lua then
@@ -27,11 +23,14 @@ elseif arg[1] == "build" then
os.execute("lua -l ferron.setpaths ferron.lua")
elseif arg[1] == "create" then
os.execute("lua -l ferron.setpaths ferron.lua --set content")
+elseif arg[1] == "start" then
+ os.execute("lua -l ferron.setpaths ferron.lua --make site")
else
print("Hi, I'm Cornelius Ferron, the eminence of the great horn of the static site generator... or if you prefer, the CLI.")
print("What Can I Do for You?")
print([[Your options are:
- * `install` - Install ferron and his dependencies
+ * `install` - Install Ferron and his dependencies
+ * `start` - Create a new website from the sample
* `build [--dev]` - Build your site in prod or dev
* `create` - Create content from archetypes
diff --git a/ferron.lua b/ferron.lua
@@ -36,7 +36,6 @@ Ferron.build = {
feed.makefeed,
link.makeshorts,
link.makerewritemap,
- --tag.maketagpage,
static.move
}
@@ -44,4 +43,8 @@ if arg[1] == "--set" and arg[2] == "content" then
return content.setcontent(site.setsite())
end
+if arg[1] == "--make" and arg[2] == "site" then
+ return site.makesite()
+end
+
return exec(Ferron.init, Ferron.build)
diff --git a/ferron/site.lua b/ferron/site.lua
@@ -55,4 +55,29 @@ function site.setsite()
return Ferron.site
end
+function site.makesite()
+ local newsite = {
+ domain = nil,
+ name = nil,
+ location = nil,
+ config = nil,
+ sample = config.paths.sites .. "/ferron-ssg.tld",
+ }
+
+ io.write("How do you want names your new website? \n")
+ io.write("Please enter that name below... \n")
+ io.flush()
+
+ newsite.name = io.read()
+ newsite.location = config.paths.sites .. "/" .. newsite.name
+
+ os.execute("cp -Rv " .. newsite.sample .. " " .. newsite.location)
+
+ if path.isdir(newsite.location) then
+ return print("Your new website is ready to be cutomize here '" .. newsite.location .. "'!")
+ end
+
+ return
+end
+
return site