Class: GitDeploy::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- GitDeploy::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/git_deploy/generator.rb
Constant Summary collapse
- TEMPLATES =
%w[rails-passenger rails-puma php-composer generic].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #copy_main_hook ⇒ Object
- #copy_restart_callbacks ⇒ Object
- #copy_restart_hook ⇒ Object
- #verify_deploy_target ⇒ Object
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/git_deploy/generator.rb', line 10 def self.source_root File.('../templates', __FILE__) end |
Instance Method Details
#copy_main_hook ⇒ Object
24 25 26 |
# File 'lib/git_deploy/generator.rb', line 24 def copy_main_hook copy_hook 'after_push.sh', 'deploy/after_push' end |
#copy_restart_callbacks ⇒ Object
32 33 34 35 36 |
# File 'lib/git_deploy/generator.rb', line 32 def copy_restart_callbacks source = Dir[File.join(template_dir, 'before_restart.*')].first abort "Error: No before_restart script in template #{[:template].inspect}" unless source copy_hook File.basename(source), 'deploy/before_restart' end |
#copy_restart_hook ⇒ Object
28 29 30 |
# File 'lib/git_deploy/generator.rb', line 28 def copy_restart_hook copy_hook 'restart.sh', 'deploy/restart' end |
#verify_deploy_target ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/git_deploy/generator.rb', line 14 def verify_deploy_target if File.exist?('deploy') && !File.directory?('deploy') abort "Error: './deploy' exists but is a file. Remove or rename it before running init." end if File.directory?('deploy') && !Dir.empty?('deploy') say "Warning: deploy/ already exists and is not empty. Existing files will not be overwritten.", :yellow end end |