Guest User

Untitled

a guest
Oct 29th, 2017
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. require 'capistrano/ext/multistage'
  2. require 'bundler/capistrano'
  3.  
  4. set :application, "ftpmanager"
  5. set :stages, %w(production)
  6. set :default_stage, "production"
  7. set :keep_releases, 2
  8. set :application, "ftpmanager"
  9.  
  10. set :scm, "git"
  11. set :repository, "git@github.com:develon/ftpmanager.git"
  12. set :deploy_via, :remote_cache
  13. set :scm_verbose, true
  14. set :branch, "refactory"
  15.  
  16. set :user, "deploy"
  17. set :use_sudo, false
  18.  
  19. set :deploy_to, "/space/apache/htdocs/#{application}"
  20.  
  21. namespace :deploy do
  22. task :start do ; end
  23. task :stop do ; end
  24. task :restart, :roles => :app, :except => { :no_release => true } do
  25. run "touch #{File.join(current_path,'tmp','restart.txt')}"
  26. end
  27.  
  28. namespace :web do
  29. task :disable, :roles => :web do
  30. on_rollback { rm "#{shared_path}/system/maintenance.html" }
  31. require 'erb'
  32. put ERB.new(File.read("app/views/layouts/maintenance.html.erb")).result(binding), "#{shared_path}/system/maintenance.html", :mode => 0644
  33. end
  34. end
  35. end
  36.  
  37.  
  38.  
  39. namespace :configuration do
  40.  
  41. desc "Create dir in shared path"
  42. task :default_dir do
  43. run "mkdir #{shared_path}/config"
  44. end
  45.  
  46.  
  47. desc "Create default database.yml"
  48. task :default_database_yml do
  49. file = <<-EOF
  50. development:
  51. adapter: mysql2
  52. encoding: utf8
  53. database: #{application}
  54. pool: 12
  55. username: db
  56. password: ******
  57.  
  58. test:
  59. adapter: mysql2
  60. encoding: utf8
  61. database: #{application}
  62. pool: 5
  63. username: db
  64. password: ***
  65.  
  66. production:
  67. adapter: mysql2
  68. encoding: utf8
  69. database: #{application}
  70. pool: 5
  71. username: db
  72. password: ****
  73. EOF
  74. put file, "#{shared_path}/config/database.yml"
  75. end
  76.  
  77. desc "Symlinks the database config files to current path"
  78. task :symlink_config do
  79. ["database.yml","ldap.yml"].each do |link|
  80. run "ln -nfs #{shared_path}/config/#{link} #{release_path}/config/#{link}"
  81. end
  82. end
  83.  
  84. end
  85.  
  86.  
  87. namespace :less do
  88. desc 'Update stylesheets generated by LESS CSS'
  89. task :update do
  90. run "lessc #{latest_release}/public/stylesheets/style.less"
  91. end
  92. end
  93. #after "deploy:update_code"
  94. #after "deploy:symlink", "less:update"
  95. after "deploy:setup", "configuration:default_dir"
  96. after "deploy:setup", "configuration:default_database_yml"
  97. after "deploy:update_code", "configuration:symlink_config"
  98.  
  99.  
  100.  
  101. after "deploy:update", "deploy:cleanup"
Add Comment
Please, Sign In to add comment