Class: Luban::Deployment::Application::Controller

Inherits:
Worker show all
Includes:
Service::Controller::Base
Defined in:
lib/luban/deployment/cli/application/controller.rb

Constant Summary

Constants included from Parameters::Application

Parameters::Application::DefaultLogrotateInterval, Parameters::Application::DefaultLogrotateMaxAge

Constants included from Parameters::General

Parameters::General::DefaultLubanRootPath

Constants included from Helpers::Utils

Helpers::Utils::LogLevels

Instance Attribute Summary

Attributes inherited from Worker::Base

#task

Attributes included from Helpers::Utils

#backend

Attributes included from Helpers::Configuration

#config

Instance Method Summary collapse

Methods included from Service::Controller::Base

#check_monitor_status, #check_process, #default_pending_interval, #default_pending_seconds, #kill_process, #monitor_check, #monitor_control_file_path, #monitor_executable, #monitor_off, #monitor_on, #monitor_process, #monitor_reload, #pid, #pid_file_exists?, #pid_file_missing?, #pid_file_orphaned?, #process_started?, #process_stopped?, #reload_monitor_process, #restart_process, #show_process, #start_process, #stop_process, #unmonitor_process

Methods inherited from Worker

#bundle_command, #bundle_executable, #gemfile, #has_gemfile?, #profile_name, #release_path, #release_tag, #releases_path, #ruby_bin_path, #shell_setup

Methods included from Service::Worker::Base

#control_file_name, #control_file_path, #log_file_name, #log_file_path, #log_path, #output_redirection, #pid_file_name, #pid_file_path, #pids_path, #profile_name, #profile_path, #service_entry, #shell_command, #shell_delimiter, #shell_output, #shell_prefix, #shell_setup

Methods included from Worker::Paths::Remote

#app_archives_path, #app_bin_path, #app_path, #app_tmp_path, #archived_logs_path, #archives_path, #current_app_path, #downloads_path, #env_path, #envrc_file, #luban_install_path, #package_bin_path, #package_install_path, #project_path, #releases_path, #shared_path, #tmp_path, #unset_envrc_file

Methods inherited from Worker::Base

#dry_run?, #force?, #initialize, #linux?, #method_missing, #osx?, #packages, #run, #target_full_name, #target_major_version, #target_name, #target_patch_level, #target_version

Methods included from Parameters::Application

#env_name, #logrotate_count, #monitor_itself?, #monitorable?

Methods included from Parameters::Base

#parameter

Methods included from Parameters::Project

#monitor_defined?, #process_monitor_via

Methods included from Parameters::General

included

Methods included from Helpers::Utils

#assure, #assure_dirs, #assure_symlink, #capture, #check_pass?, #chmod, #cp, #directory?, #exists?, #file?, #hardware_name, #host, #hostname, #ln, #match?, #md5_for, #md5_for_dir, #md5_for_file, #md5_matched?, #mkdir, #mv, #now, #os_name, #os_release, #readlink, #render_template, #revision_match?, #rm, #rmdir, #sudo, #symlink?, #touch, #truncate, #upload_by_template, #url_exists?, #user_home

Methods included from Helpers::Configuration

#ask, #fetch, #find_template_file, #load_configuration_file, #primary, #release_roles, #role, #roles, #server, #set, #set_default, #syntax_error?

Constructor Details

This class inherits a constructor from Luban::Deployment::Worker::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Luban::Deployment::Worker::Base

Instance Method Details

#current_configured?Boolean Also known as: current?

Returns:

  • (Boolean)


7
# File 'lib/luban/deployment/cli/application/controller.rb', line 7

def current_configured?; !!task.opts.release[:current]; end

#current_release_tagObject



14
15
16
17
18
19
20
# File 'lib/luban/deployment/cli/application/controller.rb', line 14

def current_release_tag
  if symlink?(current_app_path)
    File.basename(readlink(current_app_path))
  else
    nil
  end
end

#current_symlinked?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/luban/deployment/cli/application/controller.rb', line 10

def current_symlinked?
  release_tag == current_release_tag
end

#deprecated?Boolean

Returns:

  • (Boolean)


23
# File 'lib/luban/deployment/cli/application/controller.rb', line 23

def deprecated?; !!task.opts.release[:deprecated]; end

#get_summaryObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/luban/deployment/cli/application/controller.rb', line 25

def get_summary
  status = if current_symlinked?
             current? ? " *" : "s*"
           else
             current? ? "c*" : (deprecated? ? " d" : "  ")
           end

  if published?
    published = 'published'
    alert = case status
            when "s*"
              "Alert! #{application_name}:#{release_tag} is not the current version but symlinked IMPROPERLY. "
            when "c*"
              "Alert! #{application_name}:#{release_tag} is set as current version but NOT symlinked properly. "
            end
  else
    published = 'NOT published'
    alert = nil
  end
  update_result summary: { name: "#{application_name}:#{release_tag}", published: published,
                           status: status, alert: alert }
end

#published?Boolean

Returns:

  • (Boolean)


22
# File 'lib/luban/deployment/cli/application/controller.rb', line 22

def published?; directory?(release_path); end