From 876a5959cedd3699b2c3eccc71ed78badc3bad55 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 1 Mar 2026 20:15:44 +0200 Subject: add quickstart examples directory and link from README --- examples/plain_ruby/config.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 examples/plain_ruby/config.rb (limited to 'examples/plain_ruby') 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 -- cgit v1.2.3