easyconf-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/easyconf-rails.rb +26 -0
- data.tar.gz.sig +4 -0
- metadata +98 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
class EasyConfRails < Rails::Railtie
|
4
|
+
# Turn a Hash or Array and all of its Hash children into OpenStructs.
|
5
|
+
def hash_to_openstruct(hash)
|
6
|
+
(hash.is_a?(Hash) ? hash.keys : (0...hash.length)).each do |key|
|
7
|
+
if hash[key].is_a?(Hash) or hash[key].is_a?(Array)
|
8
|
+
hash[key] = hash_to_openstruct(hash[key])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
hash.is_a?(Array) ? hash : OpenStruct.new(hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Load the configuration file at the root of our Rails directory.
|
16
|
+
def load_config()
|
17
|
+
config_location = Rails.root + 'config.yml'
|
18
|
+
hash = YAML.load_file(config_location)
|
19
|
+
|
20
|
+
hash_to_openstruct(hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
config.after_initialize do
|
24
|
+
$config = load_config()
|
25
|
+
end
|
26
|
+
end
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: easyconf-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- katmagic
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- ! '-----BEGIN CERTIFICATE-----
|
13
|
+
|
14
|
+
MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA90aGUu
|
15
|
+
|
16
|
+
bWFnaWNhbC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XJ2PaUga6WkNeXYf9Mad36P4yuGQScjs+WkUUy7DNZvTGReIcCWOR8
|
43
|
+
|
44
|
+
jteSvvCMobQKGr2DfFOU9Jiddh2FPpz/KOM2ijzwsVNUMUr7R58LoCnQZrZ/YaRW
|
45
|
+
|
46
|
+
ob6QnVgwqu5SUAKQxlFJ/aKlPMj735z8EogaZC1ZHgg3vkgGGyu57N/8BDDG0TzC
|
47
|
+
|
48
|
+
Zn3u2leVae/fJ03zYGArhuJKPgc=
|
49
|
+
|
50
|
+
-----END CERTIFICATE-----
|
51
|
+
|
52
|
+
'
|
53
|
+
date: 2011-12-02 00:00:00.000000000 Z
|
54
|
+
dependencies:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: &73161220 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: *73161220
|
66
|
+
description: Configure Rails apps with a simple YAML file.
|
67
|
+
email: the.magical.kat@gmail.com
|
68
|
+
executables: []
|
69
|
+
extensions: []
|
70
|
+
extra_rdoc_files: []
|
71
|
+
files:
|
72
|
+
- lib/easyconf-rails.rb
|
73
|
+
homepage: https://github.com/katmagic/easyconf-rails
|
74
|
+
licenses: []
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.8.10
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: Easily configure Rails applications.
|
97
|
+
test_files: []
|
98
|
+
has_rdoc:
|
metadata.gz.sig
ADDED
Binary file
|