Class: Luban::Deployment::Project

Inherits:
Command
  • Object
show all
Includes:
Command::Tasks::Control, Command::Tasks::Deploy, Command::Tasks::Install, Luban::Deployment::Parameters::Project
Defined in:
lib/luban/deployment/cli/project.rb

Constant Summary

Constants included from Command::Tasks::Control

Command::Tasks::Control::Actions

Constants included from Command::Tasks::Deploy

Command::Tasks::Deploy::Actions

Constants included from Command::Tasks::Install

Command::Tasks::Install::Actions

Constants included from Luban::Deployment::Parameters::General

Luban::Deployment::Parameters::General::DefaultLubanRootPath

Instance Attribute Summary collapse

Attributes included from Helpers::Configuration

#config

Instance Method Summary collapse

Methods included from Command::Tasks::Control

#controllable?, #process_monitor_via

Methods included from Command::Tasks::Deploy

#deployable?

Methods included from Command::Tasks::Install

#installable?

Methods included from Luban::Deployment::Parameters::Base

#parameter

Methods inherited from Command

#base_templates_path, #controllable?, #default_templates, default_worker_class, #deployable?, dispatch_task, #installable?, #run_task, #task, worker_class

Methods included from Luban::Deployment::Parameters::General

included

Methods included from Helpers::Configuration

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

Instance Attribute Details

#appsObject (readonly)

Returns the value of attribute apps.



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

def apps
  @apps
end

Instance Method Details

#display_nameObject



12
# File 'lib/luban/deployment/cli/project.rb', line 12

def display_name; @display_name ||= "#{stage} #{project.camelcase}"; end

#init_application(args:, opts:) ⇒ Object



65
66
67
68
69
# File 'lib/luban/deployment/cli/project.rb', line 65

def init_application(args:, opts:)
  singleton_class.send(:include, Luban::Deployment::Helpers::Generator::Application)
  define_singleton_method(:application) { args[:application] }
  create_application_skeleton
end

#package_users_for(package_name, package_version, exclude: [], servers: []) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/luban/deployment/cli/project.rb', line 14

def package_users_for(package_name, package_version, exclude: [], servers: [])
  apps.values.inject([]) do |package_users, app|
    if !exclude.include?(app.name) and
        app.use_package?(package_name, package_version, servers: servers)
      package_users << app.display_name
    end
    package_users
  end
end

#password_for(user) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/luban/deployment/cli/project.rb', line 24

def password_for(user)
  @passwords_mutex.synchronize do
    if @passwords[user].nil?
      @passwords[user] = ask(prompt: "Password for #{user}", echo: false)
    end
    @passwords[user]
  end
end