dynamic_configuration 0.1.5 → 0.1.6

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/README.markdown ADDED
@@ -0,0 +1,57 @@
1
+ # dynamic_configuration: Application configuration made easy
2
+
3
+ Rails made great innovations in almost all areas of web application
4
+ development, yet it surprisingly does not provide any means for
5
+ application configuration, and each of the so far available plugins I
6
+ have seen had some serious disadvantages. Here are the features that
7
+ differentiate dynamic_configuration from other configuration plugins:
8
+
9
+ * very easy setup with only two lines of code
10
+
11
+ * configuration files are very clean-looking Ruby files
12
+
13
+ * the configuration is automatically reloaded in Rails development environment
14
+
15
+ * the settings are divided into groups, with each group living in a
16
+ separate file, making it easier to remember individual setting
17
+ names and maintain the whole configuration
18
+
19
+ * settings can be overridden locally for a given installation and
20
+ per-Rails-environment
21
+
22
+ * throughout field- and unit- tested
23
+
24
+ ## Setup
25
+
26
+ ### Rails 3 application:
27
+
28
+ Add the gem to your Gemfile:
29
+
30
+ gem 'dynamic_configuration'
31
+
32
+ Create a config/options directory, in it a config/options.rb file with
33
+ the following contents:
34
+
35
+ DynamicConfiguration::create(:Options, File.join(Rails.root, "config/options"))
36
+
37
+ Require config/options/options.rb somewhere in your
38
+ config/application.rb, like this:
39
+
40
+ module SomeApplication
41
+ class Application < Rails::Application
42
+ require "config/options/options"
43
+
44
+ # ..., rest of the config
45
+ end
46
+ end
47
+
48
+ ### Ruby application:
49
+
50
+ Create a directory where you want to store the options, e. g.
51
+ options/, and put the following before your application initialization
52
+ code:
53
+
54
+ DynamicConfiguration::create(:Options, "/path/to/options")
55
+
56
+
57
+ ## Usage
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -5,14 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dynamic_configuration}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Jarosław Rzeszótko}]
12
12
  s.date = %q{2012-01-26}
13
13
  s.description = %q{Flexible configuration library for Ruby and Rails applications.}
14
14
  s.email = %q{jrzeszotko@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.markdown"
17
+ ]
15
18
  s.files = [
19
+ "README.markdown",
16
20
  "Rakefile",
17
21
  "VERSION",
18
22
  "dynamic_configuration.gemspec",
@@ -88,7 +88,7 @@ module DynamicConfiguration
88
88
  mod_name = file_pathname.basename.to_s[0..-4]
89
89
 
90
90
  @modules ||= {}
91
- @modules[mod_name.intern] ||= Submodule.new
91
+ @modules[mod_name.intern] ||= Group.new
92
92
  @modules[mod_name.intern].instance_eval(::IO.read(file_pathname.to_s))
93
93
 
94
94
  @settings ||= {}
@@ -97,14 +97,14 @@ module DynamicConfiguration
97
97
 
98
98
  def method_missing(name, *args, &block)
99
99
  unless @settings && @settings[name]
100
- raise MissingSubmoduleException.new("No configuration defined for a '#{name}' submodule")
100
+ raise MissingGroupException.new("No configuration defined for a '#{name}' submodule")
101
101
  end
102
102
 
103
103
  @settings[name]
104
104
  end
105
105
  end
106
106
 
107
- class Submodule < ::BlankSlate
107
+ class Group < ::BlankSlate
108
108
  attr_accessor :settings
109
109
 
110
110
  def initialize
@@ -129,6 +129,6 @@ module DynamicConfiguration
129
129
  end
130
130
  end
131
131
 
132
- class MissingSubmoduleException < StandardError; end
132
+ class MissingGroupException < StandardError; end
133
133
  class MissingSettingException < StandardError; end
134
134
  end
@@ -53,7 +53,7 @@ describe DynamicConfiguration do
53
53
  lambda {
54
54
  DynamicConfiguration::create(:Settings, path)
55
55
  Settings.xyz.setting_three
56
- }.should raise_error(DynamicConfiguration::MissingSubmoduleException)
56
+ }.should raise_error(DynamicConfiguration::MissingGroupException)
57
57
  end
58
58
 
59
59
  it "should raise an exception if trying to use a setting that is not defined" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_configuration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &75603140 !ruby/object:Gem::Requirement
16
+ requirement: &81569210 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,13 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *75603140
24
+ version_requirements: *81569210
25
25
  description: Flexible configuration library for Ruby and Rails applications.
26
26
  email: jrzeszotko@gmail.com
27
27
  executables: []
28
28
  extensions: []
29
- extra_rdoc_files: []
29
+ extra_rdoc_files:
30
+ - README.markdown
30
31
  files:
32
+ - README.markdown
31
33
  - Rakefile
32
34
  - VERSION
33
35
  - dynamic_configuration.gemspec