Merge pull request #41 from invenia/cdg/add-to-global

Add new packages to the current environment
This commit is contained in:
Chris de Graaf 2018-11-12 14:27:04 -06:00 committed by GitHub
commit 56ec32c625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 7 deletions

View File

@ -36,10 +36,10 @@ deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[Mustache]]
deps = ["Pkg", "Tables", "Test"]
git-tree-sha1 = "1cee2f530502aa2357724e7b19af3239b2e7f6b7"
deps = ["Tables", "Test"]
git-tree-sha1 = "536782063c50421b05d1369bbd09fced13624361"
uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
version = "0.5.5"
version = "0.5.7"
[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
@ -73,10 +73,10 @@ uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[Tables]]
deps = ["Pkg", "Requires", "Test"]
git-tree-sha1 = "7b7e95a34c2c2504f1403aa9005399e239f461b9"
deps = ["Requires", "Test"]
git-tree-sha1 = "c7fb447deab835fa70ce6717e78c68b0f466a42c"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "0.1.9"
version = "0.1.11"
[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]

View File

@ -63,6 +63,9 @@ function generate(
LibGit2.commit(repo, "Files generated by PkgTemplates")
@info "Committed $(length(files)) files/directories: $(join(files, ", "))"
# Add the new package to the current environment.
Pkg.develop(PackageSpec(path=pkg_dir))
if length(collect(LibGit2.GitBranchIter(repo))) > 1
@info "Remember to push all created branches to your remote: git push --all"
end
@ -131,7 +134,7 @@ function gen_tests(pkg_dir::AbstractString, t::Template)
gen_file(joinpath(pkg_dir, "Project.toml"), toml)
Pkg.update() # Regenerate Manifest.toml (this cleans up Project.toml too).
finally
proj !== nothing && Pkg.activate(dirname(proj))
proj === nothing ? Pkg.activate() : Pkg.activate(proj)
end
pkg = basename(pkg_dir)

View File

@ -319,6 +319,16 @@ end
idx = LibGit2.GitIndex(repo)
@test findall("Manifest.toml", idx) !== nothing
rm(pkg_dir; recursive=true)
# Check that the created package ends up developed in the current environment.
temp_dir = mktempdir()
Pkg.activate(temp_dir)
t = Template(; user=me)
generate(test_pkg, t; gitconfig=gitconfig)
@test haskey(Pkg.installed(), test_pkg)
rm(pkg_dir; recursive=true)
Pkg.activate()
rm(temp_dir; recursive=true)
end
@testset "Version floor" begin