Last modified by Yana Oksner on 2026/01/08 11:36

From version 19.2
edited by Ralf Schuchardt
on 2023/11/13 11:56
Change comment: Update document after refactoring.
To version 20.1
edited by Yana Oksner
on 2026/01/08 11:36
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ralf_schuchardt
1 +XWiki.yanasd
Content
... ... @@ -4,10 +4,10 @@
4 4  
5 5  Here is the official Capistrano installation instruction page: [[https:~~/~~/capistranorb.com/documentation/getting-started/installation/>>url:https://capistranorb.com/documentation/getting-started/installation/||shape="rect"]]. On Leopard all you need to do is to run the following command with root privileges:
6 6  
7 -{{noformat}}
7 +{{code}}
8 8  gem install -y capistrano
9 9  
10 -{{/noformat}}
10 +{{/code}}
11 11  
12 12  On 10.4 you'll have to install ruby and rubygems prior to running this command. The simplest way to do this is to use binary installers.
13 13  
... ... @@ -44,17 +44,17 @@
44 44  
45 45  Ok - this is not much, but at least something. Capistrano recipes are executed using "cap" command. So now you should be able to execute the following:
46 46  
47 -{{noformat}}
47 +{{code}}
48 48  cap -f BugTracker.cap deploy
49 49  
50 -{{/noformat}}
50 +{{/code}}
51 51  
52 52  The output should be:
53 53  
54 -{{noformat}}
54 +{{code}}
55 55   * executing `deploy'
56 56  
57 -{{/noformat}}
57 +{{/code}}
58 58  
59 59  Now let's fill our recipe with some real code. Basically the simplest (not usable in production, but good as example) way of deploying is:
60 60  
... ... @@ -151,10 +151,10 @@
151 151  The new part here is FileUtils.rm_f call. This is the way to delete files in ruby.
152 152   Now we can check that :cleanup task actually works by executing the following command:
153 153  
154 -{{noformat}}
154 +{{code}}
155 155  cap -f BugTracker.cap cleanup
156 156  
157 -{{/noformat}}
157 +{{/code}}
158 158  
159 159  It's great to have a cleanup task, but it would be even better if it would run after the deployment. Capistrano has a "hooks" feature that will help us with that:
160 160  
... ... @@ -169,10 +169,10 @@
169 169  
170 170  You can use variable in capistrano scripts. You can set then with the "set" command:
171 171  
172 -{{noformat}}
172 +{{code}}
173 173  set <variable name>, <variable value> - this commands says for itself. Some examples:
174 174  
175 -{{/noformat}}
175 +{{/code}}
176 176  
177 177  {{code}}
178 178  set "var1", "some data"