Class: TddDeploy::Installer

Inherits:
Base
  • Object
show all
Includes:
CopyMethods
Defined in:
lib/tdd_deploy/installer.rb

Constant Summary

Constants included from Assertions

Assertions::GROUP_ELT_TAG, Assertions::HEADER_ELT_TAG, Assertions::RESULT_ELT_TAG

Constants included from Environ

Environ::ENV_FNAME

Instance Method Summary collapse

Methods included from CopyMethods

#append_dir_to_remote_hosts_as, #append_file_to_remote_file_as, #append_file_to_remote_hosts_as, #append_string_to_remote_file_as, #append_string_to_remote_file_on_hosts_as, #copy_dir_to_remote_hosts_as, #copy_file_to_remote_as, #copy_file_to_remote_hosts_as, #copy_string_to_remote_file_as, #copy_string_to_remote_file_on_hosts_as, #mkdir_on_remote_as

Methods inherited from Base

#initialize

Methods included from DeployTestMethods

#deploy_test_file_exists_on_hosts_as, #deploy_test_on_a_host_as, #deploy_test_on_hosts_as, #deploy_test_process_running_on_hosts_as

Methods included from RunMethods

#ping_host, #run_locally, #run_on_a_host_as, #run_on_all_hosts, #run_on_all_hosts_as, #run_on_hosts_as

Methods included from Assertions

#assert, #assert_equal, #assert_match, #assert_nil, #assert_not_nil, #assert_raises, #fail, #failure_count, #failure_messages, #formatted_test_results, #pass, #refute, #refute_equal, #refute_nil, #remove_failed_tests, #reset_tests, #test_count, #test_messages, #test_results, #total_failures, #total_tests

Methods included from Environ

#capfile, #clear_env, #env_defaults, #env_desc, #env_hash, #env_hash=, #env_types, #hosts, #hosts=, #list_to_str, #migration_hosts, #rationalize_host_list, #read_env, #reset_env, #save_env, #set_env, #str_to_list

Constructor Details

This class inherits a constructor from TddDeploy::Base

Instance Method Details

#empty_special_dir(userid, host_list_name) ⇒ Object

Raises:

  • (::ArgumentError)


16
17
18
19
20
21
# File 'lib/tdd_deploy/installer.rb', line 16

def empty_special_dir userid, host_list_name
  raise ::ArgumentError.new("install_config_files_on_host_list_as(userid, host_list_name): invalid host_list_name: #{host_list_name}") \
      unless self.respond_to? host_list_name.to_sym
  host_list = rationalize_host_list host_list_name
  run_on_hosts_as(userid, host_list, "rm #{self.site_special_dir}/*")
end

#install_config_files_on_host_list_as(userid, host_list_name) ⇒ Object

Raises:

  • (::ArgumentError)


8
9
10
11
12
13
14
# File 'lib/tdd_deploy/installer.rb', line 8

def install_config_files_on_host_list_as userid, host_list_name
  raise ::ArgumentError.new("install_config_files_on_host_list_as(userid, host_list_name): invalid host_list_name: #{host_list_name}") \
      unless self.respond_to? host_list_name.to_sym
  config_dir = File.join(self.site_doc_root, '..', 'config')
  src_dir = File.join('tdd_deploy_configs', host_list_name.to_s, 'config')
  copy_dir_to_remote_hosts_as userid, rationalize_host_list(host_list_name), src_dir, config_dir
end

#install_special_files_on_host_list_as(userid, host_list_name) ⇒ Object

Raises:

  • (::ArgumentError)


23
24
25
26
27
28
29
30
# File 'lib/tdd_deploy/installer.rb', line 23

def install_special_files_on_host_list_as userid, host_list_name
  raise ::ArgumentError.new("install_config_files_on_host_list_as(userid, host_list_name): invalid host_list_name: #{host_list_name}") \
      unless self.respond_to? host_list_name.to_sym
  
  host_list = rationalize_host_list host_list_name
  src_dir = File.join('tdd_deploy_configs', host_list_name.to_s, 'site')
  append_dir_to_remote_hosts_as userid, host_list, src_dir, self.site_special_dir
end

#run_cap_deployObject



32
33
34
35
36
# File 'lib/tdd_deploy/installer.rb', line 32

def run_cap_deploy
  stdout, stderr, cmd = run_locally { 'cap deploy:update' }
  return false if stderr =~ /failed|rolling back/
  return true
end