diff options
| author | Paul Buetow <paul@buetow.org> | 2025-02-19 01:29:01 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-02-19 01:29:01 +0200 |
| commit | e37f1d7dfeb3ff40ee80c6e097cae30b9ec512c4 (patch) | |
| tree | 2e9f9a63b799f1e8901fdd6d08f09b7665cd6ab5 /lib/dslkeywords/resource.rb | |
| parent | 13657c3c13dc62d6aba6e0633fc7f99e44170c06 (diff) | |
more on this
Diffstat (limited to 'lib/dslkeywords/resource.rb')
| -rw-r--r-- | lib/dslkeywords/resource.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dslkeywords/resource.rb b/lib/dslkeywords/resource.rb index 3aff069..2358ff5 100644 --- a/lib/dslkeywords/resource.rb +++ b/lib/dslkeywords/resource.rb @@ -26,6 +26,12 @@ module RCM return @requires if others.empty? others.flatten.each do |other| + unless other.include?('(') + # Convert "notify foo" to "notify('foo')" + resource, rest = other.split(' ', 2) + other = "#{resource}('#{rest}')" + end + info "Registered dependency on #{other}" @requires << other end @@ -74,7 +80,7 @@ module RCM def self.find(id) return @@resource_find_cache[id] if @@resource_find_cache.key?(id) - klass = Object.const_get("RCM::#{id.split('(').first.capitalize}") + klass = Object.const_get("RCM::#{id.split(/[( ]/).first.capitalize}") resource = ObjectSpace.each_object(klass).find { _1.id == id } raise NoSuchResourceObject, "Unable to find resource #{id}" if resource.nil? |
