configy 0.0.4 → 1.0.0

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.
@@ -0,0 +1,59 @@
1
+ unless Hash.new.respond_to?(:deep_merge)
2
+ class Hash
3
+ # Returns a new hash with +self+ and +other_hash+ merged recursively.
4
+ def deep_merge(other_hash)
5
+ dup.deep_merge!(other_hash)
6
+ end
7
+
8
+ # Returns a new hash with +self+ and +other_hash+ merged recursively.
9
+ # Modifies the receiver in place.
10
+ def deep_merge!(other_hash)
11
+ other_hash.each_pair do |k,v|
12
+ tv = self[k]
13
+ self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v
14
+ end
15
+ self
16
+ end
17
+ end
18
+ end
19
+
20
+ module Configy
21
+ class ConfigStore
22
+ attr_reader :config
23
+ attr_accessor :mtime
24
+
25
+ # Takes a Hash as input
26
+ def initialize(config)
27
+ @config = config && config.to_hash || {}
28
+ end
29
+
30
+ # Returns a new ConfigStore by merging `common` with `section`
31
+ def compile(section)
32
+ common = @config['common'] || {}
33
+ selected = @config[section] || {}
34
+
35
+ self.class.new( common.deep_merge(selected) )
36
+ end
37
+
38
+ # Merges two ConfigStore objects together by merging their hashes
39
+ def merge(other)
40
+ self.class.new( config.deep_merge(other.config) )
41
+ end
42
+
43
+ # Access to the stored configs
44
+ def [](key)
45
+ key = key.to_s
46
+
47
+ if @config.key?(key)
48
+ @config[key]
49
+ else
50
+ raise ConfigParamNotFound, key
51
+ end
52
+ end
53
+
54
+ def to_hash
55
+ @config
56
+ end
57
+ end
58
+ end
59
+
@@ -0,0 +1,1255 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 89
13
+ 45
14
+ 0
15
+ 1
16
+ 13
17
+ 71
18
+ 2
19
+ 47
20
+ 9
21
+ 21
22
+ 47
23
+ 49
24
+ 3
25
+ 0
26
+ 13
27
+ 47
28
+ 49
29
+ 4
30
+ 0
31
+ 15
32
+ 8
33
+ 24
34
+ 49
35
+ 2
36
+ 0
37
+ 7
38
+ 5
39
+ 49
40
+ 6
41
+ 1
42
+ 9
43
+ 34
44
+ 1
45
+ 8
46
+ 60
47
+ 99
48
+ 7
49
+ 0
50
+ 1
51
+ 65
52
+ 49
53
+ 7
54
+ 3
55
+ 13
56
+ 99
57
+ 12
58
+ 7
59
+ 8
60
+ 12
61
+ 7
62
+ 9
63
+ 12
64
+ 65
65
+ 12
66
+ 49
67
+ 10
68
+ 4
69
+ 15
70
+ 49
71
+ 8
72
+ 0
73
+ 15
74
+ 99
75
+ 7
76
+ 11
77
+ 65
78
+ 49
79
+ 12
80
+ 2
81
+ 13
82
+ 99
83
+ 12
84
+ 7
85
+ 13
86
+ 12
87
+ 7
88
+ 14
89
+ 12
90
+ 65
91
+ 12
92
+ 49
93
+ 10
94
+ 4
95
+ 15
96
+ 49
97
+ 13
98
+ 0
99
+ 15
100
+ 2
101
+ 11
102
+ I
103
+ 6
104
+ I
105
+ 0
106
+ I
107
+ 0
108
+ I
109
+ 0
110
+ n
111
+ p
112
+ 15
113
+ x
114
+ 4
115
+ Hash
116
+ n
117
+ x
118
+ 3
119
+ new
120
+ x
121
+ 8
122
+ allocate
123
+ x
124
+ 10
125
+ initialize
126
+ x
127
+ 10
128
+ deep_merge
129
+ x
130
+ 11
131
+ respond_to?
132
+ x
133
+ 10
134
+ open_class
135
+ x
136
+ 14
137
+ __class_init__
138
+ M
139
+ 1
140
+ n
141
+ n
142
+ x
143
+ 4
144
+ Hash
145
+ i
146
+ 30
147
+ 5
148
+ 66
149
+ 99
150
+ 7
151
+ 0
152
+ 7
153
+ 1
154
+ 65
155
+ 67
156
+ 49
157
+ 2
158
+ 0
159
+ 49
160
+ 3
161
+ 4
162
+ 15
163
+ 99
164
+ 7
165
+ 4
166
+ 7
167
+ 5
168
+ 65
169
+ 67
170
+ 49
171
+ 2
172
+ 0
173
+ 49
174
+ 3
175
+ 4
176
+ 11
177
+ I
178
+ 5
179
+ I
180
+ 0
181
+ I
182
+ 0
183
+ I
184
+ 0
185
+ n
186
+ p
187
+ 6
188
+ x
189
+ 10
190
+ deep_merge
191
+ M
192
+ 1
193
+ n
194
+ n
195
+ x
196
+ 10
197
+ deep_merge
198
+ i
199
+ 9
200
+ 5
201
+ 48
202
+ 0
203
+ 20
204
+ 0
205
+ 49
206
+ 1
207
+ 1
208
+ 11
209
+ I
210
+ 3
211
+ I
212
+ 1
213
+ I
214
+ 1
215
+ I
216
+ 1
217
+ n
218
+ p
219
+ 2
220
+ x
221
+ 3
222
+ dup
223
+ x
224
+ 11
225
+ deep_merge!
226
+ p
227
+ 5
228
+ I
229
+ 0
230
+ I
231
+ 4
232
+ I
233
+ 0
234
+ I
235
+ 5
236
+ I
237
+ 9
238
+ x
239
+ 68
240
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
241
+ p
242
+ 1
243
+ x
244
+ 10
245
+ other_hash
246
+ x
247
+ 17
248
+ method_visibility
249
+ x
250
+ 15
251
+ add_defn_method
252
+ x
253
+ 11
254
+ deep_merge!
255
+ M
256
+ 1
257
+ n
258
+ n
259
+ x
260
+ 11
261
+ deep_merge!
262
+ i
263
+ 10
264
+ 20
265
+ 0
266
+ 56
267
+ 0
268
+ 50
269
+ 1
270
+ 0
271
+ 15
272
+ 5
273
+ 11
274
+ I
275
+ 3
276
+ I
277
+ 1
278
+ I
279
+ 1
280
+ I
281
+ 1
282
+ n
283
+ p
284
+ 2
285
+ M
286
+ 1
287
+ p
288
+ 2
289
+ x
290
+ 9
291
+ for_block
292
+ t
293
+ n
294
+ x
295
+ 11
296
+ deep_merge!
297
+ i
298
+ 65
299
+ 58
300
+ 37
301
+ 19
302
+ 0
303
+ 15
304
+ 37
305
+ 19
306
+ 1
307
+ 15
308
+ 15
309
+ 5
310
+ 20
311
+ 0
312
+ 47
313
+ 49
314
+ 0
315
+ 1
316
+ 19
317
+ 2
318
+ 15
319
+ 5
320
+ 20
321
+ 0
322
+ 20
323
+ 2
324
+ 45
325
+ 1
326
+ 2
327
+ 49
328
+ 3
329
+ 1
330
+ 13
331
+ 9
332
+ 43
333
+ 15
334
+ 20
335
+ 1
336
+ 45
337
+ 1
338
+ 4
339
+ 49
340
+ 3
341
+ 1
342
+ 9
343
+ 54
344
+ 20
345
+ 2
346
+ 20
347
+ 1
348
+ 49
349
+ 5
350
+ 1
351
+ 8
352
+ 56
353
+ 20
354
+ 1
355
+ 13
356
+ 18
357
+ 3
358
+ 47
359
+ 49
360
+ 6
361
+ 2
362
+ 15
363
+ 11
364
+ I
365
+ 8
366
+ I
367
+ 3
368
+ I
369
+ 2
370
+ I
371
+ 2
372
+ n
373
+ p
374
+ 7
375
+ x
376
+ 2
377
+ []
378
+ x
379
+ 4
380
+ Hash
381
+ n
382
+ x
383
+ 5
384
+ is_a?
385
+ n
386
+ x
387
+ 10
388
+ deep_merge
389
+ x
390
+ 3
391
+ []=
392
+ p
393
+ 9
394
+ I
395
+ 0
396
+ I
397
+ b
398
+ I
399
+ a
400
+ I
401
+ c
402
+ I
403
+ 14
404
+ I
405
+ 3b
406
+ I
407
+ 15
408
+ I
409
+ d
410
+ I
411
+ 41
412
+ x
413
+ 68
414
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
415
+ p
416
+ 3
417
+ x
418
+ 1
419
+ k
420
+ x
421
+ 1
422
+ v
423
+ x
424
+ 2
425
+ tv
426
+ x
427
+ 9
428
+ each_pair
429
+ p
430
+ 7
431
+ I
432
+ 0
433
+ I
434
+ a
435
+ I
436
+ 0
437
+ I
438
+ b
439
+ I
440
+ 8
441
+ I
442
+ f
443
+ I
444
+ a
445
+ x
446
+ 68
447
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
448
+ p
449
+ 1
450
+ x
451
+ 10
452
+ other_hash
453
+ p
454
+ 5
455
+ I
456
+ 2
457
+ I
458
+ 4
459
+ I
460
+ 10
461
+ I
462
+ a
463
+ I
464
+ 1e
465
+ x
466
+ 68
467
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
468
+ p
469
+ 0
470
+ x
471
+ 13
472
+ attach_method
473
+ x
474
+ 7
475
+ Configy
476
+ x
477
+ 11
478
+ open_module
479
+ x
480
+ 15
481
+ __module_init__
482
+ M
483
+ 1
484
+ n
485
+ n
486
+ x
487
+ 7
488
+ Configy
489
+ i
490
+ 29
491
+ 5
492
+ 66
493
+ 99
494
+ 7
495
+ 0
496
+ 1
497
+ 65
498
+ 49
499
+ 1
500
+ 3
501
+ 13
502
+ 99
503
+ 12
504
+ 7
505
+ 2
506
+ 12
507
+ 7
508
+ 3
509
+ 12
510
+ 65
511
+ 12
512
+ 49
513
+ 4
514
+ 4
515
+ 15
516
+ 49
517
+ 2
518
+ 0
519
+ 11
520
+ I
521
+ 6
522
+ I
523
+ 0
524
+ I
525
+ 0
526
+ I
527
+ 0
528
+ n
529
+ p
530
+ 5
531
+ x
532
+ 11
533
+ ConfigStore
534
+ x
535
+ 10
536
+ open_class
537
+ x
538
+ 14
539
+ __class_init__
540
+ M
541
+ 1
542
+ n
543
+ n
544
+ x
545
+ 11
546
+ ConfigStore
547
+ i
548
+ 88
549
+ 5
550
+ 66
551
+ 5
552
+ 7
553
+ 0
554
+ 47
555
+ 49
556
+ 1
557
+ 1
558
+ 15
559
+ 5
560
+ 7
561
+ 2
562
+ 47
563
+ 49
564
+ 3
565
+ 1
566
+ 15
567
+ 99
568
+ 7
569
+ 4
570
+ 7
571
+ 5
572
+ 65
573
+ 67
574
+ 49
575
+ 6
576
+ 0
577
+ 49
578
+ 7
579
+ 4
580
+ 15
581
+ 99
582
+ 7
583
+ 8
584
+ 7
585
+ 9
586
+ 65
587
+ 67
588
+ 49
589
+ 6
590
+ 0
591
+ 49
592
+ 7
593
+ 4
594
+ 15
595
+ 99
596
+ 7
597
+ 10
598
+ 7
599
+ 11
600
+ 65
601
+ 67
602
+ 49
603
+ 6
604
+ 0
605
+ 49
606
+ 7
607
+ 4
608
+ 15
609
+ 99
610
+ 7
611
+ 12
612
+ 7
613
+ 13
614
+ 65
615
+ 67
616
+ 49
617
+ 6
618
+ 0
619
+ 49
620
+ 7
621
+ 4
622
+ 15
623
+ 99
624
+ 7
625
+ 14
626
+ 7
627
+ 15
628
+ 65
629
+ 67
630
+ 49
631
+ 6
632
+ 0
633
+ 49
634
+ 7
635
+ 4
636
+ 11
637
+ I
638
+ 5
639
+ I
640
+ 0
641
+ I
642
+ 0
643
+ I
644
+ 0
645
+ n
646
+ p
647
+ 16
648
+ x
649
+ 6
650
+ config
651
+ x
652
+ 11
653
+ attr_reader
654
+ x
655
+ 5
656
+ mtime
657
+ x
658
+ 13
659
+ attr_accessor
660
+ x
661
+ 10
662
+ initialize
663
+ M
664
+ 1
665
+ n
666
+ n
667
+ x
668
+ 10
669
+ initialize
670
+ i
671
+ 25
672
+ 20
673
+ 0
674
+ 13
675
+ 9
676
+ 11
677
+ 15
678
+ 20
679
+ 0
680
+ 49
681
+ 0
682
+ 0
683
+ 13
684
+ 10
685
+ 22
686
+ 15
687
+ 44
688
+ 43
689
+ 1
690
+ 78
691
+ 49
692
+ 2
693
+ 1
694
+ 38
695
+ 3
696
+ 11
697
+ I
698
+ 3
699
+ I
700
+ 1
701
+ I
702
+ 1
703
+ I
704
+ 1
705
+ n
706
+ p
707
+ 4
708
+ x
709
+ 7
710
+ to_hash
711
+ x
712
+ 4
713
+ Hash
714
+ x
715
+ 16
716
+ new_from_literal
717
+ x
718
+ 7
719
+ @config
720
+ p
721
+ 5
722
+ I
723
+ 0
724
+ I
725
+ 1a
726
+ I
727
+ 0
728
+ I
729
+ 1b
730
+ I
731
+ 19
732
+ x
733
+ 68
734
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
735
+ p
736
+ 1
737
+ x
738
+ 6
739
+ config
740
+ x
741
+ 17
742
+ method_visibility
743
+ x
744
+ 15
745
+ add_defn_method
746
+ x
747
+ 7
748
+ compile
749
+ M
750
+ 1
751
+ n
752
+ n
753
+ x
754
+ 7
755
+ compile
756
+ i
757
+ 83
758
+ 39
759
+ 0
760
+ 7
761
+ 1
762
+ 64
763
+ 49
764
+ 2
765
+ 1
766
+ 13
767
+ 10
768
+ 19
769
+ 15
770
+ 44
771
+ 43
772
+ 3
773
+ 78
774
+ 49
775
+ 4
776
+ 1
777
+ 19
778
+ 1
779
+ 15
780
+ 39
781
+ 0
782
+ 20
783
+ 0
784
+ 49
785
+ 2
786
+ 1
787
+ 13
788
+ 10
789
+ 40
790
+ 15
791
+ 44
792
+ 43
793
+ 3
794
+ 78
795
+ 49
796
+ 4
797
+ 1
798
+ 19
799
+ 2
800
+ 15
801
+ 5
802
+ 49
803
+ 5
804
+ 0
805
+ 13
806
+ 71
807
+ 6
808
+ 47
809
+ 9
810
+ 72
811
+ 47
812
+ 49
813
+ 7
814
+ 0
815
+ 13
816
+ 20
817
+ 1
818
+ 20
819
+ 2
820
+ 49
821
+ 8
822
+ 1
823
+ 47
824
+ 49
825
+ 9
826
+ 1
827
+ 15
828
+ 8
829
+ 82
830
+ 20
831
+ 1
832
+ 20
833
+ 2
834
+ 49
835
+ 8
836
+ 1
837
+ 49
838
+ 6
839
+ 1
840
+ 11
841
+ I
842
+ 7
843
+ I
844
+ 3
845
+ I
846
+ 1
847
+ I
848
+ 1
849
+ n
850
+ p
851
+ 10
852
+ x
853
+ 7
854
+ @config
855
+ s
856
+ 6
857
+ common
858
+ x
859
+ 2
860
+ []
861
+ x
862
+ 4
863
+ Hash
864
+ x
865
+ 16
866
+ new_from_literal
867
+ x
868
+ 5
869
+ class
870
+ x
871
+ 3
872
+ new
873
+ x
874
+ 8
875
+ allocate
876
+ x
877
+ 10
878
+ deep_merge
879
+ x
880
+ 10
881
+ initialize
882
+ p
883
+ 9
884
+ I
885
+ 0
886
+ I
887
+ 1f
888
+ I
889
+ 0
890
+ I
891
+ 20
892
+ I
893
+ 16
894
+ I
895
+ 21
896
+ I
897
+ 2b
898
+ I
899
+ 23
900
+ I
901
+ 53
902
+ x
903
+ 68
904
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
905
+ p
906
+ 3
907
+ x
908
+ 7
909
+ section
910
+ x
911
+ 6
912
+ common
913
+ x
914
+ 8
915
+ selected
916
+ x
917
+ 5
918
+ merge
919
+ M
920
+ 1
921
+ n
922
+ n
923
+ x
924
+ 5
925
+ merge
926
+ i
927
+ 48
928
+ 5
929
+ 49
930
+ 0
931
+ 0
932
+ 13
933
+ 71
934
+ 1
935
+ 47
936
+ 9
937
+ 33
938
+ 47
939
+ 49
940
+ 2
941
+ 0
942
+ 13
943
+ 5
944
+ 48
945
+ 3
946
+ 20
947
+ 0
948
+ 49
949
+ 3
950
+ 0
951
+ 49
952
+ 4
953
+ 1
954
+ 47
955
+ 49
956
+ 5
957
+ 1
958
+ 15
959
+ 8
960
+ 47
961
+ 5
962
+ 48
963
+ 3
964
+ 20
965
+ 0
966
+ 49
967
+ 3
968
+ 0
969
+ 49
970
+ 4
971
+ 1
972
+ 49
973
+ 1
974
+ 1
975
+ 11
976
+ I
977
+ 5
978
+ I
979
+ 1
980
+ I
981
+ 1
982
+ I
983
+ 1
984
+ n
985
+ p
986
+ 6
987
+ x
988
+ 5
989
+ class
990
+ x
991
+ 3
992
+ new
993
+ x
994
+ 8
995
+ allocate
996
+ x
997
+ 6
998
+ config
999
+ x
1000
+ 10
1001
+ deep_merge
1002
+ x
1003
+ 10
1004
+ initialize
1005
+ p
1006
+ 5
1007
+ I
1008
+ 0
1009
+ I
1010
+ 27
1011
+ I
1012
+ 0
1013
+ I
1014
+ 28
1015
+ I
1016
+ 30
1017
+ x
1018
+ 68
1019
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1020
+ p
1021
+ 1
1022
+ x
1023
+ 5
1024
+ other
1025
+ x
1026
+ 2
1027
+ []
1028
+ M
1029
+ 1
1030
+ n
1031
+ n
1032
+ x
1033
+ 2
1034
+ []
1035
+ i
1036
+ 37
1037
+ 20
1038
+ 0
1039
+ 49
1040
+ 0
1041
+ 0
1042
+ 19
1043
+ 0
1044
+ 15
1045
+ 39
1046
+ 1
1047
+ 20
1048
+ 0
1049
+ 49
1050
+ 2
1051
+ 1
1052
+ 9
1053
+ 26
1054
+ 39
1055
+ 1
1056
+ 20
1057
+ 0
1058
+ 49
1059
+ 3
1060
+ 1
1061
+ 8
1062
+ 36
1063
+ 5
1064
+ 45
1065
+ 4
1066
+ 5
1067
+ 20
1068
+ 0
1069
+ 47
1070
+ 49
1071
+ 6
1072
+ 2
1073
+ 11
1074
+ I
1075
+ 4
1076
+ I
1077
+ 1
1078
+ I
1079
+ 1
1080
+ I
1081
+ 1
1082
+ n
1083
+ p
1084
+ 7
1085
+ x
1086
+ 4
1087
+ to_s
1088
+ x
1089
+ 7
1090
+ @config
1091
+ x
1092
+ 4
1093
+ key?
1094
+ x
1095
+ 2
1096
+ []
1097
+ x
1098
+ 19
1099
+ ConfigParamNotFound
1100
+ n
1101
+ x
1102
+ 5
1103
+ raise
1104
+ p
1105
+ 11
1106
+ I
1107
+ 0
1108
+ I
1109
+ 2c
1110
+ I
1111
+ 0
1112
+ I
1113
+ 2d
1114
+ I
1115
+ 8
1116
+ I
1117
+ 2f
1118
+ I
1119
+ 11
1120
+ I
1121
+ 30
1122
+ I
1123
+ 1a
1124
+ I
1125
+ 32
1126
+ I
1127
+ 25
1128
+ x
1129
+ 68
1130
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1131
+ p
1132
+ 1
1133
+ x
1134
+ 3
1135
+ key
1136
+ x
1137
+ 7
1138
+ to_hash
1139
+ M
1140
+ 1
1141
+ n
1142
+ n
1143
+ x
1144
+ 7
1145
+ to_hash
1146
+ i
1147
+ 3
1148
+ 39
1149
+ 0
1150
+ 11
1151
+ I
1152
+ 1
1153
+ I
1154
+ 0
1155
+ I
1156
+ 0
1157
+ I
1158
+ 0
1159
+ n
1160
+ p
1161
+ 1
1162
+ x
1163
+ 7
1164
+ @config
1165
+ p
1166
+ 5
1167
+ I
1168
+ 0
1169
+ I
1170
+ 36
1171
+ I
1172
+ 0
1173
+ I
1174
+ 37
1175
+ I
1176
+ 3
1177
+ x
1178
+ 68
1179
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1180
+ p
1181
+ 0
1182
+ p
1183
+ 15
1184
+ I
1185
+ 2
1186
+ I
1187
+ 16
1188
+ I
1189
+ a
1190
+ I
1191
+ 17
1192
+ I
1193
+ 12
1194
+ I
1195
+ 1a
1196
+ I
1197
+ 20
1198
+ I
1199
+ 1f
1200
+ I
1201
+ 2e
1202
+ I
1203
+ 27
1204
+ I
1205
+ 3c
1206
+ I
1207
+ 2c
1208
+ I
1209
+ 4a
1210
+ I
1211
+ 36
1212
+ I
1213
+ 58
1214
+ x
1215
+ 68
1216
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1217
+ p
1218
+ 0
1219
+ x
1220
+ 13
1221
+ attach_method
1222
+ p
1223
+ 3
1224
+ I
1225
+ 2
1226
+ I
1227
+ 15
1228
+ I
1229
+ 1d
1230
+ x
1231
+ 68
1232
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1233
+ p
1234
+ 0
1235
+ p
1236
+ 7
1237
+ I
1238
+ 0
1239
+ I
1240
+ 1
1241
+ I
1242
+ 22
1243
+ I
1244
+ 2
1245
+ I
1246
+ 3d
1247
+ I
1248
+ 14
1249
+ I
1250
+ 59
1251
+ x
1252
+ 68
1253
+ /Users/gabevarela/work/ruby/gems/configy/lib/configy/config_store.rb
1254
+ p
1255
+ 0