Skip to content

Commit

Permalink
Pkg.scaffold(dir=<dir>): allow scaffolding with any name elsewhere.
Browse files Browse the repository at this point in the history
This allows creation of new package scaffolding using the same code
that won't have any interaction with the existing registered or
installed packages as requested by @johnmyleswhite.
  • Loading branch information
StefanKarpinski committed Aug 20, 2013
1 parent f62ac13 commit 63e1b73
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions base/pkg/scaffold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@ using Base.Git, ..Dir, ..Read

function scaffold(
pkg::String;
license = nothing,
dir::String = "",
license::String = "",
years::Union(Int,String) = readchomp(`date +%Y`),
authors::String = Git.readchomp(`config --global --get user.name`),
)
license === nothing && error("""
No license chosen -- you must choose a license, e.g.:
isempty(license) && error("""
No license chosen -- you must choose a license, e.g.:
julia> Pkg.scaffold("$pkg", license="MIT")
""")
julia> Pkg.scaffold("$pkg", license="MIT")
""")
haskey(LICENSES,license) ||
error("$license is not a known license choice.")
avail = Dir.cd(Read.available)
haskey(avail,pkg) &&
error("$pkg is already a registered package name.")
d = Dir.path(pkg)
d = if isempty(dir)
avail = Dir.cd(Read.available)
haskey(avail,pkg) &&
error("$pkg is already a registered package name.")
Dir.path(pkg)
else
joinpath(dir,pkg)
end
ispath(d) &&
error("$d exists, refusing to overwrite.")
mkpath(d)
Expand Down

0 comments on commit 63e1b73

Please sign in to comment.