Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/terasakisatoshi/mysample.jl

An unofficial example of Julia package generated by PkgTemplates.jl
https://github.com/terasakisatoshi/mysample.jl

Last synced: 3 days ago
JSON representation

An unofficial example of Julia package generated by PkgTemplates.jl

Awesome Lists containing this project

README

        

# MySample

An unofficial example of Julia package generated by [PkgTemplates.jl](https://github.com/invenia/PkgTemplates.jl)

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://terasakisatoshi.github.io/MySample.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://terasakisatoshi.github.io/MySample.jl/dev)
[![Build Status](https://travis-ci.org/terasakisatoshi/MySample.jl.svg?branch=master)](https://travis-ci.org/terasakisatoshi/MySample.jl)
[![Codecov](https://codecov.io/gh/terasakisatoshi/MySample.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/terasakisatoshi/MySample.jl)

# 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:

```julia
#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 [email protected]:/MySample.jl.git (fetch)
origin [email protected]:/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](https://juliadocs.github.io/Documenter.jl/stable/). If you would like to documentation manually, you can refer [this page](https://juliadocs.github.io/Documenter.jl/stable/man/guide/).

- 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](https://terasakisatoshi.github.io/MySample.jl/stable).

## How do I deploy my documentation ?

- Prepare GitHub account and Travis
- Read this article: [Hosting Documentation(Documenter.jl)](https://juliadocs.github.io/Documenter.jl/stable/man/hosting/)
- Generate SSH keys by DocumenterTool and copy them GitHub and Travis respectively. See
- [SSH Deploy Keys](https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#SSH-Deploy-Keys-1)
- [Adding the Public Key to GitHub](https://juliadocs.github.io/Documenter.jl/stable/man/hosting/walkthrough/#Adding-the-Public-Key-to-GitHub-1)
- [Adding the Private Key to Travis](https://juliadocs.github.io/Documenter.jl/stable/man/hosting/walkthrough/#Adding-the-Public-Key-to-GitHub-1)
- Make sure `.travis.yml` contains the following code snippets which will be created automatically by PkgTemplates.

```yml
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//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](https://github.com/terasakisatoshi/MySample.jl/tree/gh-pages)

## Add some script and write tests

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

See [src](https://github.com/terasakisatoshi/MySample.jl/tree/master/src) and [tests](https://github.com/terasakisatoshi/MySample.jl/tree/master/test)