#! /usr/bin/env perl # -*- perl -*-
my
$here
= Cwd::abs_path();
my
$updir
= File::Spec->updir;
my
$theme_path
= File::Spec->catdir(
$updir
,
'minimal-theme'
);
my
$project_dir
= File::Spec->catdir(
't'
,
'command-init'
);
mkdir
$project_dir
;
ok -d
$project_dir
;
ok
chdir
$project_dir
;
ok (Qgoda::CLI->new([
'--quiet'
,
'init'
,
$theme_path
])->dispatch);
ok (Qgoda::CLI->new([
'build'
])->dispatch);
ok -e
'_config.yaml'
,
'_config.yaml exists'
;
my
$config_yaml
=
<<EOF;
---
title: Qgoda Test Theme
EOF
is ((read_file
'_config.yaml'
),
$config_yaml
,
'_config.yaml is correct'
);
ok -e
'_views/default.html'
,
'_views/default.html exists'
;
my
$default_html
=
<<EOF;
default view
EOF
is ((read_file
'_views/default.html'
),
$default_html
,
'_default.html is correct'
);
ok -e
'index.md'
,
'index.md exists'
;
my
$index_md
=
<<EOF;
---
title: Test Theme
name: home
location: /index.html
---
EOF
is ((read_file
'index.md'
),
$index_md
,
'index.md is correct'
);
if
(
chdir
$here
) {
ok rmtree
$project_dir
;
}
else
{
ok 0,
"cannot chdir to '$here' :("
;
}
done_testing;