Skip to content

Commit

Permalink
Add a trivial rakefile for starting, stopping, and deploying the server
Browse files Browse the repository at this point in the history
  • Loading branch information
philc committed Jul 13, 2012
1 parent 9f25c26 commit 383117d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
task :start do
puts "starting the app"
app = "immunity_integration_test_app"

desc "deploy"
task :deploy => [:stop, :stage, :start] do
end

task :stop do
puts "stopping the app"
task :stage do
puts "Deploying to /tmp/#{app}"
FileUtils.rm_rf "/tmp/#{app}"
system("rsync -aqE --exclude .git ./ /tmp/#{app}")
end

task :deploy do
puts "deploying the app"
desc "start the server"
task :start do
puts "Starting #{app}."
`nohup ./run_server.sh #{app} 2>/dev/null > /dev/null &`
end

task :test do
puts "running the tests."
end
desc "stop the server"
task :stop do
process_ids = `ps ax | grep #{app} | grep -v grep`.split("\n").map { |line| line.split(" ")[0].to_i }
process_ids.each { |id| `kill -9 #{id} 2> /dev/null` if id > 0 }
end
2 changes: 1 addition & 1 deletion run_server.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bundle exec rackup --port 3105 config.ru
bundle exec rackup --port 3105 config.ru -O immunity_integration_test_app

0 comments on commit 383117d

Please sign in to comment.