sinatra-config-file 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +2 -9
  2. data/lib/sinatra/config_file.rb +13 -13
  3. metadata +26 -41
data/README.md CHANGED
@@ -4,14 +4,7 @@ Sinatra::ConfigFile
4
4
  Adds YAML config file support to [Sinatra](http://sinatrarb.com).
5
5
 
6
6
  Config files are expected to represent hashes. When parsing such a config file it will use set to store that value,
7
- ignoring those directly defined in the app (not those defined by the class it inherits from, i.e. Sinatra::Base or
8
- Sinatra::BigBand).
9
-
10
- BigBand
11
- -------
12
-
13
- Sinatra::ConfigFile is part of the [BigBand](http://github.com/rkh/big_band) stack.
14
- Check it out if you are looking for other fancy Sinatra extensions.
7
+ ignoring those directly defined in the app (not those defined by the class it inherits from, i.e. Sinatra::Base).
15
8
 
16
9
 
17
10
  Installation
@@ -45,4 +38,4 @@ Now you could write in your settings.yml:
45
38
  In you development.settings.yml:
46
39
 
47
40
  database:
48
- db_file: development.db
41
+ db_file: development.db
@@ -1,9 +1,7 @@
1
- require "sinatra/base"
2
- require "sinatra/sugar"
1
+ require 'sinatra/base'
3
2
 
4
3
  module Sinatra
5
4
  module ConfigFile
6
-
7
5
  unless defined? Parser
8
6
  begin
9
7
  require "psych"
@@ -14,19 +12,21 @@ module Sinatra
14
12
  end
15
13
  end
16
14
 
17
- def self.registered(klass)
18
- klass.register Sugar
19
- end
20
-
21
15
  def config_file(*paths)
22
- paths.each do |pattern|
23
- files = root_glob(pattern.to_s)
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 } } }
25
- warn "WARNING: could not load config file #{pattern}" if files.empty?
16
+ Dir.chdir root do
17
+ paths.each do |pattern|
18
+ files = Dir.glob pattern
19
+ files.each do |file|
20
+ yaml = Parser.load_file(file) || {}
21
+ yaml.each_pair do |key, value|
22
+ set key, value unless methods(false).any? { |m| m.to_s == key.to_s }
23
+ end
24
+ end
25
+ warn "WARNING: could not load config file #{pattern}" if files.empty?
26
+ end
26
27
  end
27
28
  end
28
29
  end
29
30
 
30
31
  register ConfigFile
31
-
32
- end
32
+ end
metadata CHANGED
@@ -1,87 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-config-file
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 0
10
- version: 0.5.0
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantin Haase
14
+ - Dmitry A. Ustalov
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-07-09 00:00:00 +02:00
19
+ date: 2011-03-13 00:00:00 +01:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- name: sinatra-sugar
23
+ name: sinatra
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
28
  - - ~>
28
29
  - !ruby/object:Gem::Version
29
- hash: 11
30
+ hash: 15
30
31
  segments:
32
+ - 1
31
33
  - 0
32
- - 5
33
- - 0
34
- version: 0.5.0
34
+ version: "1.0"
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: sinatra-test-helper
38
+ name: rspec
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 11
45
+ hash: 27
46
46
  segments:
47
+ - 1
48
+ - 3
47
49
  - 0
48
- - 5
49
- - 0
50
- version: 0.5.0
50
+ version: 1.3.0
51
51
  type: :development
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: sinatra
54
+ name: sinatra-test-helper
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 15
61
+ hash: 11
62
62
  segments:
63
- - 1
64
63
  - 0
65
- version: "1.0"
66
- type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rspec
70
- prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 27
77
- segments:
78
- - 1
79
- - 3
64
+ - 5
80
65
  - 0
81
- version: 1.3.0
66
+ version: 0.5.0
82
67
  type: :development
83
- version_requirements: *id004
84
- description: Load Sinatra settings from a yaml file (part of BigBand).
68
+ version_requirements: *id003
69
+ description: Load Sinatra settings from a yaml file.
85
70
  email: konstantin.mailinglists@googlemail.com
86
71
  executables: []
87
72
 
@@ -93,7 +78,7 @@ files:
93
78
  - lib/sinatra/config_file.rb
94
79
  - README.md
95
80
  - LICENSE
96
- has_rdoc: yard
81
+ has_rdoc: true
97
82
  homepage: http://github.com/rkh/sinatra-config-file
98
83
  licenses: []
99
84
 
@@ -123,9 +108,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
108
  requirements: []
124
109
 
125
110
  rubyforge_project:
126
- rubygems_version: 1.3.7
111
+ rubygems_version: 1.5.2
127
112
  signing_key:
128
113
  specification_version: 3
129
- summary: Load Sinatra settings from a yaml file (part of BigBand).
114
+ summary: Load Sinatra settings from a yaml file.
130
115
  test_files: []
131
116