summaryrefslogtreecommitdiff
path: root/examples/plain_ruby/config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'examples/plain_ruby/config.rb')
-rwxr-xr-xexamples/plain_ruby/config.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/plain_ruby/config.rb b/examples/plain_ruby/config.rb
new file mode 100755
index 0000000..f49bd01
--- /dev/null
+++ b/examples/plain_ruby/config.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+# Example: Plain Ruby script — no Rake, no bundler required.
+#
+# Run with:
+# ruby config.rb --dry # dry run, no changes made
+# ruby config.rb --debug # verbose output
+# ruby config.rb # apply configuration
+#
+# Requires rcm to be installed as a gem, or adjust the path below:
+# require_relative '../../lib/dsl'
+require 'rcm'
+
+configure do
+ # Write a simple text file with static content.
+ file '/tmp/example/hello.txt' do
+ manage directory
+ 'Hello, World!'
+ end
+
+ # Ensure a specific line is present in another file (idempotent).
+ file '/tmp/example/hosts.txt' do
+ line '127.0.0.1 localhost'
+ end
+
+ # Create a file from an inline ERB template.
+ file '/tmp/example/greeting.txt' do
+ from template
+ 'Generated on <%= Time.now.strftime("%Y-%m-%d") %>'
+ end
+end