sinatra-config-file 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +27 -0
- data/README.md +1 -1
- data/lib/sinatra/config_file.rb +12 -2
- metadata +25 -12
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
copyright (c) 2010 Konstantin Haase. All rights reserved.
|
2
|
+
|
3
|
+
Developed by: Konstantin Haase
|
4
|
+
http://github.com/rkh/big_band
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to
|
8
|
+
deal with the Software without restriction, including without limitation the
|
9
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
1. Redistributions of source code must retain the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimers.
|
14
|
+
2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
notice, this list of conditions and the following disclaimers in the
|
16
|
+
documentation and/or other materials provided with the distribution.
|
17
|
+
3. Neither the name of Konstantin Haase, nor the names of other contributors
|
18
|
+
may be used to endorse or promote products derived from this Software without
|
19
|
+
specific prior written permission.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
27
|
+
WITH THE SOFTWARE.
|
data/README.md
CHANGED
data/lib/sinatra/config_file.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
require "sinatra/base"
|
2
2
|
require "sinatra/sugar"
|
3
|
-
require "yaml"
|
4
3
|
|
5
4
|
module Sinatra
|
6
5
|
module ConfigFile
|
6
|
+
|
7
|
+
unless defined? Parser
|
8
|
+
begin
|
9
|
+
require "psych"
|
10
|
+
Parser = Psych
|
11
|
+
rescue LoadError
|
12
|
+
require "yaml"
|
13
|
+
Parser = YAML
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
def self.registered(klass)
|
8
18
|
klass.register Sugar
|
9
19
|
end
|
@@ -11,7 +21,7 @@ module Sinatra
|
|
11
21
|
def config_file(*paths)
|
12
22
|
paths.each do |pattern|
|
13
23
|
files = root_glob(pattern.to_s)
|
14
|
-
files.each { |f|
|
24
|
+
files.each { |f| Parser.load_file(f).each_pair { |k,v| set k, v unless methods(false).any? { |m| m.to_s = k.to_s } } }
|
15
25
|
warn "WARNING: could not load config file #{pattern}" if files.empty?
|
16
26
|
end
|
17
27
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-config-file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 5
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Konstantin Haase
|
@@ -14,58 +15,65 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-09 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: sinatra-sugar
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
27
30
|
segments:
|
28
31
|
- 0
|
29
|
-
-
|
32
|
+
- 5
|
30
33
|
- 0
|
31
|
-
version: 0.
|
34
|
+
version: 0.5.0
|
32
35
|
type: :runtime
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
38
|
name: sinatra-test-helper
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 11
|
41
46
|
segments:
|
42
47
|
- 0
|
43
|
-
-
|
48
|
+
- 5
|
44
49
|
- 0
|
45
|
-
version: 0.
|
50
|
+
version: 0.5.0
|
46
51
|
type: :development
|
47
52
|
version_requirements: *id002
|
48
53
|
- !ruby/object:Gem::Dependency
|
49
54
|
name: sinatra
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
|
-
- -
|
59
|
+
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
55
62
|
segments:
|
63
|
+
- 1
|
56
64
|
- 0
|
57
|
-
|
58
|
-
- 4
|
59
|
-
version: 0.9.4
|
65
|
+
version: "1.0"
|
60
66
|
type: :runtime
|
61
67
|
version_requirements: *id003
|
62
68
|
- !ruby/object:Gem::Dependency
|
63
69
|
name: rspec
|
64
70
|
prerelease: false
|
65
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
66
73
|
requirements:
|
67
74
|
- - ">="
|
68
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 27
|
69
77
|
segments:
|
70
78
|
- 1
|
71
79
|
- 3
|
@@ -84,6 +92,7 @@ extra_rdoc_files: []
|
|
84
92
|
files:
|
85
93
|
- lib/sinatra/config_file.rb
|
86
94
|
- README.md
|
95
|
+
- LICENSE
|
87
96
|
has_rdoc: yard
|
88
97
|
homepage: http://github.com/rkh/sinatra-config-file
|
89
98
|
licenses: []
|
@@ -94,23 +103,27 @@ rdoc_options: []
|
|
94
103
|
require_paths:
|
95
104
|
- lib
|
96
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
97
107
|
requirements:
|
98
108
|
- - ">="
|
99
109
|
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
100
111
|
segments:
|
101
112
|
- 0
|
102
113
|
version: "0"
|
103
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
104
116
|
requirements:
|
105
117
|
- - ">="
|
106
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
107
120
|
segments:
|
108
121
|
- 0
|
109
122
|
version: "0"
|
110
123
|
requirements: []
|
111
124
|
|
112
125
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.3.
|
126
|
+
rubygems_version: 1.3.7
|
114
127
|
signing_key:
|
115
128
|
specification_version: 3
|
116
129
|
summary: Load Sinatra settings from a yaml file (part of BigBand).
|