app_configuration 0.0.1 → 0.0.2
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/.travis.yml +1 -0
- data/README.md +8 -2
- data/lib/app_configuration/config.rb +1 -1
- data/lib/app_configuration/version.rb +1 -1
- data/spec/app_configuration/config_spec.rb +17 -9
- metadata +4 -4
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,7 @@
|
|
4
4
|
[](https://coveralls.io/r/guidomb/app_configuration)
|
5
5
|
<a href="/github/guidomb/app_configuration/badges"><img alt="App_configuration" src="https://codeclimate.com/github/guidomb/app_configuration.png" style="position: relative; top: 4px"></a>
|
6
6
|
|
7
|
-
**AppConfiguration** is a very simple gem that helps you configure your Ruby applications.
|
8
|
-
but it also can be used in non Rails projects. **AppConfiguration** uses YAML config files or environmental variales to set
|
7
|
+
**AppConfiguration** is a very simple gem that helps you configure your Ruby applications. **AppConfiguration** uses YAML config files or environmental variales to set
|
9
8
|
the configuration parameters.
|
10
9
|
|
11
10
|
## Installation
|
@@ -96,6 +95,13 @@ github.api_key
|
|
96
95
|
|
97
96
|
In the previous example the name of the configuration file is assumed to be `.github.yml` and all the environmental variables
|
98
97
|
will be prefixed with `GITHUB_`. You can change this behaviour by passing a configuration block to the `for` method.
|
98
|
+
For example if you want to change the local path you can register the configuration as follows
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
AppConfiguration.for :github do
|
102
|
+
base_local_path Rails.root
|
103
|
+
end
|
104
|
+
```
|
99
105
|
|
100
106
|
### Default values ###
|
101
107
|
|
@@ -2,17 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe AppConfiguration::Config do
|
4
4
|
|
5
|
-
|
5
|
+
before(:all) do
|
6
|
+
AppConfiguration::Config.default_local_path = File.join(fixture_path, 'local')
|
7
|
+
AppConfiguration::Config.default_global_path = File.join(fixture_path, 'global')
|
8
|
+
end
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
after(:all) do
|
11
|
+
AppConfiguration::Config.default_local_path = nil
|
12
|
+
AppConfiguration::Config.default_global_path = nil
|
13
|
+
end
|
11
14
|
|
12
|
-
|
13
|
-
AppConfiguration::Config.default_local_path = nil
|
14
|
-
AppConfiguration::Config.default_global_path = nil
|
15
|
-
end
|
15
|
+
describe "#[]" do
|
16
16
|
|
17
17
|
context "when there is only a global config file" do
|
18
18
|
|
@@ -115,4 +115,12 @@ describe AppConfiguration::Config do
|
|
115
115
|
|
116
116
|
end
|
117
117
|
|
118
|
+
describe 'dynamic method attributes' do
|
119
|
+
let(:config) { AppConfiguration::Config.new('config.yml') }
|
120
|
+
|
121
|
+
it 'defines dynamic method for all attributes' do
|
122
|
+
config.variable1.should eq 'local1'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
118
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_configuration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
segments:
|
86
86
|
- 0
|
87
|
-
hash:
|
87
|
+
hash: -1897401157877901857
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash:
|
96
|
+
hash: -1897401157877901857
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
99
|
rubygems_version: 1.8.23
|