module Luban::Deployment::Parameters::General
Constants
- DefaultLubanRootPath
Public Class Methods
included(mod)
click to toggle source
# File lib/luban/deployment/parameters.rb, line 27 def self.included(mod) mod.extend(Base) end
Public Instance Methods
current_uid()
click to toggle source
# File lib/luban/deployment/parameters.rb, line 35 def current_uid Etc.getpwnam(current_user).uid end
current_user()
click to toggle source
# File lib/luban/deployment/parameters.rb, line 31 def current_user ENV['USER'] || `whoami 2>/dev/null`.chomp end
Protected Instance Methods
validate_for_luban_root_path()
click to toggle source
# File lib/luban/deployment/parameters.rb, line 73 def validate_for_luban_root_path if luban_root_path.is_a?(String) luban_root_path Pathname.new(luban_root_path) end unless luban_root_path.is_a?(Pathname) abort "Aborted! Luban root path should be a String or a Pathname: luban_root_path Pathname.new('#{DefaultLubanRootPath}')" end end
validate_for_project()
click to toggle source
# File lib/luban/deployment/parameters.rb, line 67 def validate_for_project if project.nil? abort "Aborted! Please specify the project name: project 'project name'" end end
validate_for_user()
click to toggle source
# File lib/luban/deployment/parameters.rb, line 57 def validate_for_user if user.nil? abort "Abort! Please specify the user name: user 'user name'" end if user != current_user abort "Aborted! Given deployment user (#{user.inspect}) is NOT the current user #{ENV['USER'].inspect}" + "Please switch to the deployment user before any deployments." end end