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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12132d8454c98e3c2a1424e86cbb6faebb0f51e2
4
- data.tar.gz: eda1d01e2b676e61d9438492e11b819df425d961
3
+ metadata.gz: 873ddcd4ff47c12076f11bfe40bd766215f1470e
4
+ data.tar.gz: cb1eb2e5ec249de98423fb6bc446fee49f620550
5
5
  SHA512:
6
- metadata.gz: e401058d8f0a05b2a3ad34b75639d1599673233fc9db17a4e9f367531623c1573beed6bd8dd08f9d283ef6fd7463d37ab4c8018273ba151afb082036df278ba2
7
- data.tar.gz: 13104477004369318b7016ee489c85d83e8df055fc28eb9f28d42deecc396ca782ef78225aad1c01f78d15efb3e116d76d2b364e757017ea817dfb5676e9bf2b
6
+ metadata.gz: 0a09272594e9d5d0cbdf0b0e4645c16537956149863be94647ca59aab4fc24803593a03a9a33b931a65232f6b83ab46308a7b47affe88251d542dcf9a593097c
7
+ data.tar.gz: 56958ad81ae4d6c444c31e07b6a277d00cdd28ba08423522030ccdec20c7a773f83cafd0115806216410238dcafb4380e70ff01f71306415584c6817dc26aaad
@@ -0,0 +1,7 @@
1
+ module Qonf
2
+ class Railtie < Rails::Railtie
3
+ initializer "Initialize Qonf" do
4
+ Qonf::Config.load_defaults # load defaults by default
5
+ end
6
+ end
7
+ end
data/lib/qonf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qonf
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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
- formats[:yml] = ->(f){ YAML.load(f) } if defined?(YAML)
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}/*.{#{formats.keys.join(',')}}" if @@cache[config.to_sym].nil?
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.3
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-06-26 00:00:00.000000000 Z
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.11
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: