appcfg 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/Gemfile +4 -9
- data/README.rdoc +6 -0
- data/Rakefile +0 -10
- data/VERSION +1 -1
- data/lib/appcfg.rb +1 -0
- data/lib/appcfg/source.rb +41 -23
- data/lib/appcfg/sources/properties_source.rb +61 -0
- data/lib/appcfg/sources/yaml_source.rb +2 -2
- data/spec/properties_source_spec.rb +75 -0
- data/spec/spec_helper.rb +7 -3
- data/spec/support/sample_config.properties +19 -0
- data/spec/support/sample_empty_config.properties +0 -0
- data/spec/support/sample_empty_config.yml +1 -0
- data/spec/support/sample_overlapping_config.yml +4 -0
- data/spec/yaml_source_spec.rb +60 -13
- metadata +81 -65
- data/Gemfile.lock +0 -30
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
3
|
group :development do
|
9
|
-
gem "rspec"
|
10
|
-
gem "bundler"
|
11
|
-
gem "jeweler"
|
12
|
-
gem 'simplecov'
|
4
|
+
gem "rspec"
|
5
|
+
gem "bundler"
|
6
|
+
gem "jeweler"
|
7
|
+
gem 'simplecov'
|
13
8
|
end
|
data/README.rdoc
CHANGED
@@ -14,6 +14,8 @@ A gem for centralizing different sources of application configuration data. Supp
|
|
14
14
|
|
15
15
|
[From hash object] AppCfg::Source.add({:some_key => 'value'})
|
16
16
|
|
17
|
+
[From .properties file (features missing! Refer to pending tests)] AppCfg::Source.add('/path/to/configuration.properties')
|
18
|
+
|
17
19
|
=== Accessing configuration values
|
18
20
|
|
19
21
|
Configuration data can be accessed via both object and hash syntax, called on AppCfg module:
|
@@ -48,6 +50,10 @@ Configuration values are cached at the moment of being added. If sources are mod
|
|
48
50
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
49
51
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
50
52
|
|
53
|
+
== Contributors
|
54
|
+
|
55
|
+
* lorrin (Lorrin Nelson)
|
56
|
+
|
51
57
|
== Copyright
|
52
58
|
|
53
59
|
Copyright (c) 2011 Toms Mikoss. See LICENSE.txt for
|
data/Rakefile
CHANGED
@@ -38,13 +38,3 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
38
38
|
end
|
39
39
|
|
40
40
|
task :default => :spec
|
41
|
-
|
42
|
-
require 'rake/rdoctask'
|
43
|
-
Rake::RDocTask.new do |rdoc|
|
44
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
-
|
46
|
-
rdoc.rdoc_dir = 'rdoc'
|
47
|
-
rdoc.title = "appcfg #{version}"
|
48
|
-
rdoc.rdoc_files.include('README*')
|
49
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/appcfg.rb
CHANGED
data/lib/appcfg/source.rb
CHANGED
@@ -5,24 +5,28 @@ module AppCfg
|
|
5
5
|
|
6
6
|
class Source
|
7
7
|
@@sources = []
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(options={})
|
10
10
|
@hash = options
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def to_hash
|
14
14
|
@hash
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def reload_data!
|
18
18
|
#Do nothing
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def self.add(source_object, options={})
|
22
22
|
if source_object.is_a?(String) && source_object[-4..-1] == '.yml'
|
23
23
|
#YAML
|
24
24
|
raise "File #{source_object} could not be located" unless File.exist? source_object
|
25
25
|
add_source(YamlSource.new(options.merge(:file => source_object)))
|
26
|
+
elsif source_object.is_a?(String) && source_object[-11..-1] == '.properties'
|
27
|
+
#.properties
|
28
|
+
raise "File #{source_object} could not be located" unless File.exist? source_object
|
29
|
+
add_source(PropertiesSource.new(options.merge(:file => source_object)))
|
26
30
|
elsif source_object.is_a?(Class) && source_object.respond_to?(:all)
|
27
31
|
#AR Model
|
28
32
|
add_source(ModelSource.new(options.merge(:class => source_object)))
|
@@ -38,44 +42,58 @@ module AppCfg
|
|
38
42
|
@@sources = []
|
39
43
|
reload_sources!
|
40
44
|
end
|
41
|
-
|
45
|
+
|
42
46
|
def self.list
|
43
47
|
@@sources
|
44
48
|
end
|
45
|
-
|
49
|
+
|
46
50
|
def self.reload_sources!
|
47
51
|
cache = {}
|
48
|
-
|
52
|
+
|
49
53
|
@@sources.each do |source|
|
50
54
|
source.reload_data!
|
51
|
-
cache = cache
|
55
|
+
cache = recursive_merge(cache, source.to_hash)
|
52
56
|
end
|
53
|
-
|
54
|
-
AppCfg.set_cache
|
57
|
+
|
58
|
+
AppCfg.set_cache add_key_methods cache
|
55
59
|
end
|
56
|
-
|
60
|
+
|
57
61
|
private
|
58
|
-
|
62
|
+
|
59
63
|
def self.add_source(source)
|
60
64
|
@@sources << source
|
61
65
|
reload_sources!
|
62
66
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
|
68
|
+
def self.recursive_merge(base, other)
|
69
|
+
other.each do |key, value|
|
70
|
+
if base[key].is_a?(Hash) && value.is_a?(Hash)
|
71
|
+
base[key] = recursive_merge(base[key], value)
|
72
|
+
else
|
73
|
+
base[key] = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
base
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.add_key_methods(base)
|
66
81
|
mod = Module.new do
|
67
|
-
|
82
|
+
base.each do |key, value|
|
68
83
|
define_method key do
|
69
|
-
value
|
84
|
+
value
|
70
85
|
end
|
71
86
|
end
|
72
87
|
end
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
88
|
+
|
89
|
+
base.extend mod
|
90
|
+
|
91
|
+
base.each do |key, value|
|
92
|
+
next unless value.is_a? Hash
|
93
|
+
base[key] = add_key_methods(value)
|
94
|
+
end
|
95
|
+
|
96
|
+
base
|
79
97
|
end
|
80
98
|
end
|
81
99
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module AppCfg
|
2
|
+
|
3
|
+
# TODO: consider treating . in properties names as a nesting operatator. E.g. maven.groupId=xyz creates AppCfg['maven'] = { 'groupId' => 'xyz' }
|
4
|
+
# TODO: environment support? Perhaps file-name convention or also with .-delimited properties names? E.g. maven.groupId.test
|
5
|
+
|
6
|
+
class PropertiesSource < Source
|
7
|
+
def initialize(options = {})
|
8
|
+
@filename = options[:file]
|
9
|
+
@namespace = options[:env]
|
10
|
+
end
|
11
|
+
|
12
|
+
def reload_data!
|
13
|
+
properties = JavaProperties.new(@filename)
|
14
|
+
@hash = properties.properties
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
# JavaProperties class from https://github.com/axic/rsnippets/blob/master/javaproperties.rb (originally from
|
20
|
+
# https://devender.wordpress.com/2006/05/01/reading-and-writing-java-property-files-with-ruby/)
|
21
|
+
#
|
22
|
+
# Consider splitting into own project and including as a gem. Some features missing: escape handling
|
23
|
+
# error handling, perhaps whitespace edge cases as well.
|
24
|
+
#
|
25
|
+
# Consider checking for presence of JRuby and invoking java.util.Properties if available.
|
26
|
+
class JavaProperties
|
27
|
+
attr_accessor :filename, :properties
|
28
|
+
|
29
|
+
def initialize(filename)
|
30
|
+
@filename = filename
|
31
|
+
@properties = {}
|
32
|
+
|
33
|
+
IO.foreach(@filename) do |line|
|
34
|
+
@properties[$1.strip] = $2 if line = ~ /([^=]*)=(.*)\/\/(.*)/ || line =~ /([^=]*)=(.*)/
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
output = "File name #{@file}\n"
|
40
|
+
@properties.each { |key, value| output += " #{key} = #{value}\n" }
|
41
|
+
output
|
42
|
+
end
|
43
|
+
|
44
|
+
def add(key, value = nil)
|
45
|
+
return unless key.length > 0
|
46
|
+
@properties[key] = value
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove(key)
|
50
|
+
return unless key.length > 0
|
51
|
+
@properties.delete(key)
|
52
|
+
end
|
53
|
+
|
54
|
+
def save
|
55
|
+
file = File.new(@filename, "w+")
|
56
|
+
@properties.each { |key, value| file.puts "#{key}=#{value}\n" }
|
57
|
+
file.close
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -6,8 +6,8 @@ module AppCfg
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def reload_data!
|
9
|
-
yaml_structure = YAML.load(File.open @filename)
|
10
|
-
@hash = @namespace ? yaml_structure[@namespace] : yaml_structure
|
9
|
+
yaml_structure = YAML.load(File.open @filename) || {} # empty hash instead of false when file is empty
|
10
|
+
@hash = @namespace ? yaml_structure[@namespace]||{} : yaml_structure
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "AppCfg retrieval from Properties" do
|
4
|
+
describe "not environment namespaced" do
|
5
|
+
before(:each) do
|
6
|
+
AppCfg::Source.add(@sample_properties_file_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should support hash syntax for access" do
|
10
|
+
AppCfg['app_name'].should == 'AppCfg'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should support object syntax for access" do
|
14
|
+
AppCfg.app_name.should == 'AppCfg'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return nil on non-existent key, hash syntax" do
|
18
|
+
AppCfg['wrong_key'].should be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should raise error on non-existent key, object syntax" do
|
22
|
+
lambda {
|
23
|
+
AppCfg.wrong_key
|
24
|
+
}.should raise_error
|
25
|
+
end
|
26
|
+
|
27
|
+
it "Should not trim trailing spaces" do
|
28
|
+
AppCfg['has'].should == "five trailing spaces "
|
29
|
+
end
|
30
|
+
|
31
|
+
context "TODO" do
|
32
|
+
before { pending "not yet supported" }
|
33
|
+
|
34
|
+
it "should allow multi-level access with hash syntax" do
|
35
|
+
AppCfg['admin_credentials']['username'].should == 'admin'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should allow multi-level access with object syntax" do
|
39
|
+
AppCfg.admin_credentials.username.should == 'admin'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should support colon-delimited properties" do
|
43
|
+
AppCfg['colon'].should == "another delimiter"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should trim spaces around delimiter" do
|
47
|
+
AppCfg["website"].should == "http://en.wikipedia.org/"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should support multi-line values" do
|
51
|
+
AppCfg["message"].should == "Welcome to Wikipedia!"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should support keys with spaces" do
|
55
|
+
AppCfg["key with spaces"].should == 'This is the value that could be looked up with the key "key with spaces".'
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should support Unicode escapes" do
|
59
|
+
AppCfg["tab"].should == "\t"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "AppCfg retrieval from empty properties" do
|
66
|
+
describe "not environment namespaced" do
|
67
|
+
before(:each) do
|
68
|
+
AppCfg::Source.add(@sample_properties_empty_file_path)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should load but be empty" do
|
72
|
+
AppCfg['app_name'].should == nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -15,10 +15,14 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
15
15
|
RSpec.configure do |config|
|
16
16
|
config.before(:each) do
|
17
17
|
AppCfg::Source.clear
|
18
|
-
@sample_env_yaml_file_path
|
19
|
-
@sample_yaml_file_path
|
18
|
+
@sample_env_yaml_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_env_config.yml')
|
19
|
+
@sample_yaml_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_config.yml')
|
20
|
+
@sample_yaml_empty_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_empty_config.yml')
|
21
|
+
@sample_properties_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_config.properties')
|
22
|
+
@sample_properties_empty_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_empty_config.properties')
|
23
|
+
@sample_overlapping_file_path = File.expand_path(File.dirname(__FILE__) + '/support/sample_overlapping_config.yml')
|
20
24
|
end
|
21
|
-
|
25
|
+
|
22
26
|
config.after(:each) do
|
23
27
|
SampleConfig.reset_storage!
|
24
28
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# From: https://secure.wikimedia.org/wikipedia/en/wiki/.properties
|
2
|
+
# You are reading the ".properties" entry.
|
3
|
+
! The exclamation mark can also mark text as comments.
|
4
|
+
website = http://en.wikipedia.org/
|
5
|
+
language = English
|
6
|
+
# The backslash below tells the application to continue reading
|
7
|
+
# the value onto the next line.
|
8
|
+
message = Welcome to \
|
9
|
+
Wikipedia!
|
10
|
+
# Add spaces to the key
|
11
|
+
key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
|
12
|
+
# Unicode
|
13
|
+
tab : \u0009
|
14
|
+
|
15
|
+
|
16
|
+
# More additions
|
17
|
+
colon:another delimiter
|
18
|
+
has=five trailing spaces
|
19
|
+
app_name=AppCfg
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# Nothing in here. YAML.load for this file will return false
|
data/spec/yaml_source_spec.rb
CHANGED
@@ -5,63 +5,110 @@ describe "AppCfg retrieval from YAML" do
|
|
5
5
|
before(:each) do
|
6
6
|
AppCfg::Source.add(@sample_yaml_file_path)
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
it "should support hash syntax for access" do
|
10
10
|
AppCfg['app_name'].should == 'AppCfg'
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "should support object syntax for access" do
|
14
14
|
AppCfg.app_name.should == 'AppCfg'
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should allow multi-level access with hash syntax" do
|
18
18
|
AppCfg['admin_credentials']['username'].should == 'admin'
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should allow multi-level access with object syntax" do
|
22
22
|
AppCfg.admin_credentials.username.should == 'admin'
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should return nil on non-existent key, hash syntax" do
|
26
26
|
AppCfg['wrong_key'].should be_nil
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should raise error on non-existent key, object syntax" do
|
30
30
|
lambda {
|
31
31
|
AppCfg.wrong_key
|
32
32
|
}.should raise_error
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
describe "environment namespaced" do
|
37
37
|
before(:each) do
|
38
38
|
AppCfg::Source.add(@sample_env_yaml_file_path, :env => 'test')
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "should support hash syntax for access" do
|
42
42
|
AppCfg['app_name'].should == 'AppCfg'
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should support object syntax for access" do
|
46
46
|
AppCfg.app_name.should == 'AppCfg'
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it "should allow multi-level access with hash syntax" do
|
50
50
|
AppCfg['admin_credentials']['password'].should == 'testpass'
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "should allow multi-level access with object syntax" do
|
54
54
|
AppCfg.admin_credentials.password.should == 'testpass'
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it "should return nil on non-existent key, hash syntax" do
|
58
58
|
AppCfg['wrong_key'].should be_nil
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it "should raise error on non-existent key, object syntax" do
|
62
62
|
lambda {
|
63
63
|
AppCfg.wrong_key
|
64
64
|
}.should raise_error
|
65
65
|
end
|
66
66
|
end
|
67
|
+
describe "environment namespaced (but namespace not found)" do
|
68
|
+
before(:each) do
|
69
|
+
AppCfg::Source.add(@sample_env_yaml_file_path, :env => 'bogus')
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should load but be empty" do
|
73
|
+
AppCfg['app_name'].should == nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "overlapping config files" do
|
78
|
+
before(:each) do
|
79
|
+
AppCfg::Source.add(@sample_yaml_file_path)
|
80
|
+
AppCfg::Source.add(@sample_overlapping_file_path)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should merge hashes" do
|
84
|
+
AppCfg.admin_credentials.username.should == 'admin'
|
85
|
+
AppCfg.admin_credentials.enabled.should be_false
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should overwrite values" do
|
89
|
+
AppCfg.worker_count.should eq 4
|
90
|
+
AppCfg.admin_credentials.password.should == 'newpass'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
describe "AppCfg retrieval from empty YAML" do
|
95
|
+
describe "not environment namespaced" do
|
96
|
+
before(:each) do
|
97
|
+
AppCfg::Source.add(@sample_yaml_empty_file_path)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should load but be empty" do
|
101
|
+
AppCfg['app_name'].should == nil
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "environment namespaced" do
|
106
|
+
before(:each) do
|
107
|
+
AppCfg::Source.add(@sample_yaml_empty_file_path, :env => 'test')
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should load but be empty" do
|
111
|
+
AppCfg['app_name'].should == nil
|
112
|
+
end
|
113
|
+
end
|
67
114
|
end
|
metadata
CHANGED
@@ -1,75 +1,93 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: appcfg
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Toms Mikoss
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
27
31
|
name: bundler
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: jeweler
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
45
54
|
type: :development
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: simplecov
|
50
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
51
65
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 0
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
56
70
|
type: :development
|
57
71
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: A gem for centralizing different sources of application configuration
|
79
|
+
data. Supports YAML files, ActiveRecord models and simple hashes as data sources.
|
60
80
|
email: toms.mikoss@gmail.com
|
61
81
|
executables: []
|
62
|
-
|
63
82
|
extensions: []
|
64
|
-
|
65
|
-
extra_rdoc_files:
|
83
|
+
extra_rdoc_files:
|
66
84
|
- LICENSE.txt
|
67
85
|
- README.rdoc
|
68
|
-
files:
|
86
|
+
files:
|
69
87
|
- .document
|
70
88
|
- .rspec
|
89
|
+
- .travis.yml
|
71
90
|
- Gemfile
|
72
|
-
- Gemfile.lock
|
73
91
|
- LICENSE.txt
|
74
92
|
- README.rdoc
|
75
93
|
- Rakefile
|
@@ -78,49 +96,47 @@ files:
|
|
78
96
|
- lib/appcfg/retrieval.rb
|
79
97
|
- lib/appcfg/source.rb
|
80
98
|
- lib/appcfg/sources/model_source.rb
|
99
|
+
- lib/appcfg/sources/properties_source.rb
|
81
100
|
- lib/appcfg/sources/yaml_source.rb
|
82
101
|
- spec/hash_source_config_spec.rb
|
83
102
|
- spec/model_source_spec.rb
|
103
|
+
- spec/properties_source_spec.rb
|
84
104
|
- spec/source_spec.rb
|
85
105
|
- spec/spec_helper.rb
|
86
106
|
- spec/support/classes/sample_config.rb
|
107
|
+
- spec/support/sample_config.properties
|
87
108
|
- spec/support/sample_config.yml
|
109
|
+
- spec/support/sample_empty_config.properties
|
110
|
+
- spec/support/sample_empty_config.yml
|
88
111
|
- spec/support/sample_env_config.yml
|
112
|
+
- spec/support/sample_overlapping_config.yml
|
89
113
|
- spec/yaml_source_spec.rb
|
90
114
|
homepage: http://github.com/tmikoss/appconfig
|
91
|
-
licenses:
|
115
|
+
licenses:
|
92
116
|
- MIT
|
93
117
|
post_install_message:
|
94
118
|
rdoc_options: []
|
95
|
-
|
96
|
-
require_paths:
|
119
|
+
require_paths:
|
97
120
|
- lib
|
98
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
122
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
segments:
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
segments:
|
105
128
|
- 0
|
106
|
-
|
107
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
hash: -1033711763
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
131
|
none: false
|
109
|
-
requirements:
|
110
|
-
- -
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version:
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
113
136
|
requirements: []
|
114
|
-
|
115
137
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.8.24
|
117
139
|
signing_key:
|
118
140
|
specification_version: 3
|
119
141
|
summary: A gem for centralizing different sources of application configuration data.
|
120
|
-
test_files:
|
121
|
-
- spec/hash_source_config_spec.rb
|
122
|
-
- spec/model_source_spec.rb
|
123
|
-
- spec/source_spec.rb
|
124
|
-
- spec/spec_helper.rb
|
125
|
-
- spec/support/classes/sample_config.rb
|
126
|
-
- spec/yaml_source_spec.rb
|
142
|
+
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.1.2)
|
5
|
-
git (1.2.5)
|
6
|
-
jeweler (1.5.2)
|
7
|
-
bundler (~> 1.0.0)
|
8
|
-
git (>= 1.2.5)
|
9
|
-
rake
|
10
|
-
rake (0.8.7)
|
11
|
-
rspec (2.3.0)
|
12
|
-
rspec-core (~> 2.3.0)
|
13
|
-
rspec-expectations (~> 2.3.0)
|
14
|
-
rspec-mocks (~> 2.3.0)
|
15
|
-
rspec-core (2.3.1)
|
16
|
-
rspec-expectations (2.3.0)
|
17
|
-
diff-lcs (~> 1.1.2)
|
18
|
-
rspec-mocks (2.3.0)
|
19
|
-
simplecov (0.4.2)
|
20
|
-
simplecov-html (~> 0.4.4)
|
21
|
-
simplecov-html (0.4.4)
|
22
|
-
|
23
|
-
PLATFORMS
|
24
|
-
ruby
|
25
|
-
|
26
|
-
DEPENDENCIES
|
27
|
-
bundler (~> 1.0.0)
|
28
|
-
jeweler (~> 1.5.2)
|
29
|
-
rspec (~> 2.3.0)
|
30
|
-
simplecov (>= 0.4.0)
|