Permalink
Browse files

refactor into separate libs

  • Loading branch information...
scmorrison committed Jun 20, 2017
1 parent 932afb3 commit ab696c88540b14a5c78f49d8fde7d0eb89664778
Showing with 681 additions and 644 deletions.
  1. +1 −0 .gitignore
  2. +9 −1 META6.json
  3. +1 −68 bin/uzu
  4. +0 −568 lib/Uzu.pm6
  5. +75 −0 lib/Uzu/CLI.pm6
  6. +118 −0 lib/Uzu/Config.pm6
  7. +126 −0 lib/Uzu/HTTP.pm6
  8. +14 −0 lib/Uzu/LiveReload.pm6
  9. +19 −0 lib/Uzu/Logger.pm6
  10. +168 −0 lib/Uzu/Render.pm6
  11. +27 −0 lib/Uzu/Utilities.pm6
  12. +113 −0 lib/Uzu/Watch.pm6
  13. +2 −2 t/01-serve.t
  14. +8 −5 t/02-build.t
View
@@ -1 +1,2 @@
build
.precomp
View
@@ -6,7 +6,15 @@
"auth" : "gitlab:samcns",
"description" : "Uzu is a static site generator with built-in web server, file modification watcher, live reload, i18n, themes, and multi-page support.",
"provides" : {
"Uzu" : "lib/Uzu.pm6"
"Uzu" : "lib/Uzu.pm6",
"Uzu::Config" : "lib/Uzu/Config.pm6",
"Uzu::CLI" : "lib/Uzu/CLI.pm6",
"Uzu::HTTP" : "lib/Uzu/HTTP.pm6",
"Uzu::LiveReload" : "lib/Uzu/LiveReload.pm6",
"Uzu::Logger" : "lib/Uzu/Logger.pm6",
"Uzu::Render" : "lib/Uzu/Render.pm6",
"Uzu::Utilities" : "lib/Uzu/Utilities.pm6",
"Uzu::Watch" : "lib/Uzu/Watch.pm6"
},
"author" : "Sam Morrison <sam@linux.com>",
"depends" : [
View
69 bin/uzu
@@ -1,74 +1,7 @@
#!/usr/bin/env perl6
use v6;
use Uzu;
multi MAIN('config', Str :$config = 'config.yml') {
say uzu-config(config_file => $config);
}
multi MAIN('webserver', Str :$config = 'config.yml') {
uzu-config(config_file => $config.IO).&Uzu::web-server();
}
multi MAIN('build', Str :$config = 'config.yml') {
uzu-config(
config_file => $config,
no_livereload => True
).&Uzu::build();
}
multi MAIN('watch', Str :$config = 'config.yml', Bool :$no-livereload) {
uzu-config(
config_file => $config.IO,
no_livereload => ($no-livereload ?? True !! False)
).&Uzu::watch();
}
multi MAIN('init', Str :$config = 'config.yml') {
# config file exists, exit
return say "Config [$config] already exists." if $config.IO ~~ :f;
say "Uzu project initialization";
my $project_name = prompt("Please enter project name: ");
my $url = prompt("Please enter project url (e.g http://example.com): ");
my $language = prompt("Please enter project language (e.g. en, ja): ");
my $theme = prompt("Please enter project theme (e.g. default): ")||"default";
if Uzu::init config_file => $config,
project_name => $project_name,
url => $url,
language => $language,
theme => $theme {
say "Config [$config] successfully created.";
}
}
multi MAIN('version') {
say "uzu {Uzu.^ver}";
}
sub USAGE {
say q:to/END/;
Usage:
uzu init - Initialize new project
uzu webserver - Start local web server
uzu build - Render all templates to build
uzu watch - Start web server and re-render
build on template modification
uzu version - Print uzu version and exit
Optional arguments:
--config= - Specify a custom config file
Default is `config`
e.g. uzu --config=path/to/config.yml init
--no-livereload - Disable livereload when
running uzu watch.
END
}
use Uzu::CLI;
# vim: ft=perl6
Oops, something went wrong.

0 comments on commit ab696c8

Please sign in to comment.