Skip to content

Commit 53bbc14

Browse files
committed
Formats files
1 parent bdfa97a commit 53bbc14

File tree

3 files changed

+47
-50
lines changed

3 files changed

+47
-50
lines changed

lib/bootleg/tasks/build/remote.exs

+19-20
Original file line numberDiff line numberDiff line change
@@ -313,26 +313,25 @@ end
313313

314314
task :clean_for_upgrade do
315315
remote :build do
316-
"ls"
317-
end
318-
|> Enum.map( fn result ->
319-
with {:ok, stdout_list, _code, _host} when stdout_list != [] <- result do
320-
321-
locations =
322-
stdout_list
323-
|> Keyword.get(:stdout)
324-
|> String.split("\n")
325-
|> Enum.drop(-1)
326-
|> Enum.filter(fn el -> el != "_build" end)
327-
|> Enum.join(" ")
328-
329-
if locations != "" do
330-
remote :build do
331-
"rm -rvf #{locations}"
332-
end
333-
end
316+
"ls"
317+
end
318+
|> Enum.map(fn result ->
319+
with {:ok, stdout_list, _code, _host} when stdout_list != [] <- result do
320+
locations =
321+
stdout_list
322+
|> Keyword.get(:stdout)
323+
|> String.split("\n")
324+
|> Enum.drop(-1)
325+
|> Enum.filter(fn el -> el != "_build" end)
326+
|> Enum.join(" ")
327+
328+
if locations != "" do
329+
remote :build do
330+
"rm -rvf #{locations}"
331+
end
334332
end
335-
end)
333+
end
334+
end)
336335
end
337336

338337
task :generate_upgrade_release do
@@ -359,7 +358,7 @@ task :remote_hot_upgrade do
359358
app_name = "#{Config.app()}"
360359

361360
UI.info("Upgrading #{app_name} to version: #{Config.version()}")
362-
361+
363362
remote :app do
364363
"bin/#{app_name} upgrade #{Config.version()}"
365364
end

lib/bootleg/tasks/deploy_upgrade.exs

-2
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,3 @@ task :unpack_release_upgrade do
4848

4949
UI.info("Unpacked release upgrade archive")
5050
end
51-
52-

lib/mix/tasks/upgrade.ex

+28-28
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
2626
the code of a running application without the need to
2727
stopping and restarting it, i.e. mantaining active the
2828
service in production.
29-
29+
3030
This is one of the most interesting capabilities of Erlang/OTP,
3131
but it is a very complex process that *cannot* be fully
3232
automated, i.e. require a good knowledge of the tecnologies
@@ -60,24 +60,24 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
6060
https://hexdocs.pm/distillery/guides/appups.html
6161
6262
### Bootleg hot upgrade task
63-
63+
6464
In the following description we assume that the development
6565
enviroinment is organized in this way (the build and
6666
the production places can be the same machine):
67-
67+
6868
* the development machine - where you edit and
6969
test locally your app source files;
70-
70+
7171
* the build machine - the computer where you will transfer to
7272
and compile the committed source code;
73-
73+
7474
* the production server - the server where you will deploy
7575
(transfer to and run) the code previously compiled on
7676
the build machine.
77-
77+
7878
Bootleg helps you in the hot upgrade process providing
7979
some specific tasks:
80-
80+
8181
* mix bootleg.build_upgrade
8282
will tranfer the last committed source code of your application
8383
from the development machine to the build directory of
@@ -89,76 +89,76 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
8989
you have to deploy your _first version_ of your app using
9090
`bootleg.build`, `bootleg.deploy` and `bootleg.start`
9191
(or `bootleg.update`);
92-
92+
9393
* mix bootleg.deploy_upgrade
9494
will transfer the tarball of the compiled app from the
9595
build machine to the production directory of the production
9696
machine, e.g. `~/production/myapp/`
97-
97+
9898
then will extract and setting up the needed files;
99-
99+
100100
* mix bootleg.hot_upgrade
101101
will call `mix distillery <myapp> upgrade <version>` that
102102
will upgrade the running app to the last version. Notice that
103103
you *cannot* use this task if the app is not running, or
104104
if it there is a mismatch in the version numbers of the
105105
deployed versions.
106-
106+
107107
* mix bootleg.upgrade
108108
Call in sequences the above tasks in just one command.
109-
109+
110110
### A step-by-step example
111-
111+
112112
Given you have configured the first version of your app with all
113113
the needed and appropriately customized Bootleg configuration files,
114114
you can go through the following steps to release and run the
115115
first version and subsequentely hot upgrade it to the newest
116116
versions:
117-
117+
118118
First version of your app:
119-
119+
120120
# Step 1 - deploy the first version of your app
121121
edit the version number of your in the mix.exs file
122122
(or in the file if you use an external reference),
123123
to the first version, e.g. 0.1.0;
124-
124+
125125
# Step 2 - Commit
126126
commit the changes you've made in step 1;
127-
127+
128128
# Step 3 - Build the first version
129129
use `mix bootleg.build` (not bootleg.build_upgrade!) to build
130130
your first version;
131-
131+
132132
# Step 4 - Deploy the first version
133133
use `mix bootleg.deploy` (not bootleg.build_upgrade!) to deploy
134134
your first version;
135-
135+
136136
# Step 5 - Run the first version
137137
use `mix bootleg.start` to run the app
138-
138+
139139
now your first version is up and running. To upgrade it
140140
to the future version, you have to follow these steps instead.
141-
141+
142142
Following versions:
143-
143+
144144
# Step 1 - update the version number
145145
e.g. 0.2.0
146-
146+
147147
# Step 2 - Commit
148-
148+
149149
# Step 3 - Build the new version
150150
use `mix bootleg.build_upgrade`
151-
151+
152152
# Step 4 - Deploy the new version
153153
use `mix bootleg.deploy_upgrade`
154-
154+
155155
# Step 5 - Hot upgrade the new version
156156
use `mix bootleg.hot_upgrade`
157-
157+
158158
(or you can execute just the `bootleg.upgrade`
159159
that packs the previous tasks together if you don't need to
160160
manually adjust the created `appup` file)
161-
161+
162162
Now you have an upgraded version running. But if you stop
163163
and restart it, the previous version will be launched instead
164164
of the most recent. This is useful because if your new version

0 commit comments

Comments
 (0)