summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-01 21:36:39 +0200
committerPaul Buetow <paul@buetow.org>2026-03-01 21:36:39 +0200
commit8e64fd142f90718b08fdb7d73ec58022bc18de9c (patch)
tree9e6b9abe942089a58cdb89e91ee0033f971653ed
parentedcc1f276638f6e62bcacc391229d341ad18769d (diff)
fix requires syntax in plain_ruby example.rb
-rwxr-xr-xexamples/plain_ruby/example.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/plain_ruby/example.rb b/examples/plain_ruby/example.rb
new file mode 100755
index 0000000..45c9fb3
--- /dev/null
+++ b/examples/plain_ruby/example.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'
+begin
+ require 'rcm'
+rescue LoadError
+ require_relative '../../lib/dsl'
+end
+
+configure do
+ given { hostname is :earth }
+
+ file '/tmp/test/wg0.conf' do
+ requires file '/etc/hosts.test'
+ manage directory
+ from template
+ 'content with <%= 1 + 2 %>'
+ end
+
+ file '/etc/hosts.test' do
+ line '192.168.1.101 earth'
+ end
+end