Skip to content

Commit

Permalink
ソースファイルが変更された時に rake filecopy するための watchr の設定ファイルを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nobuoka committed Jul 3, 2013
1 parent 72be43d commit 77c0d9d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"

gem "rake"
gem "jsonschema"
gem "watchr"
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ GEM
specs:
jsonschema (2.0.2)
rake (10.0.4)
watchr (0.7)

PLATFORMS
ruby

DEPENDENCIES
jsonschema
rake
watchr
31 changes: 29 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,36 @@ chrome-extension://{extension-id}/tests/test.html にアクセスすると実行
リリースのための zip ファイルには src/tests を含める必要はありません。
(`rake package` により ZIP ファイルを作成すると自動的に src/tests 以下は除かれます。)

## Rakefile
## ソースファイルの配置

Rakefile に必要な Ruby gems は bundler で管理しています。
Chrome 拡張と Opera 拡張を同じブランチで管理できるように、ソースファイルの配置は少し複雑になっています。

* src/main ディレクトリ: どの製品向けのパッケージにも含まれる基本的なソースファイル
* src/chrome ディレクトリ: Chrome 用のパッケージに含まれるファイル
* src/opera ディレクトリ: Opera 用のパッケージに含まれるファイル

複数ファイルに分散しているため、このままだと開発用に Chrome や Opera で読み込むことができません。
そこで、これらのソースファイルをコピーして、obj/* ディレクトリ以下に配置するための Rake タスク filecopy が存在します。

```
bundle exec rake filecopy
```

また、ソースファイルの変更時に自動的に filecopy タスクを実行するための watchr 設定ファイルもあります。

```
bundle exec watchr filecopy.watchr
```

## Ruby Gems の管理

`rake``watchr` に必要な Ruby gems は bundler で管理しています。

* [Bundler: The best way to manage a Ruby application's gems](http://gembundler.com/)
* [bundle install 周りのドキュメント](http://gembundler.com/v1.3/man/bundle-install.1.html)

Bundler がインストールされている状態で次のコマンドを実行すると、このプロジェクトで必要な Gem がインストールされます。

```
bundle install
```
5 changes: 5 additions & 0 deletions filecopy.watchr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# src ディレクトリ以下のファイルが更新されたときに自動的に
# rake filecopy
# するための watchr の設定ファイル

watch("^src/(.*)") { |m| system 'rake filecopy' }

0 comments on commit 77c0d9d

Please sign in to comment.