Allow tilde in dir keyword

This commit is contained in:
Chris de Graaf 2017-08-25 00:09:49 -05:00
parent 8d9ce7a02b
commit bc36fba22a
2 changed files with 7 additions and 1 deletions

View File

@ -84,6 +84,8 @@ create a template, you can use [`interactive_template`](@ref) instead.
years = string(years)
dir = abspath(expanduser(dir))
requirements_dedup = collect(Set(requirements))
diff = length(requirements) - length(requirements_dedup)
names = [tokens[1] for tokens in split.(requirements_dedup)]
@ -101,7 +103,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
end
new(
user, host, license, authors, years, abspath(dir), julia_version,
user, host, license, authors, years, dir, julia_version,
requirements_dedup, gitconfig, plugin_dict,
)
end

View File

@ -61,6 +61,10 @@ write(test_file, template_text)
t = Template(; user=me, dir=test_file)
@test t.dir == abspath(test_file)
if is_unix() # ~ means temporary file on Windows, not $HOME.
t = Template(; user=me, dir="~/$(basename(test_file))")
@test t.dir == joinpath(homedir(), basename(test_file))
end
t = Template(; user=me, julia_version=v"0.1.2")
@test t.julia_version == v"0.1.2"