fast_config 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/fast_config.rb +26 -0
  3. metadata +58 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2VmNGVkZTE4YTQ0MzA5ODIzY2NmYTIxNTNkYmJjZWZiMjE3ZjlhMw==
5
+ data.tar.gz: !binary |-
6
+ ZjdiYjYzMDdhYmQxZmVjNmE1MDhmODk4YWYxNzRjOTdlMTYwNDUwYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MWNjZWZkODY3YWFjODIyM2I4ZDIyOGQ5OTg0ODVlYzk2MmNkZTcxN2MwODg1
10
+ NWYwYTU2YWU5N2ExOWEwNTRkYmZiNzg3YTc0N2U1Zjk1ZWEwODE4NjU3OTZm
11
+ ZDZmNjkzZGNhNjdkMTQxYjMxM2U2OTQ3ZTU2ZDQyOGYzNzIxYzE=
12
+ data.tar.gz: !binary |-
13
+ ZTFkNTRhMTU4Nzg3OTJmMTY5YmU2NWZkZWM0OGJlN2ZlZjUyYjI4MTczYTNi
14
+ NDhlYWQzYmE1NTY2NDQwN2ExNzhkZGY4MDY2ZTM2ZTJkNTRjNmY5YThkNDIy
15
+ NDY3MDVhYTMwYTk2MDNhZjA2OGNiZDkxMmM3MWQ4NTQwYTFlOGM=
@@ -0,0 +1,26 @@
1
+ require 'yaml'
2
+
3
+ module FastConfig
4
+ def self.extended(main_class)
5
+ configs = YAML.load_file(File.expand_path("config/#{snake_case(main_class)}.yml"))
6
+ configs[snake_case(main_class)].each{ |k,v| main_class.set(k.to_sym, v) }
7
+ super
8
+ end
9
+
10
+ @settings = {}
11
+ def settings
12
+ @settings ||= {}
13
+ end
14
+
15
+ def set(key, val)
16
+ settings[key] = val
17
+ end
18
+
19
+ def self.snake_case(camel_cased_word)
20
+ camel_cased_word.to_s.gsub(/::/, '_').
21
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
22
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
23
+ tr("-", "_").
24
+ downcase
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fast_config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Reister
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: Add default config files to projects just by including the gem.
28
+ email: chris@chrisreister.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/fast_config.rb
34
+ homepage: https://github.com/chrisftw/fast_config
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.2.2
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: FAST config files
58
+ test_files: []