diff --git a/.gitignore b/.gitignore index bbb65f1..6b0b02b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ blogtool lib shard.lock -testsite/dist \ No newline at end of file +testsite/dist +.deps \ No newline at end of file diff --git a/Makefile b/Makefile index 68d03ff..7e65dd7 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ all: release .PHONY: clean clean: - rm -f blogtool + rm -f blogtool .deps .PHONY: run run: @@ -16,15 +16,15 @@ release: dependencies crystal build --release --no-debug src/blogtool.cr dependencies: - shards install - -debug: + [ -e .deps ] || shards install + touch .deps +debug: dependencies crystal build src/blogtool.cr -test: debug +test: cd testsite && ../blogtool install: install blogtool $(PREFIX)/bin/ mkdir -p /etc/blogtool - install testsite/base.html /etc/blogtool/ \ No newline at end of file + install testsite/base.html /etc/blogtool/ diff --git a/README.md b/README.md index de63e36..d531349 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,4 @@ dist |-> about.html ``` -You can build blogtool by running `make && sudo make install`. Invoke blogtool by running `blogtool` in the project directory. There are no options. You can copy /etc/blogtool/base.html to the project root and make changes to overwrite the template. \ No newline at end of file +You can build blogtool by running `make && sudo make install`. Invoke blogtool by running `blogtool` in the project directory. There are no options. You can copy /etc/blogtool/base.html to the project root and make changes to overwrite the template, as long as the string "## CONTENT\n" is in the template somewhere, as that will be replaced with the article or about page. \ No newline at end of file diff --git a/src/blogtool.cr b/src/blogtool.cr index dce5a06..78416ff 100644 --- a/src/blogtool.cr +++ b/src/blogtool.cr @@ -41,16 +41,18 @@ def render_file(filename : String | Path) end index = Base +content = "" Dir.entries("articles").select{ |i| i != "." && i != ".." }.each do |article| if article[article.size-3, article.size] == ".md" File.write Path.new("dist", article[0,article.size-3]+".html"), render_file("articles/"+article) - index += "