debstep 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/debstep/script_keeper.rb +11 -3
- metadata +1 -1
@@ -6,15 +6,23 @@ module Debstep
|
|
6
6
|
|
7
7
|
def initialize(init="#!/usr/bin/env bash", &block)
|
8
8
|
@script = init + "\n"
|
9
|
-
instance_eval(&block)
|
9
|
+
instance_eval(&block) if block_given?
|
10
10
|
end
|
11
11
|
|
12
12
|
def file(path)
|
13
|
-
|
13
|
+
append(File.open(path, 'r').read.strip)
|
14
|
+
end
|
15
|
+
|
16
|
+
def raw(value)
|
17
|
+
append(value)
|
14
18
|
end
|
15
19
|
|
16
20
|
def template(path)
|
17
|
-
|
21
|
+
append(ERB.new(File.open(path, 'r').read.strip).result)
|
22
|
+
end
|
23
|
+
|
24
|
+
def append(value)
|
25
|
+
@script += value + "\n"
|
18
26
|
end
|
19
27
|
|
20
28
|
alias :run :file
|