Update logging and examples
This commit is contained in:
parent
0956dc87fb
commit
4974e58af9
28
README.md
28
README.md
@ -23,20 +23,20 @@ The simplest template only requires your GitHub username.
|
||||
```julia
|
||||
julia> using PkgTemplates
|
||||
|
||||
julia> t = Template(; user="myusername")
|
||||
julia> t = Template(; user="myusername");
|
||||
|
||||
julia> generate("MyPkg", t)
|
||||
INFO: Initialized git repo at /tmp/tmpvaHVki/MyPkg
|
||||
INFO: Made initial empty commit
|
||||
INFO: Made empty initial commit
|
||||
INFO: Set remote origin to https://github.com/myusername/MyPkg.jl
|
||||
INFO: Staged 5 files/directories: src/, test/, REQUIRE, .gitignore, README.md
|
||||
INFO: Staged 6 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE
|
||||
INFO: Committed files generated by PkgTemplates
|
||||
INFO: Moving temporary package directory into /home/degraafc/.julia/v0.6/
|
||||
INFO: Moved temporary package directory into /home/degraafc/.julia/v0.6/
|
||||
INFO: Finished
|
||||
|
||||
julia> cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
|
||||
julia> run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
|
||||
.gitignore
|
||||
.travis.yml
|
||||
LICENSE
|
||||
README.md
|
||||
REQUIRE
|
||||
src/MyPkg.jl
|
||||
@ -48,7 +48,7 @@ However, we can also configure a number of keyword arguments to `Template` and
|
||||
```julia
|
||||
julia> t = Template(;
|
||||
user="myusername",
|
||||
license="MIT",
|
||||
license="ISC",
|
||||
authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
|
||||
years="2016-2017",
|
||||
dir=joinpath(homedir(), "code"),
|
||||
@ -57,26 +57,26 @@ julia> t = Template(;
|
||||
gitconfig=Dict("diff.renames" => true),
|
||||
plugins=[
|
||||
TravisCI(),
|
||||
CodeCov(; config_file=nothing),
|
||||
CodeCov(),
|
||||
Coveralls(),
|
||||
AppVeyor(),
|
||||
GitHubPages(),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
julia> generate("MyPkg", t; force=true, ssh=true)
|
||||
INFO: Initialized git repo at /tmp/tmpe0dWY5/MyPkg
|
||||
INFO: Applying git configuration
|
||||
INFO: Made initial empty commit
|
||||
INFO: Applied git configuration
|
||||
INFO: Made empty initial commit
|
||||
INFO: Set remote origin to git@github.com:myusername/MyPkg.jl.git
|
||||
INFO: Created empty gh-pages branch
|
||||
INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, .travis.yml, .appveyor.yml, docs/
|
||||
INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, docs/, .appveyor.yml, .travis.yml
|
||||
INFO: Committed files generated by PkgTemplates
|
||||
INFO: Moving temporary package directory into /home/degraafc/code/
|
||||
INFO: Moved temporary package directory into /home/degraafc/code/
|
||||
INFO: Finished
|
||||
WARNING: Remember to push all created branches to your remote: git push --all
|
||||
|
||||
julia> cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
|
||||
julia> run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
|
||||
.appveyor.yml
|
||||
.gitignore
|
||||
.travis.yml
|
||||
|
@ -22,9 +22,9 @@ The simplest template only requires your GitHub username.
|
||||
|
||||
```@repl
|
||||
using PkgTemplates
|
||||
t = Template(; user="myusername")
|
||||
t = Template(; user="myusername");
|
||||
generate("MyPkg", t)
|
||||
cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
|
||||
run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
|
||||
```
|
||||
|
||||
However, we can also configure a number of keyword arguments to
|
||||
@ -43,14 +43,14 @@ t = Template(;
|
||||
gitconfig=Dict("diff.renames" => true),
|
||||
plugins=[
|
||||
TravisCI(),
|
||||
CodeCov(; config_file=nothing),
|
||||
CodeCov(),
|
||||
Coveralls(),
|
||||
AppVeyor(),
|
||||
GitHubPages(),
|
||||
],
|
||||
)
|
||||
);
|
||||
generate("MyPkg", t; force=true, ssh=true)
|
||||
cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
|
||||
run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
|
||||
```
|
||||
|
||||
If that looks like a lot of work, you can also create templates interactively
|
||||
|
@ -53,14 +53,14 @@ function generate(
|
||||
# Initialize the repo and configure it.
|
||||
repo = LibGit2.init(temp_pkg_dir)
|
||||
info("Initialized git repo at $temp_pkg_dir")
|
||||
!isempty(t.gitconfig) && info("Applying git configuration")
|
||||
LibGit2.with(LibGit2.GitConfig, repo) do cfg
|
||||
for (key, val) in t.gitconfig
|
||||
LibGit2.set!(cfg, key, val)
|
||||
end
|
||||
end
|
||||
LibGit2.commit(repo, "Empty initial commit")
|
||||
info("Made initial empty commit")
|
||||
!isempty(t.gitconfig) && info("Applied git configuration")
|
||||
LibGit2.commit(repo, "Initial commit")
|
||||
info("Made empty initial commit")
|
||||
rmt = if ssh
|
||||
"git@$(t.host):$(t.user)/$pkg_name.jl.git"
|
||||
else
|
||||
@ -94,10 +94,10 @@ function generate(
|
||||
LibGit2.commit(repo, "Files generated by PkgTemplates")
|
||||
info("Committed files generated by PkgTemplates")
|
||||
multiple_branches = length(collect(LibGit2.GitBranchIter(repo))) > 1
|
||||
info("Moving temporary package directory into $(t.dir)/")
|
||||
try
|
||||
mkpath(dirname(pkg_dir))
|
||||
mv(temp_pkg_dir, pkg_dir; remove_destination=force)
|
||||
info("Moved temporary package directory into $(t.dir)/")
|
||||
catch # Likely cause is that t.dir can't be created (is a file, etc.).
|
||||
# We're just going to trust that backup_dir is a valid directory.
|
||||
backup_dir = if isempty(backup_dir)
|
||||
|
Loading…
Reference in New Issue
Block a user