Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for a build step #178

Merged
merged 2 commits into from
Jul 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -49,16 +50,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 @@ -42,6 +42,9 @@
invoke :'bundle:install'
invoke :'rails:db_migrate'

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