Class: ForemanTemplates::Action
- Inherits:
-
Object
- Object
- ForemanTemplates::Action
show all
- Defined in:
- app/services/foreman_templates/action.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args = {}) ⇒ Action
Returns a new instance of Action.
33
34
35
36
37
|
# File 'app/services/foreman_templates/action.rb', line 33
def initialize(args = {})
@taxonomies = { :organizations => args[:organization_params] || {},
:locations => args[:location_params] || {} }
assign_attributes args
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
21
22
23
24
25
26
27
|
# File 'app/services/foreman_templates/action.rb', line 21
def method_missing(method, *args, &block)
if self.class.setting_overrides.include?(method)
instance_variable_get("@#{method}")
else
super
end
end
|
Class Method Details
.file_repo_start_with ⇒ Object
9
10
11
|
# File 'app/services/foreman_templates/action.rb', line 9
def self.file_repo_start_with
['/']
end
|
.git_repo_start_with ⇒ Object
5
6
7
|
# File 'app/services/foreman_templates/action.rb', line 5
def self.git_repo_start_with
%w{http:// https:// git:// ssh:// git+ssh:// ssh+git://}
end
|
.repo_start_with ⇒ Object
13
14
15
|
# File 'app/services/foreman_templates/action.rb', line 13
def self.repo_start_with
git_repo_start_with + file_repo_start_with
end
|
.setting_overrides ⇒ Object
17
18
19
|
# File 'app/services/foreman_templates/action.rb', line 17
def self.setting_overrides
%i(verbose prefix dirname filter repo negate branch)
end
|
Instance Method Details
#get_absolute_repo_path ⇒ Object
43
44
45
|
# File 'app/services/foreman_templates/action.rb', line 43
def get_absolute_repo_path
File.expand_path(@repo)
end
|
#git_repo? ⇒ Boolean
39
40
41
|
# File 'app/services/foreman_templates/action.rb', line 39
def git_repo?
@repo.start_with?(*self.class.git_repo_start_with)
end
|
#respond_to_missing?(method, include_private = false) ⇒ Boolean
29
30
31
|
# File 'app/services/foreman_templates/action.rb', line 29
def respond_to_missing?(method, include_private = false)
self.class.setting_overrides.include?(method)
end
|
#verify_path!(path) ⇒ Object
47
48
49
50
51
|
# File 'app/services/foreman_templates/action.rb', line 47
def verify_path!(path)
msg = _("Using file-based synchronization, but couldn't access %s. ") % path
msg += _("Please check the access permissions/SELinux and make sure it is readable/writable for the web application user account, typically '%s'.") % 'foreman'
raise PathAccessException, msg unless Dir.exist?(path)
end
|