app_configuration 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,4 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - ruby-head
5
6
  script: bundle exec rspec spec
data/README.md CHANGED
@@ -4,8 +4,7 @@
4
4
  [![Coverage Status](https://coveralls.io/repos/guidomb/app_configuration/badge.png?branch=master)](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. It was extracted from a Rails project
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
 
@@ -53,7 +53,7 @@ module AppConfiguration
53
53
  end
54
54
 
55
55
  def method_missing(method, *args, &block)
56
- self[method]
56
+ self[method.to_s]
57
57
  end
58
58
 
59
59
  private
@@ -1,3 +1,3 @@
1
1
  module AppConfiguration
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -2,17 +2,17 @@ require 'spec_helper'
2
2
 
3
3
  describe AppConfiguration::Config do
4
4
 
5
- describe "#[]" do
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
- before(:all) do
8
- AppConfiguration::Config.default_local_path = File.join(fixture_path, 'local')
9
- AppConfiguration::Config.default_global_path = File.join(fixture_path, 'global')
10
- end
10
+ after(:all) do
11
+ AppConfiguration::Config.default_local_path = nil
12
+ AppConfiguration::Config.default_global_path = nil
13
+ end
11
14
 
12
- after(:all) do
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.1
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-11 00:00:00.000000000 Z
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: 3752812428979833115
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: 3752812428979833115
96
+ hash: -1897401157877901857
97
97
  requirements: []
98
98
  rubyforge_project:
99
99
  rubygems_version: 1.8.23