radiospiel-app 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -12,7 +12,8 @@ module App
12
12
  def self.read(path)
13
13
  return unless File.exist?(path)
14
14
  App.logger.info "Reading configuration from #{path}"
15
- yaml = File.read(path)
15
+ erb = File.read(path)
16
+ yaml = ERB.new(erb).result(binding)
16
17
  YAML.load(yaml) || {}
17
18
  end
18
19
 
@@ -0,0 +1,5 @@
1
+ class Array
2
+ def extract_options!
3
+ last.is_a?(Hash) ? pop : {}
4
+ end
5
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "radiospiel-app"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["radiospiel"]
12
- s.date = "2012-04-03"
12
+ s.date = "2012-04-04"
13
13
  s.description = "Some basics that your application could benefit from."
14
14
  s.email = "eno@open-lab.org"
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/app/app/config.rb",
34
34
  "lib/app/app/logger.rb",
35
35
  "lib/app/app/root.rb",
36
+ "lib/core-extensions/array_ext.rb",
36
37
  "lib/core-extensions/benchmark-logger.rb",
37
38
  "lib/core-extensions/cgi_ext.rb",
38
39
  "lib/core-extensions/hash_ext.rb",
@@ -46,6 +47,7 @@ Gem::Specification.new do |s|
46
47
  "radiospiel-app.gemspec",
47
48
  "script/watchr",
48
49
  "test/app_test.rb",
50
+ "test/array_ext_test.rb",
49
51
  "test/cache_test.rb",
50
52
  "test/cgi_ext_test.rb",
51
53
  "test/config.yml",
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class ArrayExtTest < Test::Unit::TestCase
6
+ def test_extract_options
7
+ array = [ 1, 2, 3 ]
8
+ options = array.extract_options!
9
+ assert_equal({}, options)
10
+ assert_equal([1,2,3], array)
11
+
12
+ array = [ ]
13
+ options = array.extract_options!
14
+ assert_equal({}, options)
15
+ assert_equal([], array)
16
+
17
+ array = [ 1, 2, 3, {} ]
18
+ options = array.extract_options!
19
+ assert_equal({}, options)
20
+ assert_equal([1,2,3], array)
21
+
22
+ array = [ {} ]
23
+ options = array.extract_options!
24
+ assert_equal({}, options)
25
+ assert_equal([], array)
26
+
27
+ array = [ 1, 2, 3, { 1 => 2 } ]
28
+ options = array.extract_options!
29
+ assert_equal({ 1 => 2 }, options)
30
+ assert_equal([1,2,3], array)
31
+
32
+ array = [ { 1 => 2 } ]
33
+ options = array.extract_options!
34
+ assert_equal({ 1 => 2 }, options)
35
+ assert_equal([], array)
36
+ end
37
+ end
data/test/config.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  default:
2
2
  abc: "abc"
3
3
  dummy: "dummy"
4
-
4
+ erbed: <%= "test" %>
5
+
5
6
  test:
6
7
  abc: "def"
7
8
 
data/test/config_test.rb CHANGED
@@ -4,7 +4,7 @@ class TestConfig < Test::Unit::TestCase
4
4
  def test_read_from_test_config
5
5
  App.root = File.dirname __FILE__
6
6
 
7
- expected = {"abc"=>"def", "dummy"=>"dummy"}
7
+ expected = {"abc"=>"def", "dummy"=>"dummy", "erbed"=> "test" }
8
8
  assert_equal(expected, App.config)
9
9
 
10
10
  assert_equal("def", App.config[:abc])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiospiel-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-03 00:00:00.000000000 Z
12
+ date: 2012-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &70363188637140 !ruby/object:Gem::Requirement
16
+ requirement: &70155980894640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70363188637140
24
+ version_requirements: *70155980894640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70363188636460 !ruby/object:Gem::Requirement
27
+ requirement: &70155980894040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70363188636460
35
+ version_requirements: *70155980894040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: redis
38
- requirement: &70363188635680 !ruby/object:Gem::Requirement
38
+ requirement: &70155980893340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70363188635680
46
+ version_requirements: *70155980893340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: micro_sql
49
- requirement: &70363188634580 !ruby/object:Gem::Requirement
49
+ requirement: &70155980892600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70363188634580
57
+ version_requirements: *70155980892600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: htmlentities
60
- requirement: &70363188619980 !ruby/object:Gem::Requirement
60
+ requirement: &70155980891880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70363188619980
68
+ version_requirements: *70155980891880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70363188618960 !ruby/object:Gem::Requirement
71
+ requirement: &70155980891060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70363188618960
79
+ version_requirements: *70155980891060
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &70363188617680 !ruby/object:Gem::Requirement
82
+ requirement: &70155980890540 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70363188617680
90
+ version_requirements: *70155980890540
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: vcr
93
- requirement: &70363188616400 !ruby/object:Gem::Requirement
93
+ requirement: &70155980889880 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70363188616400
101
+ version_requirements: *70155980889880
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: webmock
104
- requirement: &70363188615300 !ruby/object:Gem::Requirement
104
+ requirement: &70155980889380 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70363188615300
112
+ version_requirements: *70155980889380
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: psych
115
- requirement: &70363188614400 !ruby/object:Gem::Requirement
115
+ requirement: &70155980888820 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70363188614400
123
+ version_requirements: *70155980888820
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: simplecov
126
- requirement: &70363188613240 !ruby/object:Gem::Requirement
126
+ requirement: &70155980888240 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70363188613240
134
+ version_requirements: *70155980888240
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: ruby-debug19
137
- requirement: &70363188612380 !ruby/object:Gem::Requirement
137
+ requirement: &70155980887640 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70363188612380
145
+ version_requirements: *70155980887640
146
146
  description: Some basics that your application could benefit from.
147
147
  email: eno@open-lab.org
148
148
  executables: []
@@ -167,6 +167,7 @@ files:
167
167
  - lib/app/app/config.rb
168
168
  - lib/app/app/logger.rb
169
169
  - lib/app/app/root.rb
170
+ - lib/core-extensions/array_ext.rb
170
171
  - lib/core-extensions/benchmark-logger.rb
171
172
  - lib/core-extensions/cgi_ext.rb
172
173
  - lib/core-extensions/hash_ext.rb
@@ -180,6 +181,7 @@ files:
180
181
  - radiospiel-app.gemspec
181
182
  - script/watchr
182
183
  - test/app_test.rb
184
+ - test/array_ext_test.rb
183
185
  - test/cache_test.rb
184
186
  - test/cgi_ext_test.rb
185
187
  - test/config.yml
@@ -205,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
207
  version: '0'
206
208
  segments:
207
209
  - 0
208
- hash: -1143350558901751465
210
+ hash: 256226923119998611
209
211
  required_rubygems_version: !ruby/object:Gem::Requirement
210
212
  none: false
211
213
  requirements: