Skip to content

An unofficial example of Julia package generated by PkgTemplates.jl

License

Notifications You must be signed in to change notification settings

terasakisatoshi/MySample.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySample

An unofficial example of Julia package generated by PkgTemplates.jl

Stable Dev Build Status Codecov

How to create ?

Install PkgTemplates.jl

pkg> add PkgTemplates.jl

That is O.K.

Generate package using PkgTemplates.jl

Make julia script to generate package as follow:

#initialize.jl
using PkgTemplates

t = Template(;
        ssh=true,
        plugins=[
              TravisCI(),
              Codecov(),
              GitHubPages(),
            ],
    )

generate(t, "MySample")

If you use git with HTTPS protocol, set argument ssh=false.

  • Run this script:
$ julia initialize.jl

~/.julia/dev/MySample will be generated.

  • Note that, MySample will be added default julia environment which means you can use using MySample without doing pkg>activate ., using .MySample or something like that. Some will says this feature is (in)convenient.

    • If you would like to move MySample to another directory, you shold do pkg> rm MySample in advance.

manage repository on your GitHub

  • Make your GitHub repository named MySample.jl. Do not Initialize this repository with a README. just push Create repository button.

  • Push your repository ~/.julia/MySample

$ cd ~/.julia/dev/MySample
$ git remote -v
origin	git@github.com:<your github account>/MySample.jl.git (fetch)
origin	git@github.com:<your github account>/MySample.jl.git (push)
$ git push -u origin master

How do I create documentation ?

  • If you add GitHubPages() as element of list which assigns optional argument plugins, the folder named docs will be generated at root repository you created. docs/make.jl is julia script to generate documentation of your package using Documenter.jl. If you would like to documentation manually, you can refer this page.

  • Once create your nice documentation, you can build it locally by using following commands:

$ ls
LICENSE       Manifest.toml Project.toml  README.md     REQUIRE       docs          src           test
$ julia --project=docs -e '
          using Pkg;
          Pkg.develop(PackageSpec(path=pwd()));
          Pkg.instantiate();
          include("docs/make.jl");'
$ cd docs/build
$ python3 -m http.server --bind localhost 
  • Open web brouser and go to localhost:8000. You will see your page like this.

How do I deploy my documentation ?

jobs:
  include:
    - stage: Documentation
      julia: 1.1
      script: julia --project=docs -e '
          using Pkg;
          Pkg.develop(PackageSpec(path=pwd()));
          Pkg.instantiate();
          include("docs/make.jl");'
      after_success: skip
  • Go to https://github.com/<your-github-username>/YourPackage.jl/settings and enable github page so that your GitHub Pages site is currently being built from the gh-pages branch.

  • start Travis CI to build your documentation as github page. Build bot of TravisCI will push your documentation to gh-pages automatically like this

Add some script and write tests

That's all. What you have to do is enjoy julia.

See src and tests

About

An unofficial example of Julia package generated by PkgTemplates.jl

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages