configer 2.0.0 → 2.1.0

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: 6424137c1e704d889527669ee3a3ebab41e17e4a
4
- data.tar.gz: 8ab963a91032799c5bcedc81bdb227fbe9d6effd
3
+ metadata.gz: 319ccc0f4db308c48bc26630e62a31df398a3d1c
4
+ data.tar.gz: 25f5c9f7553c178ec09ee8397591c7df8a2860e4
5
5
  SHA512:
6
- metadata.gz: 50f6e1ca2b408ff17e523365fa4836e33c5bb93d60814c925d1190b2210c5dd2fd9866862b2b06e1c80c5e08e8644d98779cc697448d47429676f2f9511b95cd
7
- data.tar.gz: 4716dc327b3d12a2306457be19c63555a76a4f64abb404a0bf2bdd5ccf87beccdd50c4d10ac8e4589c137e17ac4fc929f178e49f0fef8248c81adf709ac11a48
6
+ metadata.gz: f93a48ba980148e083d2ca96160005976299e73fc0ccc12845312c17fe31b73f0e467d7ed5ea0cf1b30fdd99f7bba3a7b6fe43ed47641849a2cff0cdf45cf6a7
7
+ data.tar.gz: e49161bf12d26693468a7b552357e0aa786c703b3d134b7d9de5881b9cebd0bebdcba0ce2f6907cdb7c29be392718cf153e96ecc10d0df9efd6c15d13f9288eb
data/README.md CHANGED
@@ -14,23 +14,23 @@ creating meta config files, that should be loaded into the application.
14
14
 
15
15
  Configer follow the traditional ways in this field, and use the following Filesystem logic:
16
16
 
17
- mounting configuration files as they are
17
+ #### mounting configuration files as they are
18
18
 
19
19
  ./project_dir/config/*
20
20
 
21
- mounting environment configuration file as they are based on the current envernioment stage (development,test,production,staging)
21
+ #### mounting environment configuration file as they are based on the current envernioment stage (development,test,production,staging)
22
22
  * envirnomens folder name can be also envs/env/environment
23
23
 
24
24
  ./project_dir/config/environments/*
25
25
 
26
- mounting configuration files from lib/meta folder.
26
+ #### mounting configuration files from lib/meta folder.
27
27
  * Each config file name will be a "key" in the main config object
28
28
  * same goes with the folders in the meta file
29
29
  * the serialized object will be the value
30
30
 
31
31
  ./project_dir/lib/meta/**/*
32
32
 
33
- mounting configuration files from lib/module_name/meta folder.
33
+ #### mounting configuration files from lib/module_name/meta folder.
34
34
  * Each config file name will be a "key" in the config object that is located under the module_name key in the main config object
35
35
  * same goes with the folders in the meta file
36
36
  * the serialized object will be the value
@@ -38,34 +38,41 @@ mounting configuration files from lib/module_name/meta folder.
38
38
  ./project_dir/lib/module_name/meta/**/*
39
39
 
40
40
 
41
- The meta folder name can be aliased with META
41
+ #### The meta folder name can be aliased with META
42
42
 
43
- #### example
43
+ ### example
44
44
 
45
45
  in the /test/sample_root you can see an example
46
46
 
47
- #### Lazy Config object
47
+ ### Lazy Config object
48
48
 
49
49
  The __config__ object will not be generated util it's being called.
50
50
 
51
- #### Instance
51
+ ### Instance
52
52
 
53
53
  config object can be made into simple instance, based on argument passed folder path
54
54
 
55
- #### ERB support
55
+ ### ERB support
56
56
 
57
57
  config files support ERB parsing if the file contain .erb extension in the name
58
58
 
59
- #### Supported Serializations
59
+ ### Supported Serializations
60
60
 
61
61
  the current supported parsing logic are Yaml and JSON, that could be mixed with ERB
62
62
 
63
63
  ### example
64
64
 
65
- __config__.grape.defaults #> return the config object that is located under {"grape"=>{"defaults"=>{...}}}
65
+ ```ruby
66
+
67
+ __config__.grape.defaults
68
+ #> return the config object that is located under {"grape"=>{"defaults"=>{...}}}
69
+
70
+ ```
66
71
 
67
72
  ### after words
68
73
 
69
- I personally say, put everything into the lib/gem_name/meta/**/* so you can have auto separated configs for each gem/module
74
+ I personally say, put everything into the lib/gem_name/meta/**/* so you can have auto separated configs for each gem/module,
75
+ and when you need specify some env based value, than put that one into the config/env and you "monkey-patch" the object with that,
76
+ instead of replacing.
70
77
 
71
78
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -5,9 +5,11 @@ module Configer
5
5
  def pwd
6
6
 
7
7
  if defined?(Rails) && !Rails.root.nil?
8
- return Rails.root.to_s
8
+ Rails.root.to_s
9
+ elsif ENV['BUNDLE_GEMFILE']
10
+ ENV['BUNDLE_GEMFILE'].split(File::Separator)[0..-2].join(File::Separator)
9
11
  else
10
- return Dir.pwd.to_s
12
+ Dir.pwd.to_s
11
13
  end
12
14
 
13
15
  end
@@ -51,4 +53,4 @@ module Configer
51
53
  end
52
54
 
53
55
  end
54
- end
56
+ end
@@ -0,0 +1 @@
1
+ {"hy":<%= Random.rand %>}
@@ -0,0 +1 @@
1
+ erb_sample: <%= Random.rand %>
@@ -0,0 +1 @@
1
+ sample: <%= Random.rand %>
@@ -26,6 +26,11 @@ describe 'configer' do
26
26
  __config__.module_name.module_name_key.hello.must_be_instance_of Float
27
27
  __config__.sub_key.must_be_instance_of Float
28
28
 
29
+ __config__.test.erb_sample.must_be_instance_of Float
30
+ __config__.dunno.yep.hy.must_be_instance_of Float
31
+
32
+ __config__.sample.sub_key_folder.test.sample.must_be_instance_of Float
33
+
29
34
  #> config/env
30
35
  if Configer.env == 'development'
31
36
  __config__.development_key.must_be :==, 'yep'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-11 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,9 +64,12 @@ files:
64
64
  - test/sample_root/config/defaults.erb.yml
65
65
  - test/sample_root/config/environments/development.yml
66
66
  - test/sample_root/config/erb_test.yml.erb
67
+ - test/sample_root/lib/meta/dunno/yep.json.erb
67
68
  - test/sample_root/lib/meta/module_name.yml
69
+ - test/sample_root/lib/meta/test.yml.erb
68
70
  - test/sample_root/lib/sample/meta/config.yml
69
71
  - test/sample_root/lib/sample/meta/string.yml
72
+ - test/sample_root/lib/sample/meta/sub_key_folder/test.yml.erb
70
73
  - test/test_all.rb
71
74
  - test/test_config_object.rb
72
75
  - test/test_helper.rb
@@ -98,11 +101,13 @@ test_files:
98
101
  - test/sample_root/config/defaults.erb.yml
99
102
  - test/sample_root/config/environments/development.yml
100
103
  - test/sample_root/config/erb_test.yml.erb
104
+ - test/sample_root/lib/meta/dunno/yep.json.erb
101
105
  - test/sample_root/lib/meta/module_name.yml
106
+ - test/sample_root/lib/meta/test.yml.erb
102
107
  - test/sample_root/lib/sample/meta/config.yml
103
108
  - test/sample_root/lib/sample/meta/string.yml
109
+ - test/sample_root/lib/sample/meta/sub_key_folder/test.yml.erb
104
110
  - test/test_all.rb
105
111
  - test/test_config_object.rb
106
112
  - test/test_helper.rb
107
113
  - test/test_instance.rb
108
- has_rdoc: