summaryrefslogtreecommitdiff
path: root/examples/gem/config.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-01 20:24:45 +0200
committerPaul Buetow <paul@buetow.org>2026-03-01 20:24:45 +0200
commit92ba0576ebf8aaf770368eba4533d3c4ed4a5e37 (patch)
tree51179df29a4ebb77214bf902580da0e619446a72 /examples/gem/config.rb
parente17fbbfb30da394d6abbb91da4a963ff8913ad47 (diff)
replace gem example with bundle exec ruby, distinct from rake example
Diffstat (limited to 'examples/gem/config.rb')
-rwxr-xr-xexamples/gem/config.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/gem/config.rb b/examples/gem/config.rb
new file mode 100755
index 0000000..c4bbc23
--- /dev/null
+++ b/examples/gem/config.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+# Example: Using RCM as a gem inside a Bundler-managed project, without Rake.
+#
+# rcm is declared in the Gemfile and loaded via bundler.
+require 'rcm'
+
+configure do
+ # Only run on the host named 'earth'
+ given { hostname is :earth }
+
+ # Write a WireGuard config rendered from an inline ERB template.
+ file '/tmp/example/wg0.conf' do
+ from template
+
+ <<~TEMPLATE
+ [Interface]
+ Address = <%= "10.0.0.1/24" %>
+ ListenPort = 51820
+ TEMPLATE
+ end
+end