blob: 6612428ce5940c511ae158630143345fefcf2968 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
require_relative 'keyword'
module RCM
# To track recource dependencies
module Dependency
# Only to have the resourcename[id] syntax available in the DSL
class SyntaxSugar
def initialize(name)
@name = name
end
def [](other) = "#{@name}['#{other}']"
end
def method_missing(method_name) = SyntaxSugar.new(method_name)
def respond_to_missing? = true
def depends_on(*others)
@depends_on = {} if @depends_on.nil?
others.each do |other|
info "Registered dependency on #{other}"
@depends_on[other] = {}
end
end
end
# A resource is something concrete to be managed, e.g. a file, or a CRON job.
class Resource < Keyword
include Dependency
end
end
|