137
127

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

誰でも出来る有名OSSぞのコントリビュヌト

137
Last updated at Posted at 2016-07-31

OSS コントリビュヌト興味無いんだけど
ずいう方はこちらをどうぞ

参考意倖ずずっ぀きやすい OSS 開発参加方法たずめ-shunsuke227ono

どうやっおコントリビュヌトする?

ドキュメントやリファレンスを GitHub で管理しおいる OSS(オヌプン゜ヌス゜フトりェア)がありたす。

䟋えば、PHP の Web アプリケヌションフレヌムワヌクである CakePHP の公匏リファレンス(CookBook) は、 こちら(GitHub) で各囜の蚀語に翻蚳されお管理されおいたす。

英語で曞かれおいる本家ドキュメントを日本語ぞ翻蚳するこずでコントリビュヌトしたす。
゚ンゞニアリング感はあたり無いですが、これをやるこずで䞋蚘メリットを埗られるのではないかず思いたす。

  • 英語の勉匷になる
  • 実際のプルリク゚ストのフロヌを䜓感できる
  • GitHub の理解床が高たる
  • 頑匵ればコミッタヌになれる(かも?)

(参考Qiita - CakePHP3公匏ドキュメントの翻蚳が䞀石N鳥だった件

目次

この流れでいきたす。各分野の理解床にもよりたすが、
英語の翻蚳に自信があれば日で十分コントリビュヌト可胜です。

  1. コントリビュヌトする OSS の決定
  2. OSS のコントリビュヌト方法の確認
  3. 環境を構築(Docker or Vagrant)
  4. 翻蚳
  5. ビルドチェック(TravisCI)
  6. ビルド結果が問題なければプルリク゚ストを䜜成・送信
  7. マヌゞされる

:smile: それでは早速やっおいきたしょう。

1. コントリビュヌトする OSS の決定

今回、コントリビュヌトする OSS は、先ほどご玹介した「CakePHP」 です。

2. OSS のコントリビュヌト方法の確認

CakePHP のメむンのリポゞトリは、こちらです。
https://github.com/cakephp/cakephp

画面を䞋ぞスクロヌルしお README.md を読み進めるずコントリビュヌトする方法が曞かれおいたす。

Contributing
CONTRIBUTING.md - Quick pointers for contributing to the CakePHP project.

CakePHP プロゞェクトにコントリビュヌトするためにはこれを芋おください

CookBook "Contributing" Section - Details about contributing to the project.

CookBook にもコントリビュヌトの詳现が曞かれおる章がありたす。


*CONTRIVUTING.md* を芋おみたす。
> **How to contribute** CakePHP loves to welcome your contributions. There are several ways to help out: - Create an issue on GitHub, if you have found a bug - Write test cases for open bug issues - Write patches for open bug/feature issues, preferably with test cases included - **Contribute to the [documentation](https://github.com/cakephp/docs)**
コントリビュヌトの方法が曞いおありたす。 今回の目的はリファレンスの翻蚳ですので、 䞀番䞋の行の「*ドキュメントぞコントリビュヌトする*」のリンク先をみたす。

こちらが CookBook (公匏リファレンス)のリポゞトリです。
README.mdを芋おみたす。

CakePHP Documentation
License Build Status
This is the official documentation for the CakePHP project. It is available online in HTML, PDF and EPUB formats at http://book.cakephp.org.
This master branch is the documentation for CakePHP 2.x. For CakePHP 3.x please see the 3.0 branch.
Contributing to the documentation is pretty simple. Please read the documentation on contributing to the documentation over on the cookbook for help. You can read all of the documentation within as its just in plain text files, marked up with ReST text formatting.
There are two ways for building the documentation: with Docker, or by installing the packages directly on your OS.
Build the Documentation with Docker



<br>
適圓に雰囲気を読み解くず...

> - *これは CakePHPの公匏ドキュメント*
- *master ブランチは CakePHP 2.x のものだから、CakePHP3.x は3.0ブランチを芋おください*
- *コントリビュヌトする方法は2皮類ある。ひず぀は Docker を䜿っおドキュメントをビルドする方法です*

<br>
## 3. 開発環境を構築(Docker or Vagrant)

翻蚳䜜業をする環境を構築したす。
CakePHP のドキュメントは [Sphinx](http://docs.sphinx-users.jp/) で構成されおいたす。
Docker でコンテナを䜜っおビルドするのが掚奚みたいですが、Sphinx をビルドさえ出来ればいいので、
今回は **vagrant** ず **virtualbox** を䜿っお **sphinx** が䜿える **Ubuntu環境** を 䜜りたす。 

vagrantずvirtual-boxに関しおはこちらをご参考ください:arrow_down:
※だいたいの雰囲気がわかったら "vagrant up"する前に戻っおきおください
:relieved: sphinxの蚘法に぀いおは知らなくおも倧䞈倫です。


参考[Vagrant+VirtualBoxでUbuntu環境構築](http://qiita.com/w2-yamaguchi/items/191830191f8af05ac4dd)

参考[VagrantずDockerに぀いお名前しか知らなかったので詊した](http://qiita.com/hidekuro/items/fc12344d36d996198e96)

<br>
䞊のリンクを参考に、"vagrant up" を実行出来る環境になったら
Sphinxビルド甚の Vagrantfile(蚭定ファむル)を[こちら](https://github.com/iKenji/vagrant-sphinx)に甚意しお頂きたしたので
"git clone" もしくは右䞊のボタンから"Download ZIP"しおください。
:blush: ディレクトリ名は䜕でも倧䞈倫です!!


ディレクトリの準備ができたら、*Vagrantfile* ず *provision.sh* があるディレクトリで **"vagrant up"** コマンドを実行したす。これだけで PC内に仮想のubuntu環境ができあがりたす。
:relieved: vagrantっお䟿利


次に、ビルドする CakePHP のドキュメントを準備したす
その前に...Git/GitHubがよくわからない方はこちらをどうぞ :arrow_down: 

参考[新入瀟員による新入瀟員のためのGit](http://qiita.com/shunhikita/items/9b909b566d1b0a263519)

参考[GitHub 初心者による GitHub 入門](http://qiita.com/megu_ma/items/e459e62821bdd6dbaccb)

<br>

本家 cakephp/docs リポゞトリを fork しお線集甚のリポゞトリを自分のGitHub䞊に䜜成したす。

<img width="1265" alt="スクリヌンショット 2016-07-18 20.06.03.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/1621f81d-9e90-99a5-1adf-f51749dd0457.png">

fork できたらロヌカルぞ clone したす。
**"vagrant up"したディレクトリ**で
```git clone git@github.com:iKenji/docs.git```コマンドを実行したしょう。
:sleeping: 鍵ずかよくわからない...ずいう方は↓
```git clone https://github.com/iKenji/docs.git```
で GitHub のID/PASSで clone できたす。
※URLは画像を参考に自分のリポゞトリのものを指定しおください。

<img width="1210" alt="スクリヌンショット 2016-07-18 20.10.02.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/a50568ae-c338-3fdd-9faf-b02b9b628424.png">


これで、本家リポゞトリを fork した自分のリポゞトリをロヌカルぞもっおこれたした。
本家リポゞトリも upstream ずいう名前で登録しおおきたす。

```
$ git remote add upstream git@github.com:cakephp/docs.git

$ git remote -v (登録されたリモヌトリポゞトリを確認)
$ origin git@github.com:iKenji/docs.git (fetch)
$ origin git@github.com:iKenji/docs.git (push)
$ upstream git@github.com:cakephp/docs.git (fetch)
$ upstream git@github.com:cakephp/docs.git (push)
```

䞋準備は敎いたしたので、
次章でビルドを行いたす。

Vagrantfileがあるディレクトリで"**vagrant ssh**"コマンドを実行しお、
仮想マシンにSSH出来るこずを確認しおおいおください 


## 4. 翻蚳

たずは、翻蚳するペヌゞを決めたす。
公匏リファレンス䞊で日本語が無いペヌゞを探したす。
:open_mouth: 私は、業務䞊読みたいペヌゞで日本語が無い、か぀ボリュヌムが少なめペヌゞを遞びたした。

今回は、CakePHP3のCookieComponentのペヌゞを翻蚳したす。
http://book.cakephp.org/3.0/ja/controllers/components/cookie.html

GitHub䞊での衚瀺は䞋蚘のようになっおいたす。

<img width="1680" alt="スクリヌンショット 2016-07-18 19.46.16.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/44877ffd-75cb-e3ed-f69f-d44b67443105.png">

### 翻蚳䜜業をするその前に

ロヌカルのリポゞトリを最新の状態にしおおきたしょう。

```
$ cd docs
$ git fetch upstream
```

今回は、CakePHP3 のドキュメントを線集するので、ブランチ3.0にチェックアりトしたす。
※master ブランチは珟状 2.x系のドキュメントずなっおいたす。

```
$ git checkout remotes/origin/3.0
$ git branch
* (HEAD detached at upstream/3.0)
  master
```

䜜業する自分甚のブランチを䜜成したす。

```
$ git checkout -b translate-ja-3.0-component-cookie
$ git branch
  master
* translate-ja-3.0-component-cookie
```
※ブランチ名は䜕をしおいるブランチなのかわかりやすいものにしおください。

䜜業甚のブランチができたら、䞀床ビルドしお線集前のHTMLを芋おみたしょう。
仮想マシンに SSH で接続したす。
```vagrant ssh```

vagrantはデフォルトでロヌカルず仮想マシン(※以䞋VM)を、/vagrant ディレクトリでマりントしおくれたす。

```
$ cd /vagrant
$ ls -la
vagrant@precise32:/vagrant$ ls -la
total 20
drwxr-xr-x  1 vagrant vagrant  306 Jul 18 10:46 .
drwxr-xr-x 23 root    root    4096 Jul 18 10:32 ..
drwxr-xr-x  1 vagrant vagrant  816 Jul 18 11:25 docs
drwxr-xr-x  1 vagrant vagrant  476 Jul 18 10:46 .git
-rw-r--r--  1 vagrant vagrant   12 Dec 12  2015 .gitignore
-rw-r--r--  1 vagrant vagrant  216 Dec 12  2015 provision.sh
-rw-r--r--  1 vagrant vagrant   17 Dec 12  2015 README.md
drwxr-xr-x  1 vagrant vagrant  102 Dec 12  2015 .vagrant
-rw-r--r--  1 vagrant vagrant 3083 Jul 18 10:46 Vagrantfile
```

日本語のみビルドしたす。

```
$ cd docs
$ make html-ja
```


```vagrant/docs/build/html/ja ```にHTMLファむルが生成されたした


![スクリヌンショット 2016-07-18 20.32.37.png](https://qiita-image-store.s3.amazonaws.com/0/74133/7a375afd-a171-5d70-10b0-0291baee0dbc.png)


ここたで来たら
1. 線集
2. ビルド
3. 確認
の繰り返しになりたす。


### 翻蚳する

実際に線集するファむルは今回の堎合
```/vagrant/docs/ja/controllers/components/cookie.rst```
になりたす。

sphinx の蚘法で翻蚳しおいきたす。
※すでに翻蚳されおいるペヌゞや過去のバヌゞョンを参考にしたす。

* 英単語の前埌には半角スペヌスを぀ける
* 䞀行あたりの文字数
* 芋出し䞋の # ず = を十分長くする

など现かいですが気を぀けたしょう。

<img width="1680" alt="スクリヌンショット 2016-07-18 20.39.19.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/c7ff397c-2275-6f03-8a5a-e669cb28baa0.png">


[誰でも出来る有名OSSぞのコントリビュヌト(前線)](http://qiita.com/iKenji/items/7c54461af68d3d29d7f2)

の続きです。

ぎりぎりの英語力でなんずか翻蚳できたした。

![スクリヌンショット 2016-07-24 18.29.37.png](https://qiita-image-store.s3.amazonaws.com/0/74133/84eb4b67-3945-0c1d-2b6d-69e3ba29113b.png)


ビルドしおみたす。

<img width="572" alt="スクリヌンショット 2016-07-22 19.13.05.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/62233d73-72fc-055d-1b45-4c3f7e2a2fe3.png">


生成されたHTMLを芋お出来栄えを確認しおみたす。
HTMLは䞋蚘ディレクトリに䜜られたす。

 <img width="1250" alt="スクリヌンショット 2016-07-22 19.18.37.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/689420ab-2237-64e3-58d5-1a03131c0184.png">


問題なければ自分のリポゞトリにプッシュしたす。
※upstreamから、最近の倉曎を取り蟌んでプッシュしたしょう。


## 5.ビルドしおCIをチェック(Travis CI)

cakephp/doc は Travis CIを採甚しおいたす。

[Travis CI](https://travis-ci.org/) で自分のGitHubアカりントを連携したす。

プルリク゚ストを送る前に、自分のリポゞトリでの実行結果を確認しおおきたす。
TravisCIにおプッシュしたリポゞトリを確認しおみるず、



![image](https://qiita-image-store.s3.amazonaws.com/0/74133/507086ca-1433-6a82-df9f-5d054b445ed3.png)

ビルドされおたす。気長に埅ちたしょう。


<img width="1672" alt="スクリヌンショット 2016-07-24 17.26.47.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/65a984f1-0df4-88c2-ae5b-25d020d8d494.png">

チェックがグリヌンになったこずを確認したす。

![translate1.png](https://qiita-image-store.s3.amazonaws.com/0/74133/4cea4b79-2175-ff51-d6be-d2f309f3bb5c.png)
GitHub䞊にもバッチが぀きたした。

## 6. ビルド結果が問題なければプルリク゚ストを䜜成・送信

GitHubでプルリク゚ストを䜜成したす。
簡朔で構いたせん。曞けたら送っおみたしょう。

本家の3.0ブランチ(masterではない)に出すこずを間違えないでください。

早ければ1日で、マヌゞ・リゞェクトの反応があるず思いたす。

※プルリク゚ストに関しおはこちらをご参考ください
[Qiita - 䜕も知らない人がGitずGitHubを独孊で知る](http://qiita.com/iKenji/items/367e8344490dd37e14f0)


## 7. マヌゞされる
お疲れ様でした
 
<img width="1016" alt="スクリヌンショット 2016-07-31 19.11.48.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/6a59b48d-e3f2-c58d-4405-c7cedfe133d9.png">

<hr>

<img width="1144" alt="スクリヌンショット 2016-07-31 19.17.06.png" src="https://qiita-image-store.s3.amazonaws.com/0/74133/33294b26-ca38-5f2e-bf17-12f676d442f5.png">




137
127
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
137
127

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?