diff options
-rw-r--r-- | man/blogc-make.1.ronn | 3 | ||||
-rw-r--r-- | src/blogc-make/ctx.c | 20 | ||||
-rw-r--r-- | src/blogc-make/ctx.h | 1 | ||||
-rw-r--r-- | src/blogc-make/rules.c | 41 | ||||
-rw-r--r-- | src/blogc-make/settings.c | 3 | ||||
-rwxr-xr-x | tests/blogc-make/check_blogc_make.sh.in | 161 | ||||
-rw-r--r-- | tests/blogc-make/check_settings.c | 14 |
7 files changed, 108 insertions, 135 deletions
diff --git a/man/blogc-make.1.ronn b/man/blogc-make.1.ronn index 97ffd1b..6e01974 100644 --- a/man/blogc-make.1.ronn +++ b/man/blogc-make.1.ronn @@ -55,8 +55,7 @@ files to the configured output directory. * `OUTPUT_DIR`: Path to the directory where `blogc-make` should write (or instruct blogc(1) to - write) output files. This is usually configured in `blogcfile`, but being able - to override it with an environment variable is useful for automated builds. + write) output files. Any other environment variables are inherited by blogc(1) and blogc-runserver(1), when called by `blogc-make`. diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c index c7d6ca9..e062474 100644 --- a/src/blogc-make/ctx.c +++ b/src/blogc-make/ctx.c @@ -130,13 +130,6 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0, } free(content); - // fix output_dir, if forced from environment variable - const char *output_dir_env = getenv("OUTPUT_DIR"); - if (output_dir_env != NULL) { - bc_trie_insert(settings->settings, "output_dir", - bc_strdup(output_dir_env)); - } - char *atom_template = bm_atom_deploy(settings, err); if (*err != NULL) { return NULL; @@ -162,12 +155,15 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0, rv->root_dir = realpath(dirname(real_filename), NULL); free(real_filename); - const char *output_dir = bc_trie_lookup(settings->settings, "output_dir"); - if (output_dir[0] == '/') { - rv->output_dir = bc_strdup(output_dir); + const char *output_dir = getenv("OUTPUT_DIR"); + rv->short_output_dir = bc_strdup(output_dir != NULL ? output_dir : "_build"); + + if (rv->short_output_dir[0] == '/') { + rv->output_dir = bc_strdup(rv->short_output_dir); } else { - rv->output_dir = bc_strdup_printf("%s/%s", rv->root_dir, output_dir); + rv->output_dir = bc_strdup_printf("%s/%s", rv->root_dir, + rv->short_output_dir); } // can't return null and set error after this! @@ -272,6 +268,8 @@ bm_ctx_free_internal(bm_ctx_t *ctx) free(ctx->root_dir); ctx->root_dir = NULL; + free(ctx->short_output_dir); + ctx->short_output_dir = NULL; free(ctx->output_dir); ctx->output_dir = NULL; diff --git a/src/blogc-make/ctx.h b/src/blogc-make/ctx.h index 14e913f..962c029 100644 --- a/src/blogc-make/ctx.h +++ b/src/blogc-make/ctx.h @@ -52,6 +52,7 @@ typedef struct { char *root_dir; char *output_dir; + char *short_output_dir; bm_filectx_t *main_template_fctx; bm_filectx_t *atom_template_fctx; diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c index 52afb2d..e9755a2 100644 --- a/src/blogc-make/rules.c +++ b/src/blogc-make/rules.c @@ -32,12 +32,10 @@ index_outputlist(bm_ctx_t *ctx) bc_slist_t *rv = NULL; const char *html_ext = bc_trie_lookup(ctx->settings->settings, "html_ext"); - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *index_prefix = bc_trie_lookup(ctx->settings->settings, "index_prefix"); bool is_index = (index_prefix == NULL) && (html_ext[0] == '/'); - char *f = bc_strdup_printf("%s%s%s%s", output_dir, + char *f = bc_strdup_printf("%s%s%s%s", ctx->short_output_dir, is_index ? "" : "/", is_index ? "" : index_prefix, html_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); @@ -91,12 +89,11 @@ atom_outputlist(bm_ctx_t *ctx) return NULL; bc_slist_t *rv = NULL; - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *atom_prefix = bc_trie_lookup(ctx->settings->settings, "atom_prefix"); const char *atom_ext = bc_trie_lookup(ctx->settings->settings, "atom_ext"); - char *f = bc_strdup_printf("%s/%s%s", output_dir, atom_prefix, atom_ext); + char *f = bc_strdup_printf("%s/%s%s", ctx->short_output_dir, + atom_prefix, atom_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); return rv; @@ -148,14 +145,12 @@ atom_tags_outputlist(bm_ctx_t *ctx) return NULL; bc_slist_t *rv = NULL; - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *atom_prefix = bc_trie_lookup(ctx->settings->settings, "atom_prefix"); const char *atom_ext = bc_trie_lookup(ctx->settings->settings, "atom_ext"); for (size_t i = 0; ctx->settings->tags[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s/%s%s", output_dir, atom_prefix, - ctx->settings->tags[i], atom_ext); + char *f = bc_strdup_printf("%s/%s/%s%s", ctx->short_output_dir, + atom_prefix, ctx->settings->tags[i], atom_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } @@ -218,8 +213,6 @@ pagination_outputlist(bm_ctx_t *ctx) NULL, 10); // FIXME: improve size_t pages = ceilf(((float) num_posts) / posts_per_page); - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *pagination_prefix = bc_trie_lookup(ctx->settings->settings, "pagination_prefix"); const char *html_ext = bc_trie_lookup(ctx->settings->settings, @@ -227,8 +220,8 @@ pagination_outputlist(bm_ctx_t *ctx) bc_slist_t *rv = NULL; for (size_t i = 0; i < pages; i++) { - char *f = bc_strdup_printf("%s/%s/%d%s", output_dir, pagination_prefix, - i + 1, html_ext); + char *f = bc_strdup_printf("%s/%s/%d%s", ctx->short_output_dir, + pagination_prefix, i + 1, html_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } @@ -281,8 +274,6 @@ posts_outputlist(bm_ctx_t *ctx) if (ctx == NULL || ctx->settings->posts == NULL) return NULL; - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *post_prefix = bc_trie_lookup(ctx->settings->settings, "post_prefix"); const char *html_ext = bc_trie_lookup(ctx->settings->settings, @@ -290,8 +281,8 @@ posts_outputlist(bm_ctx_t *ctx) bc_slist_t *rv = NULL; for (size_t i = 0; ctx->settings->posts[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s/%s%s", output_dir, post_prefix, - ctx->settings->posts[i], html_ext); + char *f = bc_strdup_printf("%s/%s/%s%s", ctx->short_output_dir, + post_prefix, ctx->settings->posts[i], html_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } @@ -346,14 +337,12 @@ tags_outputlist(bm_ctx_t *ctx) return NULL; bc_slist_t *rv = NULL; - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *tag_prefix = bc_trie_lookup(ctx->settings->settings, "tag_prefix"); const char *html_ext = bc_trie_lookup(ctx->settings->settings, "html_ext"); for (size_t i = 0; ctx->settings->tags[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s/%s%s", output_dir, tag_prefix, - ctx->settings->tags[i], html_ext); + char *f = bc_strdup_printf("%s/%s/%s%s", ctx->short_output_dir, + tag_prefix, ctx->settings->tags[i], html_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } @@ -411,15 +400,13 @@ pages_outputlist(bm_ctx_t *ctx) if (ctx == NULL || ctx->settings->pages == NULL) return NULL; - const char *output_dir = bc_trie_lookup(ctx->settings->settings, - "output_dir"); const char *html_ext = bc_trie_lookup(ctx->settings->settings, "html_ext"); bc_slist_t *rv = NULL; for (size_t i = 0; ctx->settings->pages[i] != NULL; i++) { bool is_index = (0 == strcmp(ctx->settings->pages[i], "index")) && (html_ext[0] == '/'); - char *f = bc_strdup_printf("%s%s%s%s", output_dir, + char *f = bc_strdup_printf("%s%s%s%s", ctx->short_output_dir, is_index ? "" : "/", is_index ? "" : ctx->settings->pages[i], html_ext); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); @@ -475,9 +462,9 @@ copy_outputlist(bm_ctx_t *ctx) return NULL; bc_slist_t *rv = NULL; - const char *dir = bc_trie_lookup(ctx->settings->settings, "output_dir"); for (size_t i = 0; ctx->settings->copy[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s", dir, ctx->settings->copy[i]); + char *f = bc_strdup_printf("%s/%s", ctx->short_output_dir, + ctx->settings->copy[i]); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } diff --git a/src/blogc-make/settings.c b/src/blogc-make/settings.c index 3552223..c80feaa 100644 --- a/src/blogc-make/settings.c +++ b/src/blogc-make/settings.c @@ -27,9 +27,6 @@ static const struct default_settings_map { {"main_template", "main.tmpl"}, {"source_ext", ".txt"}, - // output - {"output_dir", "_build"}, - // pagination {"pagination_prefix", "page"}, {"posts_per_page", "10"}, diff --git a/tests/blogc-make/check_blogc_make.sh.in b/tests/blogc-make/check_blogc_make.sh.in index 2dccc6c..bf71c65 100755 --- a/tests/blogc-make/check_blogc_make.sh.in +++ b/tests/blogc-make/check_blogc_make.sh.in @@ -467,7 +467,6 @@ content_dir = contents template_dir = temp main_template = main.html source_ext = .blogc -output_dir = _blogc_build pagination_prefix = pagination posts_per_page = 1 atom_posts_per_page = 1 @@ -493,12 +492,12 @@ bar EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" @@ -508,8 +507,8 @@ Listing: Foo - Oct 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" cat > "${TEMP}/expected-page-2.html" <<EOF @@ -517,7 +516,7 @@ Listing: Bar - Sep 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/pagination/2.html" "${TEMP}/expected-page-2.html" +diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" cat > "${TEMP}/expected-atom.xml" <<EOF <?xml version="1.0" encoding="utf-8"?> @@ -549,7 +548,7 @@ cat > "${TEMP}/expected-atom.xml" <<EOF </feed> EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/index.xml" "${TEMP}/expected-atom.xml" +diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" <<EOF @@ -560,7 +559,7 @@ Foo - Oct 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/poost/foo.html" "${TEMP}/expected-post-foo.html" +diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" cat > "${TEMP}/expected-post-bar.html" <<EOF @@ -571,7 +570,7 @@ Bar - Sep 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/poost/bar.html" "${TEMP}/expected-post-bar.html" +diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" rm -rf "${TEMP}/proj/_build" @@ -594,24 +593,24 @@ tag2 EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/2.html" "${TEMP}/expected-page-2.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" cat > "${TEMP}/expected-page-3.html" <<EOF @@ -619,9 +618,9 @@ Listing: Baz - Aug 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/pagination/3.html" "${TEMP}/expected-page-3.html" +diff -uN "${TEMP}/proj/_build/pagination/3.html" "${TEMP}/expected-page-3.html" -diff -uN "${TEMP}/proj/_blogc_build/atoom/index.xml" "${TEMP}/expected-atom.xml" +diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-atom-tag1.xml" <<EOF <?xml version="1.0" encoding="utf-8"?> @@ -653,7 +652,7 @@ cat > "${TEMP}/expected-atom-tag1.xml" <<EOF </feed> EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" cat > "${TEMP}/expected-atom-tag2.xml" <<EOF <?xml version="1.0" encoding="utf-8"?> @@ -685,7 +684,7 @@ cat > "${TEMP}/expected-atom-tag2.xml" <<EOF </feed> EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" cat > "${TEMP}/expected-post-baz.html" <<EOF @@ -696,9 +695,9 @@ Baz - Aug 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/poost/foo.html" "${TEMP}/expected-post-foo.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/bar.html" "${TEMP}/expected-post-bar.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/baz.html" "${TEMP}/expected-post-baz.html" +diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" +diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" +diff -uN "${TEMP}/proj/_build/poost/baz.html" "${TEMP}/expected-post-baz.html" cat > "${TEMP}/expected-tag1.html" <<EOF @@ -706,7 +705,7 @@ Listing: tag1 - Baz - Aug 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/taag/tag1.html" "${TEMP}/expected-tag1.html" +diff -uN "${TEMP}/proj/_build/taag/tag1.html" "${TEMP}/expected-tag1.html" cat > "${TEMP}/expected-tag2.html" <<EOF @@ -714,9 +713,9 @@ Listing: tag2 - Baz - Aug 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/taag/tag2.html" "${TEMP}/expected-tag2.html" +diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html" -rm -rf "${TEMP}/proj/_blogc_build" +rm -rf "${TEMP}/proj/_build" ### default settings with some posts, pages and tags @@ -740,38 +739,38 @@ page2 EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/page1\\.html" "${TEMP}/output.txt" +grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/2.html" "${TEMP}/expected-page-2.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/3.html" "${TEMP}/expected-page-3.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" +diff -uN "${TEMP}/proj/_build/pagination/3.html" "${TEMP}/expected-page-3.html" -diff -uN "${TEMP}/proj/_blogc_build/atoom/index.xml" "${TEMP}/expected-atom.xml" -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" +diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" -diff -uN "${TEMP}/proj/_blogc_build/poost/foo.html" "${TEMP}/expected-post-foo.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/bar.html" "${TEMP}/expected-post-bar.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/baz.html" "${TEMP}/expected-post-baz.html" +diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" +diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" +diff -uN "${TEMP}/proj/_build/poost/baz.html" "${TEMP}/expected-post-baz.html" -diff -uN "${TEMP}/proj/_blogc_build/taag/tag1.html" "${TEMP}/expected-tag1.html" -diff -uN "${TEMP}/proj/_blogc_build/taag/tag2.html" "${TEMP}/expected-tag2.html" +diff -uN "${TEMP}/proj/_build/taag/tag1.html" "${TEMP}/expected-tag1.html" +diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html" cat > "${TEMP}/expected-page1.html" <<EOF @@ -782,7 +781,7 @@ Page 1 EOF -diff -uN "${TEMP}/proj/_blogc_build/page1.html" "${TEMP}/expected-page1.html" +diff -uN "${TEMP}/proj/_build/page1.html" "${TEMP}/expected-page1.html" cat > "${TEMP}/expected-page2.html" <<EOF @@ -793,30 +792,30 @@ Page 2 EOF -diff -uN "${TEMP}/proj/_blogc_build/page2.html" "${TEMP}/expected-page2.html" +diff -uN "${TEMP}/proj/_build/page2.html" "${TEMP}/expected-page2.html" ### clean rule ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" clean 2>&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/page1\\.html" "${TEMP}/output.txt" +grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -[[ ! -d "${TEMP}/proj/_blogc_build" ]] +[[ ! -d "${TEMP}/proj/_build" ]] export OUTPUT_DIR="${TEMP}/___blogc_build" diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c index fab1dd6..4016e15 100644 --- a/tests/blogc-make/check_settings.c +++ b/tests/blogc-make/check_settings.c @@ -39,7 +39,6 @@ test_settings(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -62,7 +61,6 @@ test_settings_env(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -85,7 +83,6 @@ test_settings2(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -129,10 +126,9 @@ test_settings2(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); @@ -174,7 +170,6 @@ test_settings_env2(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -218,10 +213,9 @@ test_settings_env2(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); @@ -263,7 +257,6 @@ test_settings_copy_files(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -307,10 +300,9 @@ test_settings_copy_files(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); |