Class: Terradactyl::Stacks
- Inherits:
-
Object
- Object
- Terradactyl::Stacks
show all
- Includes:
- Enumerable, Common
- Defined in:
- lib/terradactyl/stacks.rb
Constant Summary
collapse
- @@dirty =
rubocop:disable Style/ClassVars
[]
- @@error =
[]
Constants included
from Common
Common::BORDER_CHAR, Common::COLUMN_WIDTH
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Common
border, centre, config, cputs, dot_icon, print_content, print_crit, print_dot, print_header, print_line, print_message, print_ok, print_warning, required_versions_re, stack_icon, supported_revisions, tag, terraform_binary
Constructor Details
#initialize(filter: StacksPlanFilterDefault.new, base_override: nil) ⇒ Stacks
Returns a new instance of Stacks.
53
54
55
56
57
58
59
|
# File 'lib/terradactyl/stacks.rb', line 53
def initialize(filter: StacksPlanFilterDefault.new, base_override: nil)
base_folder = base_override || config.base_folder
@filter = filter
@base_dir = "#{Rake.original_dir}/#{base_folder}"
@stacks = @filter.sift(stacks_all, base_folder)
end
|
Instance Attribute Details
#filter ⇒ Object
Returns the value of attribute filter.
51
52
53
|
# File 'lib/terradactyl/stacks.rb', line 51
def filter
@filter
end
|
Class Method Details
.dirty ⇒ Object
24
25
26
|
# File 'lib/terradactyl/stacks.rb', line 24
def dirty
@@dirty
end
|
.dirty!(stack) ⇒ Object
28
29
30
|
# File 'lib/terradactyl/stacks.rb', line 28
def dirty!(stack)
@@dirty << stack
end
|
.dirty?(name = nil) ⇒ Boolean
32
33
34
35
36
|
# File 'lib/terradactyl/stacks.rb', line 32
def dirty?(name = nil)
return @@dirty.find { |s| s.name.eql?(validate(name)) } if name
@@dirty.any?
end
|
.error ⇒ Object
10
11
12
|
# File 'lib/terradactyl/stacks.rb', line 10
def error
@@error
end
|
.error!(stack) ⇒ Object
14
15
16
|
# File 'lib/terradactyl/stacks.rb', line 14
def error!(stack)
@@error << stack
end
|
.error?(name = nil) ⇒ Boolean
18
19
20
21
22
|
# File 'lib/terradactyl/stacks.rb', line 18
def error?(name = nil)
return @@error.find { |s| s.name.eql?(validate(name)) } if name
@@error.any?
end
|
.load(*args, **kwargs) ⇒ Object
47
48
49
|
# File 'lib/terradactyl/stacks.rb', line 47
def self.load(*args, **kwargs)
new(*args, **kwargs)
end
|
.validate(stack) ⇒ Object
43
44
45
|
# File 'lib/terradactyl/stacks.rb', line 43
def self.validate(stack)
new.validate(stack)
end
|
Instance Method Details
#each(&block) ⇒ Object
78
79
80
|
# File 'lib/terradactyl/stacks.rb', line 78
def each(&block)
list.each(&block)
end
|
#empty? ⇒ Boolean
74
75
76
|
# File 'lib/terradactyl/stacks.rb', line 74
def empty?
list.empty?
end
|
#list ⇒ Object
61
62
63
|
# File 'lib/terradactyl/stacks.rb', line 61
def list
@stacks
end
|
#size ⇒ Object
70
71
72
|
# File 'lib/terradactyl/stacks.rb', line 70
def size
@stacks.size
end
|
#validate(stack_name) ⇒ Object
65
66
67
68
|
# File 'lib/terradactyl/stacks.rb', line 65
def validate(stack_name)
stack_name = stack_name.split('/').last
@stacks.member?(stack_name) ? stack_name : nil
end
|