class Terradactyl::Stacks

Attributes

filter[R]

Public Class Methods

dirty() click to toggle source
# File lib/terradactyl/stacks.rb, line 24
def dirty
  @@dirty
end
dirty!(stack) click to toggle source
# File lib/terradactyl/stacks.rb, line 28
def dirty!(stack)
  @@dirty << stack
end
dirty?(name = nil) click to toggle source
# 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() click to toggle source
# File lib/terradactyl/stacks.rb, line 10
def error
  @@error
end
error!(stack) click to toggle source
# File lib/terradactyl/stacks.rb, line 14
def error!(stack)
  @@error << stack
end
error?(name = nil) click to toggle source
# 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) click to toggle source
# File lib/terradactyl/stacks.rb, line 47
def self.load(*args)
  new(*args)
end
new(filter: StacksPlanFilterDefault.new) click to toggle source
# File lib/terradactyl/stacks.rb, line 53
def initialize(filter: StacksPlanFilterDefault.new)
  @filter   = filter
  @base_dir = "#{Rake.original_dir}/#{config.base_folder}"
  @stacks   = @filter.sift(stacks_all)
end
validate(stack) click to toggle source
# File lib/terradactyl/stacks.rb, line 43
def self.validate(stack)
  new.validate(stack)
end

Public Instance Methods

each(&block) click to toggle source
# File lib/terradactyl/stacks.rb, line 76
def each(&block)
  list.each(&block)
end
empty?() click to toggle source
# File lib/terradactyl/stacks.rb, line 72
def empty?
  list.empty?
end
list() click to toggle source
# File lib/terradactyl/stacks.rb, line 59
def list
  @stacks
end
size() click to toggle source
# File lib/terradactyl/stacks.rb, line 68
def size
  @stacks.size
end
validate(stack_name) click to toggle source
# File lib/terradactyl/stacks.rb, line 63
def validate(stack_name)
  stack_name = stack_name.split('/').last
  @stacks.member?(stack_name) ? stack_name : nil
end

Private Instance Methods

paths() click to toggle source
# File lib/terradactyl/stacks.rb, line 82
def paths
  Dir.glob("#{@base_dir}/*/*.tf")
end
stacks_all() click to toggle source
# File lib/terradactyl/stacks.rb, line 86
def stacks_all
  paths.map { |p| File.dirname(p) }.sort.uniq.map { |p| File.basename(p) }
end