Skip to content

Commit

Permalink
Merge pull request #178 from dchancogne/build-step
Browse files Browse the repository at this point in the history
Allow for a build step
  • Loading branch information
d4be4st committed Jul 5, 2015
2 parents de4e3fa + ebc1b0f commit 9c76974
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
20 changes: 17 additions & 3 deletions data/deploy.sh.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%
prepare = commands(:default).map { |s| "(\n\n#{indent 2, s}\n\n)" }.join(" && ")
build = commands(:build).map { |s| "(\n\n#{indent 2, s}\n\n)" }.join(" && ")
launch = commands(:launch).map { |s| "(\n\n#{indent 2, s}\n\n)" }.join(" && ")
clean = commands(:clean).map { |s| "(\n\n#{indent 2, s}\n\n)" }.join(" && ")
%>
Expand Down Expand Up @@ -52,16 +53,29 @@ fi
<%= echo_cmd %[cd "$build_path"] %> &&
(
<%= indent 4, (prepare.empty? ? "true" : prepare) %>
)
) &&
echo "-----> Deploy finished"
) &&

#
# Rename to the real release path, then symlink 'current'
# Build
(
echo "-----> Build finished"
echo "-----> Building"
echo "-----> Moving build to $release_path"
<%= echo_cmd %[mv "$build_path" "$release_path"] %> &&
<%= echo_cmd %[cd "$release_path"] %> &&
(
<%= indent 4, (build.empty? ? "true" : build) %>
) &&
echo "-----> Build finished"

) &&

#
# Launching
# Rename to the real release path, then symlink 'current'
(
echo "-----> Launching"
echo "-----> Updating the <%= current_path %> symlink" &&
<%= echo_cmd %[ln -nfs "$release_path" "#{current_path}"] %>
) &&
Expand Down
4 changes: 4 additions & 0 deletions spec/commands/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
expect(stdout).to include "bundle exec rake db:migrate"
end

it "should include 'to :build' directives" do
stdout.should include "touch build.txt"
end

it "should include 'to :launch' directives" do
expect(stdout).to include "touch tmp/restart.txt"
end
Expand Down
3 changes: 3 additions & 0 deletions test_env/config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
invoke :'rails:db_migrate'
end

to :build do
queue "touch build.txt"
end
to :launch do
invoke :'passenger:restart'
end
Expand Down

0 comments on commit 9c76974

Please sign in to comment.