JuliaLang / Juleps

Julia Enhancement Proposals
Other
67 stars 24 forks source link

Pkg3: relative paths for adding local packages #31

Open djsegal opened 7 years ago

djsegal commented 7 years ago

So you can do,

Pkg.add("UTF64", "~/code/UTF64.jl")


edit:

i know you can just keep monkeying around with ~/.julia/v0.5/UTF64, it just feels a little dirty

djsegal commented 7 years ago

That second param could probably be a keyword argument under the name "path"

Along with others like:

rofinn commented 7 years ago

Yeah, I do this enough that I've just added the following to my juliarc.

using FilePaths

function Base.Pkg.add(path::AbstractPath)
    extension(path) == "jl" || throw(ArgumentError("Expected pkg directory to end with '.jl'"))
    pkg_name = filename(path)
    pkg_dir = Path(Pkg.dir(pkg_name))

    Pkg.clone(String(path))
    remove(pkg_dir; recursive=true)
    symlink(path, pkg_dir)
end
tkelman commented 7 years ago

You can clone from filesystem-local repositories already, though it does make a copy.