summaryrefslogtreecommitdiff
path: root/examples/gem/config.rb
diff options
context:
space:
mode:
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