econfig 0.1.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.
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +132 -0
- data/Rakefile +1 -0
- data/econfig.gemspec +24 -0
- data/lib/econfig.rb +28 -0
- data/lib/econfig/active_record.rb +25 -0
- data/lib/econfig/configuration.rb +35 -0
- data/lib/econfig/env.rb +7 -0
- data/lib/econfig/memory.rb +17 -0
- data/lib/econfig/rails.rb +12 -0
- data/lib/econfig/redis.rb +15 -0
- data/lib/econfig/shortcut.rb +11 -0
- data/lib/econfig/version.rb +3 -0
- data/lib/econfig/yaml.rb +21 -0
- data/lib/generators/econfig/migration/USAGE +8 -0
- data/lib/generators/econfig/migration/migration_generator.rb +16 -0
- data/lib/generators/econfig/migration/templates/migration.rb +13 -0
- data/spec/active_record_spec.rb +42 -0
- data/spec/config/app.yml +2 -0
- data/spec/configuration_spec.rb +78 -0
- data/spec/env_spec.rb +9 -0
- data/spec/memory_spec.rb +9 -0
- data/spec/redis_spec.rb +32 -0
- data/spec/shortcut_spec.rb +16 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/yaml_spec.rb +17 -0
- metadata +151 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-r spec_helper
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Jonas Nicklas, Elabs AB
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Econfig
|
2
|
+
|
3
|
+
Econfig is a gem which allows you to easily configure your Rails applications
|
4
|
+
in a multitude of ways.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this to your gemfile:
|
9
|
+
|
10
|
+
``` ruby
|
11
|
+
gem "econfig", :require => "econfig/rails"
|
12
|
+
```
|
13
|
+
|
14
|
+
## Accessing config options
|
15
|
+
|
16
|
+
Econfig extends the Rails configuration, you can use it like this:
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
MyApp::Application.config.app.aws_access_key
|
20
|
+
```
|
21
|
+
|
22
|
+
Where `MyApp` is the name of your application and `aws_access_key` is whatever
|
23
|
+
property you want to access. We recommend you add the shortcut module so you
|
24
|
+
can access config options directly:
|
25
|
+
|
26
|
+
``` ruby
|
27
|
+
module MyApp
|
28
|
+
extend Econfig::Shortcut
|
29
|
+
|
30
|
+
…
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
In `config/application.rb`. This will give you:
|
35
|
+
|
36
|
+
``` ruby
|
37
|
+
MyApp.aws_access_key_id
|
38
|
+
```
|
39
|
+
|
40
|
+
which is obviously way more convenient. The rest of this README is going to
|
41
|
+
assume that you added this shortcut.
|
42
|
+
|
43
|
+
## Forcing an option to exist
|
44
|
+
|
45
|
+
Sometimes you want the application to crash early when a given config option is
|
46
|
+
not set. Just add a bang (!) after the option name, and an error will be thrown
|
47
|
+
if it is not set to a value which is present.
|
48
|
+
|
49
|
+
``` ruby
|
50
|
+
MyApp.aws_access_key_id!
|
51
|
+
```
|
52
|
+
|
53
|
+
## Configuring options.
|
54
|
+
|
55
|
+
You can specify configuration through:
|
56
|
+
|
57
|
+
1. ENV variables
|
58
|
+
2. Redis
|
59
|
+
3. Relational database
|
60
|
+
4. YAML files
|
61
|
+
|
62
|
+
This allows you to set up econfig on most kinds of hosting solutions
|
63
|
+
(EngineYard, Heroku, etc) without any additional effort, and to switch between
|
64
|
+
them easily. The options are listed in descending order of preference.
|
65
|
+
|
66
|
+
### ENV variables
|
67
|
+
|
68
|
+
Just set an environment variable whose name is the name of the option being accessed uppercased.
|
69
|
+
|
70
|
+
For example:
|
71
|
+
|
72
|
+
``` sh
|
73
|
+
AWS_ACCESS_KEY_ID=xyz rails server
|
74
|
+
```
|
75
|
+
|
76
|
+
This is especially convenient for Heroku.
|
77
|
+
|
78
|
+
### Relational database
|
79
|
+
|
80
|
+
This needs to be explicitly enabled. In `config/application.rb` add this line:
|
81
|
+
|
82
|
+
``` ruby
|
83
|
+
Econfig.use_database
|
84
|
+
```
|
85
|
+
|
86
|
+
You will also need to create a migration to create the necessary database tables:
|
87
|
+
|
88
|
+
``` sh
|
89
|
+
rails generate econfig:migration
|
90
|
+
rake db:migrate
|
91
|
+
```
|
92
|
+
|
93
|
+
You can now set options by assigning them:
|
94
|
+
|
95
|
+
``` ruby
|
96
|
+
MyApp.aws_access_key_id = "xyz"
|
97
|
+
```
|
98
|
+
|
99
|
+
You may not use both Redis and relational database storage at the same time.
|
100
|
+
|
101
|
+
### Redis
|
102
|
+
|
103
|
+
This needs to be explicitly enabled. In `config/application.rb` add this line:
|
104
|
+
|
105
|
+
``` ruby
|
106
|
+
Econfig.use_redis Redis.new(:host => "myredis.com")
|
107
|
+
```
|
108
|
+
|
109
|
+
You can now set options by assigning them:
|
110
|
+
|
111
|
+
``` ruby
|
112
|
+
MyApp.aws_access_key_id = "xyz"
|
113
|
+
```
|
114
|
+
|
115
|
+
You may not use both Redis and relational database storage at the same time.
|
116
|
+
|
117
|
+
### YAML
|
118
|
+
|
119
|
+
Add a yaml file to `config/app.yml`. This should have a similar layout to `config/database.yml`:
|
120
|
+
|
121
|
+
``` yaml
|
122
|
+
development:
|
123
|
+
aws_access_key_id: "xyz"
|
124
|
+
aws_secret_access_key: "xyz"
|
125
|
+
production:
|
126
|
+
aws_access_key_id: "xyz"
|
127
|
+
aws_secret_access_key: "xyz"
|
128
|
+
```
|
129
|
+
|
130
|
+
## License
|
131
|
+
|
132
|
+
MIT, see separate LICENSE.txt file
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/econfig.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'econfig/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "econfig"
|
8
|
+
gem.version = Econfig::VERSION
|
9
|
+
gem.authors = ["Jonas Nicklas", "Elabs AB"]
|
10
|
+
gem.email = ["jonas.nicklas@gmail.com", "dev@elabs.se"]
|
11
|
+
gem.description = %q{Flexible configuration for Ruby/Rails applications with a variety of backends}
|
12
|
+
gem.summary = %q{Congifure Ruby apps}
|
13
|
+
gem.homepage = "https://github.com/elabs/econfig"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency "rspec"
|
21
|
+
gem.add_development_dependency "activerecord"
|
22
|
+
gem.add_development_dependency "sqlite3"
|
23
|
+
gem.add_development_dependency "redis"
|
24
|
+
end
|
data/lib/econfig.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "econfig/version"
|
2
|
+
require "econfig/memory"
|
3
|
+
require "econfig/yaml"
|
4
|
+
require "econfig/env"
|
5
|
+
require "econfig/configuration"
|
6
|
+
require "econfig/shortcut"
|
7
|
+
|
8
|
+
module Econfig
|
9
|
+
class NotFound < StandardError; end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :root, :env, :instance
|
13
|
+
|
14
|
+
def use_database
|
15
|
+
require "econfig/active_record"
|
16
|
+
Econfig.instance.backends << Econfig::ActiveRecord.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def use_redis(redis)
|
20
|
+
require "econfig/redis"
|
21
|
+
Econfig.instance.backends << Econfig::Redis.new(redis)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Econfig.instance = Econfig::Configuration.new
|
27
|
+
Econfig.instance.backends << Econfig::ENV.new
|
28
|
+
Econfig.instance.backends << Econfig::YAML.new
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Econfig
|
2
|
+
class ActiveRecord
|
3
|
+
class Option < ::ActiveRecord::Base
|
4
|
+
attr_accessible :key, :value
|
5
|
+
self.table_name = "econfig_options"
|
6
|
+
validates_uniqueness_of :key
|
7
|
+
validates_presence_of :key
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(key)
|
11
|
+
Option.find_by_key(key).try(:value)
|
12
|
+
end
|
13
|
+
|
14
|
+
def set(key, value)
|
15
|
+
option = Option.where(:key => key).first_or_initialize
|
16
|
+
option.update_attributes!(:value => value)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def options
|
22
|
+
@options ||= {}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Econfig
|
2
|
+
class Configuration
|
3
|
+
def backends
|
4
|
+
@backends ||= []
|
5
|
+
end
|
6
|
+
|
7
|
+
def get(key)
|
8
|
+
backend = backends.find { |backend| backend.get(key) }
|
9
|
+
backend.get(key) if backend
|
10
|
+
end
|
11
|
+
|
12
|
+
def get!(key)
|
13
|
+
get(key) or raise Econfig::NotFound, "configuration key '#{key}' is not set"
|
14
|
+
end
|
15
|
+
|
16
|
+
def set(key, value)
|
17
|
+
backend = backends.find { |backend| backend.respond_to?(:set) }
|
18
|
+
backend.set(key, value) if backend
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_missing(name, *args)
|
22
|
+
if name.to_s.end_with?("=")
|
23
|
+
set(name.to_s.sub(/=$/, ""), args.first)
|
24
|
+
elsif name.to_s.end_with?("!")
|
25
|
+
get!(name.to_s.sub(/!$/, ""))
|
26
|
+
else
|
27
|
+
get(name.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def respond_to?(*)
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/econfig/env.rb
ADDED
data/lib/econfig/yaml.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Econfig
|
2
|
+
class YAML
|
3
|
+
def initialize(path="config/app.yml")
|
4
|
+
@path = path
|
5
|
+
end
|
6
|
+
|
7
|
+
def get(key)
|
8
|
+
options[key] if options
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def path
|
14
|
+
File.expand_path(@path, Econfig.root)
|
15
|
+
end
|
16
|
+
|
17
|
+
def options
|
18
|
+
@options ||= ::YAML.load_file(path)[Econfig.env] if File.exist?(path)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Econfig::MigrationGenerator < Rails::Generators::Base
|
2
|
+
include Rails::Generators::Migration
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def self.next_migration_number(dirname)
|
6
|
+
if ActiveRecord::Base.timestamped_migrations
|
7
|
+
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
8
|
+
else
|
9
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_migration_file
|
14
|
+
migration_template "migration.rb", "db/migrate/create_econfig.rb"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEconfig < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :econfig_options do |t|
|
4
|
+
t.string :key, :null => false
|
5
|
+
t.string :value
|
6
|
+
end
|
7
|
+
add_index :econfig_options, :key, :unique => true
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
drop_table :econfig_options
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "active_record"
|
2
|
+
|
3
|
+
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
|
4
|
+
|
5
|
+
ActiveRecord::Base.connection.create_table :econfig_options do |t|
|
6
|
+
t.string :key, :null => false
|
7
|
+
t.string :value
|
8
|
+
end
|
9
|
+
|
10
|
+
require "econfig/active_record"
|
11
|
+
|
12
|
+
describe Econfig::ActiveRecord do
|
13
|
+
let(:backend) { Econfig::ActiveRecord.new }
|
14
|
+
around do |example|
|
15
|
+
ActiveRecord::Base.transaction do
|
16
|
+
example.run
|
17
|
+
raise ActiveRecord::Rollback
|
18
|
+
end
|
19
|
+
end
|
20
|
+
describe "#get" do
|
21
|
+
it "fetches a previously set option" do
|
22
|
+
backend.set("foo", "bar")
|
23
|
+
backend.get("foo").should == "bar"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "fetches a previously persisted option" do
|
27
|
+
Econfig::ActiveRecord::Option.create!(:key => "foo", :value => "bar")
|
28
|
+
backend.get("foo").should == "bar"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns nil if option is not set" do
|
32
|
+
backend.get("foo").should be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#set" do
|
37
|
+
it "persists keys to database" do
|
38
|
+
backend.set("foo", "bar")
|
39
|
+
Econfig::ActiveRecord::Option.find_by_key!("foo").value.should == "bar"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/config/app.yml
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
describe Econfig::Configuration do
|
2
|
+
let(:backend) { stub }
|
3
|
+
let(:other_backend) { stub }
|
4
|
+
let(:config) { Econfig::Configuration.new }
|
5
|
+
|
6
|
+
before { config.backends.push(backend, other_backend) }
|
7
|
+
|
8
|
+
describe "#get" do
|
9
|
+
it "returns response from first backend" do
|
10
|
+
backend.stub(:get).with("foobar").and_return("elephant")
|
11
|
+
config.get("foobar").should == "elephant"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "tries multiple backends until it finds a response" do
|
15
|
+
backend.stub(:get).with("foobar").and_return(nil)
|
16
|
+
other_backend.stub(:get).with("foobar").and_return("elephant")
|
17
|
+
config.get("foobar").should == "elephant"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns nil if the key can't be found in any backend" do
|
21
|
+
backend.stub(:get).with("foobar").and_return(nil)
|
22
|
+
other_backend.stub(:get).with("foobar").and_return(nil)
|
23
|
+
config.get("foobar").should == nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#get!" do
|
28
|
+
it "returns response from first backend" do
|
29
|
+
backend.stub(:get).with("foobar").and_return("elephant")
|
30
|
+
config.get!("foobar").should == "elephant"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "tries multiple backends until it finds a response" do
|
34
|
+
backend.stub(:get).with("foobar").and_return(nil)
|
35
|
+
other_backend.stub(:get).with("foobar").and_return("elephant")
|
36
|
+
config.get!("foobar").should == "elephant"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "raises error if the key can't be found in any backend" do
|
40
|
+
backend.stub(:get).with("foobar").and_return(nil)
|
41
|
+
other_backend.stub(:get).with("foobar").and_return(nil)
|
42
|
+
expect { config.get!("foobar") }.to raise_error(Econfig::NotFound)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#set" do
|
47
|
+
it "sets response on first backend" do
|
48
|
+
backend.should_receive(:set).with("foobar", "elephant")
|
49
|
+
config.set("foobar", "elephant")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "skips backends which don't have a set method" do
|
53
|
+
other_backend.should_receive(:set).with("foobar", "elephant")
|
54
|
+
config.set("foobar", "elephant")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "does nothing when no backend has a setter method" do
|
58
|
+
config.set("foobar", "elephant")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "#method_missing" do
|
63
|
+
it "calls get for normal methods" do
|
64
|
+
config.should_receive(:get).with("foobar").and_return("elephant")
|
65
|
+
config.foobar.should == "elephant"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "calls get! for bang methods" do
|
69
|
+
config.should_receive(:get!).with("foobar").and_return("elephant")
|
70
|
+
config.foobar!.should == "elephant"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "calls set for assignment methods" do
|
74
|
+
config.should_receive(:set).with("foobar", "elephant")
|
75
|
+
config.foobar = "elephant"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/spec/env_spec.rb
ADDED
data/spec/memory_spec.rb
ADDED
data/spec/redis_spec.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "redis"
|
2
|
+
require "econfig/redis"
|
3
|
+
|
4
|
+
describe Econfig::Redis do
|
5
|
+
let(:redis) { Redis.new(:databse => "econfig_test") }
|
6
|
+
let(:backend) { Econfig::Redis.new(redis) }
|
7
|
+
after do |example|
|
8
|
+
redis.flushdb
|
9
|
+
end
|
10
|
+
describe "#get" do
|
11
|
+
it "fetches a previously set option" do
|
12
|
+
backend.set("foo", "bar")
|
13
|
+
backend.get("foo").should == "bar"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "fetches a previously persisted option" do
|
17
|
+
redis.set("econfig_foo", "bar")
|
18
|
+
backend.get("foo").should == "bar"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns nil if option is not set" do
|
22
|
+
backend.get("foo").should be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#set" do
|
27
|
+
it "persists keys to database" do
|
28
|
+
backend.set("foo", "bar")
|
29
|
+
redis.get("econfig_foo").should == "bar"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
describe Econfig::Shortcut do
|
2
|
+
let(:mod) { Module.new }
|
3
|
+
before { mod.extend Econfig::Shortcut }
|
4
|
+
|
5
|
+
describe "#method_missing" do
|
6
|
+
it "proxies getters to the Econfig instance" do
|
7
|
+
Econfig.instance.should_receive(:get).with("foobar").and_return("elephant")
|
8
|
+
mod.foobar.should == "elephant"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "proxies bang methods to the Econfig instance" do
|
12
|
+
Econfig.instance.should_receive(:get!).with("foobar").and_return("elephant")
|
13
|
+
mod.foobar!.should == "elephant"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/yaml_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
describe Econfig::YAML do
|
2
|
+
let(:backend) { Econfig::YAML.new }
|
3
|
+
describe "#get" do
|
4
|
+
it "fetches option from yaml config file" do
|
5
|
+
backend.get("quox").should == "baz"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "returns nil when the option does not exist" do
|
9
|
+
backend.get("does_not_exist").should be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "returns nil when there is no config file" do
|
13
|
+
backend = Econfig::YAML.new("/does/not/exist")
|
14
|
+
backend.get("does_not_exist").should be_nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: econfig
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jonas Nicklas
|
9
|
+
- Elabs AB
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: activerecord
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sqlite3
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: redis
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
description: Flexible configuration for Ruby/Rails applications with a variety of
|
80
|
+
backends
|
81
|
+
email:
|
82
|
+
- jonas.nicklas@gmail.com
|
83
|
+
- dev@elabs.se
|
84
|
+
executables: []
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- .gitignore
|
89
|
+
- .rspec
|
90
|
+
- Gemfile
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- econfig.gemspec
|
95
|
+
- lib/econfig.rb
|
96
|
+
- lib/econfig/active_record.rb
|
97
|
+
- lib/econfig/configuration.rb
|
98
|
+
- lib/econfig/env.rb
|
99
|
+
- lib/econfig/memory.rb
|
100
|
+
- lib/econfig/rails.rb
|
101
|
+
- lib/econfig/redis.rb
|
102
|
+
- lib/econfig/shortcut.rb
|
103
|
+
- lib/econfig/version.rb
|
104
|
+
- lib/econfig/yaml.rb
|
105
|
+
- lib/generators/econfig/migration/USAGE
|
106
|
+
- lib/generators/econfig/migration/migration_generator.rb
|
107
|
+
- lib/generators/econfig/migration/templates/migration.rb
|
108
|
+
- spec/active_record_spec.rb
|
109
|
+
- spec/config/app.yml
|
110
|
+
- spec/configuration_spec.rb
|
111
|
+
- spec/env_spec.rb
|
112
|
+
- spec/memory_spec.rb
|
113
|
+
- spec/redis_spec.rb
|
114
|
+
- spec/shortcut_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/yaml_spec.rb
|
117
|
+
homepage: https://github.com/elabs/econfig
|
118
|
+
licenses: []
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.8.25
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Congifure Ruby apps
|
141
|
+
test_files:
|
142
|
+
- spec/active_record_spec.rb
|
143
|
+
- spec/config/app.yml
|
144
|
+
- spec/configuration_spec.rb
|
145
|
+
- spec/env_spec.rb
|
146
|
+
- spec/memory_spec.rb
|
147
|
+
- spec/redis_spec.rb
|
148
|
+
- spec/shortcut_spec.rb
|
149
|
+
- spec/spec_helper.rb
|
150
|
+
- spec/yaml_spec.rb
|
151
|
+
has_rdoc:
|