module Runbook

Constants

StandardError
VERSION

Attributes

configuration[RW]

Public Class Methods

_child_classes(mod) click to toggle source
# File lib/runbook/util/runbook.rb, line 32
def self._child_classes(mod)
  mod.constants.map { |const|
    "#{mod.to_s}::#{const}".constantize
  }.select { |const| const.is_a?(Class) }
end
_child_modules(mod) click to toggle source
# File lib/runbook/util/runbook.rb, line 38
def self._child_modules(mod)
  mod.constants.map { |const|
    "#{mod.to_s}::#{const}".constantize
  }.select { |const| const.is_a?(Module) }
end
book(title, *tags, labels: {}, &block) click to toggle source
# File lib/runbook.rb, line 95
def self.book(title, *tags, labels: {}, &block)
  Configuration.load_config
  Entities::Book.new(title, tags: tags, labels: labels).tap do |book|
    book.dsl.instance_eval(&block)
    register(book)
  end
end
books() click to toggle source
# File lib/runbook.rb, line 133
def self.books
  @books ||= []
end
config() click to toggle source
# File lib/runbook/configuration.rb, line 5
def config
  @configuration
end
configure() { |configuration| ... } click to toggle source
# File lib/runbook/configuration.rb, line 10
def self.configure
  Configuration.load_config
  self.configuration ||= Configuration.new
  yield(configuration) if block_given?
end
deprecator() click to toggle source
# File lib/runbook/util/runbook.rb, line 22
def self.deprecator
  return @deprecator if @deprecator
  major_version = Gem::Version.new(Runbook::VERSION).segments[0]
  next_major_version = major_version + 1
  @deprecator = ActiveSupport::Deprecation.new(
    "#{next_major_version}.0",
    "Runbook"
  )
end
entities() click to toggle source
# File lib/runbook/util/runbook.rb, line 2
def self.entities
  _child_classes(Runbook::Entities)
end
generators() click to toggle source
# File lib/runbook/util/runbook.rb, line 18
def self.generators
  _child_classes(Runbook::Generators)
end
register(book) click to toggle source
# File lib/runbook.rb, line 129
def self.register(book)
  books << book
end
reset_configuration() click to toggle source
# File lib/runbook/configuration.rb, line 16
def self.reset_configuration
  self.configuration = Configuration.new
  Configuration.loaded = false
end
runs() click to toggle source
# File lib/runbook/util/runbook.rb, line 10
def self.runs
  _child_modules(Runbook::Runs)
end
runtime_methods() click to toggle source
# File lib/runbook.rb, line 137
def self.runtime_methods
  @runtime_methods ||= []
end
section(title, *tags, labels: {}, &block) click to toggle source
# File lib/runbook.rb, line 103
def self.section(title, *tags, labels: {}, &block)
  Configuration.load_config
  Entities::Section.new(title, tags: tags, labels: labels).tap do |section|
    section.dsl.instance_eval(&block)
  end
end
setup(*tags, labels: {}, &block) click to toggle source
# File lib/runbook.rb, line 110
def self.setup(*tags, labels: {}, &block)
  Configuration.load_config
  Entities::Setup.new(tags: tags, labels: labels).tap do |setup|
    setup.dsl.instance_eval(&block)
  end
end
statements() click to toggle source
# File lib/runbook/util/runbook.rb, line 6
def self.statements
  _child_classes(Runbook::Statements)
end
step(title=nil, *tags, labels: {}, &block) click to toggle source
# File lib/runbook.rb, line 117
def self.step(title=nil, *tags, labels: {}, &block)
  if title.is_a?(Symbol)
    tags.unshift(title)
    title = nil
  end

  Configuration.load_config
  Entities::Step.new(title, tags: tags, labels: labels).tap do |step|
    step.dsl.instance_eval(&block) if block
  end
end
views() click to toggle source
# File lib/runbook/util/runbook.rb, line 14
def self.views
  _child_modules(Runbook::Views)
end