#require "rvm/capistrano"
require 'net/ssh'

set :application, "myapp"

#set :repository,  "set your repository location here"

set :scm, :git
set :repository, 'git@bitbucket.org:mandeepkaur/myapp.git'
set :deploy_to, "/home/mandy/public_html/refinery/myapp"
set :branch, "master"

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`


role :web, "myapp"                          # Your HTTP server, Apache/etc
role :app, "myapp"                          # This may be the same as your `Web` server
#role :db,  "myapp", :primary => true # This is where Rails migrations will run
#role :db,  "your slave db-server here"
set :user, "mandy"
set :use_sudo, false
set :deploy_via, :remote_cache
set :copy_exclude, [".git", "spec"]

#set :db_user, "rails"
#set :db_pass, "password"

# if you want to clean up old releases on each deploy uncomment this:
 after "deploy:restart", "deploy:cleanup"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
 namespace :deploy do
#   task :start do ; end
 #  task :stop do ; end
task :start, :roles => :app, :except => { :no_release => true } do
        run "cd #{current_path} && bundle exec passenger start --socket /tmp/passenger.socket --daemonize --environment production"
      end
      task :stop, :roles => :app, :except => { :no_release => true } do
        run "cd #{current_path} && bundle exec passenger stop --pid-file tmp/pids/passenger.pid"
      end
      task :restart, :roles => :app, :except => { :no_release => true } do
        run "#{try_sudo} touch #{File.join(current_path, 'tmp', 'restart.txt')}"
      end
 end

#after :deploy, "deploy:restart"

default_run_options[:pty] = true
ssh_options[:paranoid] = false
ssh_options[:forward_agent] = true


