From c7697dbd7d26bc6c62031e0d4d530b3b5987d9ee Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 14 Feb 2025 22:21:00 +0200 Subject: more tests --- lib/dsl.rb | 16 ++++++++++------ lib/dslkeywords/file.rb | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/dsl.rb b/lib/dsl.rb index 1629afc..3a53762 100644 --- a/lib/dsl.rb +++ b/lib/dsl.rb @@ -10,15 +10,19 @@ module RCM class DSL attr_reader :id - # TODO: Replace @@ with @ class variables - @@rcm_counter = -1 - @@objs = {} + def self.reset! + @@rcm_counter = -1 + @@objs = {} + end + + reset! include Config include Options include Log - def initialize + def initialize(reset) + DSL.reset! if reset @id = "#{self.class}(#{@@rcm_counter += 1})" @conds_met = true @scheduled = [] @@ -35,8 +39,8 @@ module RCM end end -def configure(&block) - RCM::DSL.new do |rcm| +def configure(reset: false, &block) + RCM::DSL.new(reset) do |rcm| rcm.info('Configuring...') rcm.instance_eval(&block) rcm.evaluate! diff --git a/lib/dslkeywords/file.rb b/lib/dslkeywords/file.rb index 58d7a47..8c4deca 100644 --- a/lib/dslkeywords/file.rb +++ b/lib/dslkeywords/file.rb @@ -62,7 +62,7 @@ module RCM dirname = ::File.dirname(@path) return unless !::File.directory?(dirname) && @create_parent - info "Creating parent directory #{parent}" + info "Creating parent directory #{dirname}" FileUtils.mkdir_p(dirname) end -- cgit v1.2.3