profigure 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
3
  :major: 0
4
- :patch: 1
4
+ :patch: 2
@@ -8,7 +8,7 @@ require File.join(File.dirname(__FILE__), "profigure", "profigure")
8
8
 
9
9
  def dbg( msg )
10
10
  file, line, method_raw = caller[0].split('/').last.split(':')
11
- method = method_raw.match(/^in `(.+)'/)[1]
11
+ method = method_raw.match(/^in `(.+)'/)[1] rescue "unknown"
12
12
  puts "#{method} (#{file}##{line}): #{msg}"
13
13
  end
14
14
 
@@ -13,9 +13,13 @@ class Profigure
13
13
 
14
14
  def file_contents(environment, configs_dir)
15
15
  file = "#{configs_dir}/#{environment}.yml"
16
- content = IO.read(file)
16
+ content = run_erb IO.read(file)
17
17
  end
18
18
 
19
+ def run_erb(data)
20
+ ERB.new( data ).result
21
+ end
22
+
19
23
  end
20
24
  end
21
25
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{profigure}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Friedman"]
12
- s.date = %q{2010-05-04}
12
+ s.date = %q{2010-05-12}
13
13
  s.description = %q{profigure aims to be a drop in replacement for configuring your apps in a railsy way.}
14
14
  s.email = %q{asher.friedman@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "spec/spec_helper.rb",
33
33
  "spec/test_config/arrays.yml",
34
34
  "spec/test_config/defaults.yml",
35
+ "spec/test_config/erb.yml",
35
36
  "spec/test_config/nested.yml",
36
37
  "spec/test_config/overrides.yml",
37
38
  "spec/test_config/test.yml"
@@ -36,6 +36,13 @@ describe "Profigure" do
36
36
  config.array[1].should == "two"
37
37
  end
38
38
 
39
+ it "should properly handle inline arrays" do
40
+ config = Profigure.load @config_dir, "arrays"
41
+
42
+ config.inline_array.size.should == 3
43
+ config.inline_array.last.should == "five"
44
+ end
45
+
39
46
  it "should allow overriding after load" do
40
47
  config = Profigure.load @config_dir, "test"
41
48
  config.foo = "bar"
@@ -48,4 +55,10 @@ describe "Profigure" do
48
55
 
49
56
  config[:foo].should == "bar"
50
57
  end
58
+
59
+ it "should allow template to contain erb" do
60
+ config = Profigure.load @config_dir, "erb"
61
+
62
+ config[:user].should == ENV["USER"]
63
+ end
51
64
  end
@@ -1 +1,6 @@
1
- array: [one, two]
1
+ array:
2
+ - one
3
+ - two
4
+
5
+ inline_array: [three, four, five]
6
+
@@ -0,0 +1,3 @@
1
+ <% require 'etc' %>
2
+
3
+ user: <%= Etc.getlogin %>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joel Friedman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-04 00:00:00 -05:00
17
+ date: 2010-05-12 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -68,6 +68,7 @@ files:
68
68
  - spec/spec_helper.rb
69
69
  - spec/test_config/arrays.yml
70
70
  - spec/test_config/defaults.yml
71
+ - spec/test_config/erb.yml
71
72
  - spec/test_config/nested.yml
72
73
  - spec/test_config/overrides.yml
73
74
  - spec/test_config/test.yml