diff --git a/Project.toml b/Project.toml index 7c7f655297..cc69af1715 100644 --- a/Project.toml +++ b/Project.toml @@ -25,6 +25,7 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" RegistryInstances = "2792f1a3-b283-48e8-9a74-f99dce5104f3" RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00" +Scratch = "6c6a2e73-6563-6170-7368-637461726353" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" diff --git a/src/Pluto.jl b/src/Pluto.jl index 2cb0eee2ad..8898d058f2 100644 --- a/src/Pluto.jl +++ b/src/Pluto.jl @@ -33,6 +33,7 @@ function project_relative_path(root, xs...) end import Pkg +import Scratch include_dependency("../Project.toml") const PLUTO_VERSION = VersionNumber(Pkg.TOML.parsefile(joinpath(ROOT_DIR, "Project.toml"))["version"]) @@ -99,16 +100,31 @@ export activate_notebook_environment include("./precompile.jl") -if get(ENV, "JULIA_PLUTO_SHOW_BANNER", "1") != "0" && get(ENV, "CI", "🍄") != "true" -@info """\n - Welcome to Pluto $(PLUTO_VERSION_STR) 🎈 - Start a notebook server using: - - julia> Pluto.run() - - Have a look at the FAQ: - https://github.com/fonsp/Pluto.jl/wiki -\n""" +function __init__() + # Print a welcome banner + if (get(ENV, "JULIA_PLUTO_SHOW_BANNER", "1") != "0" && + get(ENV, "CI", "🍄") != "true" && isinteractive()) + # Print the banner only once per version, if there isn't + # yet a file for this version in banner_shown scratch space. + # (Using the Pluto version as the filename enables later + # version-specific "what's new" messages.) + fn = joinpath(Scratch.@get_scratch!("banner_shown"), PLUTO_VERSION_STR) + if !isfile(fn) + @info """ + + Welcome to Pluto $(PLUTO_VERSION_STR) 🎈 + Start a notebook server using: + + julia> Pluto.run() + + Have a look at the FAQ: + https://github.com/fonsp/Pluto.jl/wiki + + """ + # create empty file to indicate that we've shown the banner + write(fn, ""); + end + end end end