summaryrefslogtreecommitdiff
path: root/lib/autorequire/file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/autorequire/file.rb')
-rw-r--r--lib/autorequire/file.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/autorequire/file.rb b/lib/autorequire/file.rb
new file mode 100644
index 0000000..2a25a07
--- /dev/null
+++ b/lib/autorequire/file.rb
@@ -0,0 +1,33 @@
+module RCM
+ # Managing files
+ class File
+ attr_reader :path
+
+ def initialize(path)
+ @path = path
+ end
+
+ def content(content = nil)
+ content.nil? ? @content : @content = content
+ end
+
+ def to_s
+ @path
+ end
+
+ def do!
+ puts "Evaluating #{self.class}:#{self}"
+ end
+ end
+
+ # Add file keyword to the DSL
+ class RCM
+ def file(path, &block)
+ return unless @conds_met
+
+ f = File.new(path)
+ f.instance_eval(&block)
+ self << f
+ end
+ end
+end