props 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/props.rb +10 -9
- metadata +3 -3
data/lib/props.rb
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'pp'
|
6
|
-
require 'logger'
|
7
|
-
require 'optparse'
|
8
6
|
require 'fileutils'
|
9
7
|
require 'erb'
|
10
8
|
|
@@ -28,8 +26,10 @@ class Env
|
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
31
|
-
|
32
|
-
|
29
|
+
|
30
|
+
# todo: use logger - how?
|
31
|
+
## puts "env home=>#{path}<"
|
32
|
+
|
33
33
|
path
|
34
34
|
end
|
35
35
|
|
@@ -38,7 +38,7 @@ end # class Env
|
|
38
38
|
|
39
39
|
class Props
|
40
40
|
|
41
|
-
VERSION = '0.
|
41
|
+
VERSION = '1.0.0'
|
42
42
|
|
43
43
|
attr_reader :path
|
44
44
|
attr_reader :parent
|
@@ -51,8 +51,6 @@ class Props
|
|
51
51
|
|
52
52
|
def self.load_file( path, parent=nil )
|
53
53
|
h = YAML.load_file( path )
|
54
|
-
puts "dump of >#{path}<:"
|
55
|
-
pp h # todo: add debug flag (turn off for default)
|
56
54
|
Props.new( h, path, parent )
|
57
55
|
end
|
58
56
|
|
@@ -60,11 +58,14 @@ class Props
|
|
60
58
|
def self.load_file_with_erb( path, binding, parent=nil ) # run through erb first
|
61
59
|
text = ERB.new( File.read( path ) ).result( binding )
|
62
60
|
h = YAML.load( text )
|
63
|
-
puts "dump of >#{path}<:"
|
64
|
-
pp h # todo: add debug flag (turn off for default)
|
65
61
|
Props.new( h, path, parent )
|
66
62
|
end
|
67
63
|
|
64
|
+
def dump # for debugging
|
65
|
+
puts "dump of >#{@path}<:"
|
66
|
+
pp @hash
|
67
|
+
end
|
68
|
+
|
68
69
|
|
69
70
|
def fetch(key, default)
|
70
71
|
value = get( key )
|
metadata
CHANGED
@@ -4,10 +4,10 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerald Bauer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rdoc
|