qonf 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qonf/railtie.rb +7 -0
- data/lib/qonf/version.rb +1 -1
- data/lib/qonf.rb +6 -4
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 873ddcd4ff47c12076f11bfe40bd766215f1470e
|
4
|
+
data.tar.gz: cb1eb2e5ec249de98423fb6bc446fee49f620550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a09272594e9d5d0cbdf0b0e4645c16537956149863be94647ca59aab4fc24803593a03a9a33b931a65232f6b83ab46308a7b47affe88251d542dcf9a593097c
|
7
|
+
data.tar.gz: 56958ad81ae4d6c444c31e07b6a277d00cdd28ba08423522030ccdec20c7a773f83cafd0115806216410238dcafb4380e70ff01f71306415584c6817dc26aaad
|
data/lib/qonf/railtie.rb
ADDED
data/lib/qonf/version.rb
CHANGED
data/lib/qonf.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "qonf/version"
|
2
|
+
require 'qonf/railtie' if defined?(Rails)
|
2
3
|
|
3
4
|
# A simple module to get information quickly out of config files
|
4
5
|
module Qonf
|
@@ -23,8 +24,6 @@ module Qonf
|
|
23
24
|
self.use_cache = Rails.env != "development"
|
24
25
|
end
|
25
26
|
end
|
26
|
-
|
27
|
-
load_defaults # load defaults by default
|
28
27
|
end
|
29
28
|
|
30
29
|
def self.configure(&block)
|
@@ -57,8 +56,11 @@ module Qonf
|
|
57
56
|
base_path = "#{Qonf::Config.base_dir}/#{config}"
|
58
57
|
|
59
58
|
formats={}
|
60
|
-
|
59
|
+
|
61
60
|
formats[:json] = ->(f){ JSON(f.read) } if defined?(JSON)
|
61
|
+
formats[:yml] = ->(f){ YAML.load(f) } if defined?(YAML)
|
62
|
+
formats[:yaml] = ->(f){ YAML.load(f) } if defined?(YAML)
|
63
|
+
|
62
64
|
raise "Must include JSON or YAML parser" if formats.keys.count == 0
|
63
65
|
|
64
66
|
formats.each do |ext,parser|
|
@@ -84,7 +86,7 @@ module Qonf
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
raise "Unable to find config for #{config} in #{base_path}
|
89
|
+
raise "Unable to find config for #{config} in #{base_path}.{#{formats.keys.join(',')}}" if @@cache[config.to_sym].nil?
|
88
90
|
end
|
89
91
|
|
90
92
|
return get_route(@@cache[config.to_sym], route)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qonf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Hayes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- examples/environed.json
|
69
69
|
- examples/simple.json
|
70
70
|
- lib/qonf.rb
|
71
|
+
- lib/qonf/railtie.rb
|
71
72
|
- lib/qonf/version.rb
|
72
73
|
- qonf.gemspec
|
73
74
|
- spec/qonf_spec.rb
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
95
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.1
|
96
|
+
rubygems_version: 2.4.1
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Simplest use case, add config/qonf.json or config/qonf.yaml and call Qonf.key
|
@@ -100,3 +101,4 @@ summary: Simplest use case, add config/qonf.json or config/qonf.yaml and call Qo
|
|
100
101
|
test_files:
|
101
102
|
- spec/qonf_spec.rb
|
102
103
|
- spec/spec_helper.rb
|
104
|
+
has_rdoc:
|