なんで?
社内でKintineのアプリ開発をしてますが、毎回、マウスでファイルをDrag & Dropするのは大変です。また、Dropboxに置いて公開リンクを作るという手もありますが、一時的な対応のためにそれを行うのもなんだか面倒だなと感じてました。
使い方
事前に下記のようにJSONで設定ファイルを書いて、app.json
という名前で保存しておきます。
{
"id": 1234,
"name": "アプリ名称",
"description": "説明",
"js":[
"https://example.com/example.min.js",
"js/example.js"
],
"css":[
"css/example.css"
],
"mobile_js":[
"js/mobile-example.js"
]
}
id
はKintoneのアプリIDです。name
とdescription
はデプロイには使いませんが、このファイルがどのアプリのためなのかが分かるように記載します。
デプロイ方法
以下のコマンドでデプロイします。
% kintone_deploy -d domain -u userid -p password
-d
: Kintoneのドメイン名(xxxx.cybozu.com)
-u
: Kintoneアプリ管理者のユーザID
-p
: Kintoneアプリ管理者のパスワード
app.json
を違うファイル名にしたい場合は、下記のように-i
オプションで指定します。
% kintone_deploy -i my-app.json -d domain -u userid -p password
テスト環境へのデプロイに留めたい場合は、-t
オプションを指定します。
% kintone_deploy -d domain -u userid -p password -t
デプロイ先とローカルとの差分を検証する(ver 0.9.1)
一部のファイルだけ手動でアップロードしていたりすると、app.jsonが指し示すローカルファイルとの差分ができてしまうことがあります。そういった時に勢いでデプロイするのは非常に心配ですから、-v
オプションを付けて下さい。差分がある場合には、下記のようにどのファイルでどんなdiffがあるかを表示します。
% kintone_deploy -d domain -u userid -p password -v
[INFO] Vefiry desktop JS list...
[INFO] Desktop JS list is identical.
[INFO] Vefiry mobile JS list...
[INFO] Mobile JS list is identical.
[INFO] Vefiry desktop JS file...
[INFO] Desktop JS file (list.js) is identical.
[INFO] Desktop JS file (lookup.js) is identical.
[INFO] Desktop JS file (const.js) is identical.
[WARN] Desktop JS file (detail.js) is different.
-----
["-", 2961, " parseError(e.responseJSON);"]
["-", 2962, " if(e.responseJSON.error){"]
["-", 2963, " event.error = `必須項目が入力されていません。`"]
["-", 2964, " }else{"]
["-", 2965, " event.error = 'レコードの更新が出来ません。';"]
["-", 2966, " }"]
["+", 2961, " event.error = 'レコードの更新が出来ません。';"]
[INFO] Desktop JS file (auto.js) is identical.
-------------------------------------------------------------------------
[WARN] There are some differences between kintone settings and local file.
-------------------------------------------------------------------------
インストール
ささやかながらGemを作りましたので、下記からGemをダウンロードしてください。
下記のコマンドでGemをインストールできます。
gem install ./path_to_gem/kintone_deploy-0.9.1.gem