Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance CLI documentation to include Homebrew formulae support #299

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions manuals/1.0/en/325.cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ $ brew install --formula ./var/homebrew/greet.rb

Method for wide distribution using a public repository:

Note: The file name of the formula and the class name inside it are based on the name of the repository. For example, if the GH repository is `koriym/greet`, then `var/homebrew/greet.rb` will be generated, which contains the `Greet` class. In this case, `greet` will be the name of the tap that is published, but if you want to change it, please change the class name and file name of fomula script.

```bash
$ brew tap your-vendor/greet
$ brew install your-vendor/greet
Expand Down Expand Up @@ -200,11 +202,11 @@ $ git push origin v0.1.0
```diff
class Greet < Formula
+ desc "Your CLI tool description"
+ homepage "https://github.com/your-vendor/your-project"
+ url "https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz"
+ homepage "https://github.com/your-vendor/greet"
+ url "https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz"
+ sha256 "..." # Add hash value obtained from the command below
+ version "0.1.0"
- head "https://github.com/your-vendor/your-project.git", branch: "main"
head "https://github.com/your-vendor/greet.git", branch: "main"

depends_on "php@8.1"
depends_on "composer"
Expand All @@ -216,7 +218,7 @@ You can add dependencies like databases to the formula as needed. However, it's
3. Get SHA256 hash:
```bash
# Download tarball from GitHub and calculate hash
$ curl -sL https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
$ curl -sL https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
```

4. Create Homebrew tap:
Expand Down Expand Up @@ -257,8 +259,8 @@ $ brew edit your-vendor/greet
```ruby
class Greet < Formula
desc "Your CLI tool description"
homepage "https://github.com/your-vendor/your-project"
url "https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz"
homepage "https://github.com/your-vendor/greet"
url "https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz"
sha256 "..." # tgz SHA256
version "0.1.0"

Expand Down
19 changes: 11 additions & 8 deletions manuals/1.0/ja/325.cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ CLIコマンドの出力は以下の仕様に基づきます:
## 配布方法

BEAR.Cliで作成したコマンドは、Homebrewを通じて配布できます。
フォーミュラの生成にはアプリケーションがGitHubで公開されていることが必要です:
フォーミュラの生成にはアプリケーションがGitHubで公開されていることが必要です。

フォーミュラのファイル名および中のクラス名はリポジトリの名前に基づいています。例えばGHリポジトリが`koriym/greet`の場合、`Greet`クラスを含む`var/homebrew/greet.rb`が生成されます。この時`greet`が公開するタップ名になりますが変更したい場合はフォーミュラのクラス名とファイル名を変更してください。

### 1. ローカルフォーミュラによる配布

Expand All @@ -170,7 +172,7 @@ $ brew install --formula ./var/homebrew/greet.rb

```bash
$ brew tap your-vendor/greet
$ brew install your-vendor/greet
$ brew install greet
```

この方法は特に以下の場合に適しています:
Expand Down Expand Up @@ -200,11 +202,11 @@ $ git push origin v0.1.0
```diff
class Greet < Formula
+ desc "Your CLI tool description"
+ homepage "https://github.com/your-vendor/your-project"
+ url "https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz"
+ homepage "https://github.com/your-vendor/greet"
+ url "https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz"
+ sha256 "..." # 以下のコマンドで取得したハッシュ値を記述
+ version "0.1.0"
- head "https://github.com/your-vendor/your-project.git", branch: "main"
head "https://github.com/your-vendor/greet.git", branch: "main"

depends_on "php@8.1"
depends_on "composer"
Expand All @@ -215,11 +217,12 @@ $ git push origin v0.1.0
3. SHA256ハッシュの取得:
```bash
# GitHubからtarballをダウンロードしてハッシュを計算
$ curl -sL https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
$ curl -sL https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

セキュリティに関する注意事項の追加を推奨します

SHA256ハッシュの検証とGitHub CLIの使用について、セキュリティ上の重要な注意点を追加することを提案します。

 $ curl -sL https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
+
+# セキュリティのベストプラクティス:
+# 1. 必ずHTTPSを使用してダウンロードしてください
+# 2. 計算したハッシュ値を複数の環境で検証することを推奨します
+# 3. GitHub CLIを使用する際は2要素認証を有効にしてください

Also applies to: 225-225

```

4. Homebrewタップの作成:
[GitHub CLI(gh)](https://cli.github.com/)または[github.com/new](https://github.com/new)でリポジトリを作成してください。公開リポジトリ名は`homebrew-`で始める必要があります。たとえば`homebrew-greet`です:

```bash
$ gh auth login
$ gh repo create your-vendor/homebrew-greet --public --clone
Expand Down Expand Up @@ -256,8 +259,8 @@ $ brew edit your-vendor/greet
```ruby
class Greet < Formula
desc "Your CLI tool description"
homepage "https://github.com/your-vendor/your-project"
url "https://github.com/your-vendor/your-project/archive/refs/tags/v0.1.0.tar.gz"
homepage "https://github.com/your-vendor/greet"
url "https://github.com/your-vendor/greet/archive/refs/tags/v0.1.0.tar.gz"
sha256 "..." # tgzのSHA256
version "0.1.0"

Expand Down