Skip to content

Commit cb070e0

Browse files
authored
Improve introductory file created by drwatson (#114)
1 parent 9b783a3 commit cb070e0

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.7.0
2+
* Improve the introductory file created by DrWatson.
3+
14
# 1.6.2
25
* `@tag!` and `@tagsave` now support using `;` as keywords separator (#111)
36

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DrWatson"
22
uuid = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1"
33
repo = "https://github.com/JuliaDynamics/DrWatson.jl.git"
4-
version = "1.6.2"
4+
version = "1.7.0"
55

66

77

src/project_setup.jl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,7 @@ function initialize_project(path, name = basename(path);
234234
cp(joinpath(@__DIR__, "defaults", "gitignore.txt"), joinpath(path, ".gitignore"))
235235
chmod(joinpath(path, ".gitignore"),0o644)
236236

237-
cp(joinpath(@__DIR__, "defaults", "intro.jl"), joinpath(path, "scripts", "intro.jl"))
238-
chmod(joinpath(path, "scripts", "intro.jl"),0o644)
237+
write(joinpath(path, "scripts", "intro.jl"), makeintro(name))
239238

240239
files = vcat(".gitignore", joinpath("scripts", "intro.jl"), joinpath("test", "runtests.jl"))
241240
if readme
@@ -245,7 +244,7 @@ function initialize_project(path, name = basename(path);
245244
pro = read(joinpath(path, "Project.toml"), String)
246245
w = "name = \"$name\"\n"
247246
if !(authors === nothing)
248-
w *= "authors = "*sprint(show, vecstring(authors))*"\n"
247+
w *= "authors = "*sprint(show, vecstring(authors))*"\n"
249248
end
250249
w *= """
251250
[compat]
@@ -263,15 +262,27 @@ vecstring(a::String) = [a]
263262
vecstring(a::Vector{String}) = a
264263
vecstring(c) = [string(a) for a in c]
265264

265+
##########################################################################################
266+
# Introductory file
267+
##########################################################################################
268+
function makeintro(name)
269+
f = """
270+
using DrWatson
271+
@quickactivate $(name)
272+
DrWatson.greet()
273+
"""
274+
end
275+
266276
function greet()
267277
s =
268278
"""
269279
Currently active project is: $(projectname())
270280
271281
Have fun with your new project!
272282
273-
You can help us make improve DrWatson by opening
274-
issues on GitHub or submitting feature requests!
283+
You can help us improve DrWatson by opening
284+
issues on GitHub, submitting feature requests,
285+
or even opening your own Pull Requests!
275286
"""
276287
println(s)
277288
end

test/project_tests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ initialize_project(path, force = true)
1313

1414
@test !DrWatson.is_standard_julia_project()
1515

16-
1716
@test projectname() == path
1817
@test typeof(findproject(@__DIR__)) == String
1918
for p in DrWatson.DEFAULT_PATHS
@@ -54,6 +53,8 @@ end
5453
@test isfile(joinpath(path, "Project.toml"))
5554
z = read(joinpath(path, "Project.toml"), String)
5655
@test occursin("[\"George\", \"Nick\"]", z)
56+
z = read(joinpath(path, "scripts", "intro.jl"), String)
57+
@test occursin("@quickactivate", z)
5758

5859
initialize_project(path, name; force = true, authors = "Sophia", git = false)
5960
@test !isdir(joinpath(path, ".git"))

0 commit comments

Comments
 (0)