Gitbook使ってみる【189日目】(2019/02/06)
https://gyazo.com/6b59734dd9e41196b55571e5b5e9d06e
Porin.icon今日はプライベートの業務の作業記録だよん!
◆作業記録の目次
1. Gitbook使ってみる
https://gyazo.com/ea38e8d40023a4d62a667463b859b1d4
1. Gitbook使ってみる
◆ Gitbook.comを使う
CLIからやるかgitbook.comの方から作るか悩んだ
CLI用のリポジトリを見たら以下のように書いてあったのでWeb版のをGitHub連携して使うことに ⚠️ Deprecation warning:
As the efforts of the GitBook team are focused on the GitBook.com platform, the CLI is no longer under active development.
All content supported by the CLI are mostly supported by our GitBook.com / GitHub integration.
Content hosted on the legacy.gitbook.com will continue working until further notice. For differences with the new vesion, check out our documentation.
GitHub連携についてのドキュメント
◆ セットアップ
▼ 登録
GitHubアカウントで登録
Organizationを作成
space(bookのこと)を作成
URLとかProject名とかを決める
◆ GitHub連携
GitHubの変更もGitBookの変更も相互に同期されるらしい。便利
▼ 連携
spaceのIntegrationsからGitHubを選択
アナリティクスとかSlackもあるらしいな
https://gyazo.com/bbbfdd60e8e380744e2245d78bdf7ef2
あとはリポジトリと同期するブランチを設定して終わり
コミット履歴が微妙になりそうなので、GitHubから更新するようににしよう
https://gyazo.com/07df502e2f9514398624ad183a7ba904
確認
リポジトリ>Settings>WebhooksからGitBookにデータがうまく同期できたかが確認できる
https://gyazo.com/bda5fce03465c6ee397f80d8a60b6303
▼ 設定ファイルを書く
どうやらGitHubを同期するための設定ファイルを作れるらしい
書き方例
root:同期するルートディクトリを指定。./docs/と書くとdocs/ が同期するルートディレクトリとされる
redirects:例えば help: ./support.mdと書くと、/helpにアクセスしたときにsupport.mdにリダイレクトさせられる
code:.gitbook.yml
root: ./
structure:
readme: README.md
summary: SUMMARY.md
redirects:
previous/page: new-folder/page.md
一旦こういう感じで設定
code:.gitbook.yml
root: ./docs/
structure:
readme: README.md
summary: SUMMARY.md
ここで気になる記述が...
With Git, moving a file often results in the file being removed and a new one being created. It makes it impossible for GitBook to know that a folder has been renamed for example. Make sure to double check and eventually add a redirect.
Porin.iconんんんん?ファイル名変更は反映できませんよということ??
怖いからファイル作成はGitBook上でやって、編集はGitHubでやるのがいいのかな...Porin.icon
とりあえず現在のディレクトリ構成はこんな感じに
code:terminal
.
├── README.md
└── docs
├── README.md
├── SUMMARY.md
└── memos.md
Porin.iconリポジトリ名を変更してしまったせいで同期が失敗したりしたけどなんとかできた!
(了)
https://gyazo.com/ea38e8d40023a4d62a667463b859b1d4
感想や指摘などあったらどしどし連絡ください!!
もし万が一、気が向いたりして何かコメントをもらえたら超絶喜びます!!Porin.icon