class Slh::Cli::GenerateCapistranoDeploy

Public Instance Methods

config_dir() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 12
def config_dir
  'config'
end
config_template_file_path() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 27
def config_template_file_path
  File.join(File.dirname(__FILE__), '..', 'templates','deploy.rb.erb')
end
default_options() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 2
def default_options
 { }
end
generate_config_file_content() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 31
def generate_config_file_content
  ERB.new(File.read(self.config_template_file_path)).result(binding)
end
generate_deploy_dot_rb() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 16
def generate_deploy_dot_rb
  file_path = File.join(self.config_dir, 'deploy.rb')
  if File.exists?(file_path)
    Slh::Cli.instance.output "#{file_path} already exists, MISSION ABORT.", :exit => true
  end
  FileUtils.mkdir_p(self.config_dir)
  File.open(file_path, 'w') do |f|
    f.write(self.generate_config_file_content)
  end
end
perform_action() click to toggle source
# File lib/slh/cli/generate_capistrano_deploy.rb, line 5
def perform_action
  Slh::Cli.instance.output "Generating a config/deploy.rb"
  self.generate_deploy_dot_rb
  Slh::Cli.instance.output "Will MUST change the TODO sections in this file and setup the symlinks correctly on your target servers for you to be able to do\ncap deploy HOST=somehost.com", :highlight => true
end