erb-process 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/erb-process.rb +5 -0
- data/lib/erbprocess/version.rb +1 -1
- data/test/example_config.erb +2 -1
- data/test/test_erbprocess.rb +2 -2
- metadata +3 -3
data/lib/erb-process.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "erb"
|
2
2
|
require "yaml"
|
3
3
|
require "erbprocess/version"
|
4
|
+
require 'socket'
|
4
5
|
|
5
6
|
module ERBProcess
|
6
7
|
|
@@ -25,6 +26,10 @@ module ERBProcess
|
|
25
26
|
t = ERB.new(content)
|
26
27
|
return t.result(binding)
|
27
28
|
end
|
29
|
+
|
30
|
+
def ERBProcess.gethostname
|
31
|
+
return Socket.gethostname.first
|
32
|
+
end
|
28
33
|
|
29
34
|
end
|
30
35
|
|
data/lib/erbprocess/version.rb
CHANGED
data/test/example_config.erb
CHANGED
data/test/test_erbprocess.rb
CHANGED
@@ -4,11 +4,11 @@ require "lib/erb-process.rb"
|
|
4
4
|
|
5
5
|
class TestERBProcess < Test::Unit::TestCase
|
6
6
|
def testVersion
|
7
|
-
assert_equal '0.
|
7
|
+
assert_equal '0.2.0', ERBProcess::VERSION
|
8
8
|
end
|
9
9
|
|
10
10
|
def testTemplate
|
11
|
-
result = "host: http://qa.epals.com\nbar: http://qa.foo.com"
|
11
|
+
result = "host: http://qa.epals.com\nbar: http://qa.foo.com\nthis_host: "<<ERBProcess.gethostname
|
12
12
|
assert_equal result, ERBProcess.process("test/config.yml", "test/example_config.erb", "QA")
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb-process
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick O'Leary
|