Skip to content

HTTPS clone URL

Subversion checkout URL

HTTPS または Subversion を使ってcloneすることができます。

Clone in Desktop Download ZIP

レシピ

cedriclombardot edited this page · 4 revisions

Webistrano のレシピは Capistrano レシピであり、従ってCapistrano Documentationの中で議論されている同じ構造と API に従います。

With that said, here's a few short examples of recipes and some extra documentation links to go with:

設定モジュールの例

名前空間の利用はレシピを体系づけるのによい方法です。各レシピは独自の名前空間であり、あるいはレシピ内にいくつかの名前空間を置くことができます。どちらにしても、名前空間は関連するタスクを体系付けるのに役立ちます。

namespace :wordpress do
 task :upload do
 #recipe guts here
 end

 task :something do
 #recipe guts here
 end
end

Action Module の例

タスクの中で実施されるものは、リモートサーバ上で実行したいと思う実際の"action"あるいはコマンドです。Some actions like "upload" will conduct several predefined commands, behind the scenes, to complete the intended action. "run" のような他のものは、リモートサーバ上で単純に指定されたbash/sshコマンドを実行するでしょう。

upload("files/wallpaper.png", "/var/www/html/wp-content/uploads")
run "#{sudo} apachectl restart"

上のもの全てをレシピに置きます。

以下のレシピは単純にファイルをリモートサーバにアップロードし、apacheのrestartコマンドを実行します。Not that a restart is needed after an upload, this is simply illustrating how to put a recipe together. これを新しいレシピにコピーアンドペーストすることができます。Notice the use of #{sudo} Webistrano config variable.

namespace :wordpress do
 task :upload do
 upload("files/wallpaper.png", "/var/www/html/wp-content/uploads")
 run "#{sudo} apachectl restart"
 end
end

After saving the above as a recipe and assigning that recipe to a stage, you will see the following option in the "All tasks:" Deployments select list (for the assigned stage): wordpress:upload

Something went wrong with that request. Please try again.
TOP
inserted by FC2 system