|
| 1 | +# config valid only for Capistrano 3.1 |
| 2 | +lock '3.2.1' |
| 3 | + |
| 4 | +set :application, 'api.lonestarphp.com' |
| 5 | +set :repo_url, 'https://github.com/DallasPHP/lonestarphp-api.git' |
| 6 | + |
| 7 | +# Default branch is :master |
| 8 | +# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call |
| 9 | + |
| 10 | +# Default deploy_to directory is /var/www/my_app |
| 11 | +set :deploy_to, '/var/www/api.lonestarphp.com' |
| 12 | + |
| 13 | +# Default value for :scm is :git |
| 14 | +set :scm, :git |
| 15 | + |
| 16 | +# Default value for :format is :pretty |
| 17 | +set :format, :pretty |
| 18 | + |
| 19 | +# Default value for :log_level is :debug |
| 20 | +set :log_level, :debug |
| 21 | + |
| 22 | +# Default value for :pty is false |
| 23 | +set :pty, true |
| 24 | + |
| 25 | +# Default value for :linked_files is [] |
| 26 | +# set :linked_files, %w{} |
| 27 | + |
| 28 | +# Default value for linked_dirs is [] |
| 29 | +set :linked_dirs, %w{vendor} |
| 30 | + |
| 31 | +# Default value for default_env is {} |
| 32 | +# set :default_env, { path: "/opt/ruby/bin:$PATH" } |
| 33 | + |
| 34 | +# Default value for keep_releases is 5 |
| 35 | +set :keep_releases, 5 |
| 36 | + |
| 37 | +namespace :deploy do |
| 38 | + |
| 39 | + desc 'Composer Install' |
| 40 | + task :composer_install do |
| 41 | + on roles(:web) do |
| 42 | + within release_path do |
| 43 | + execute 'composer', 'install', '--no-dev', '--optimize-autoloader' |
| 44 | + end |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + desc 'Migrate Database' |
| 49 | + task :phinx_migrate do |
| 50 | + on roles(:web) do |
| 51 | + within release_path do |
| 52 | + execute './vendor/bin/phinx', 'migrate', '-e production' |
| 53 | + end |
| 54 | + end |
| 55 | + end |
| 56 | + |
| 57 | + after :publishing, :composer_install |
| 58 | + after :publishing, :phinx_migrate |
| 59 | + |
| 60 | +end |
0 commit comments