simple-conf 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SimpleConf
2
2
 
3
- TODO: Write a gem description
3
+ Simple configuration library for the loading yml files from the config folder.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,31 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Define in your project class like:
22
+
23
+ ```
24
+ class Configuration
25
+ include SimpleConf
26
+ end
27
+ ```
28
+
29
+ Create in the config folder configuration.yml file with content like:
30
+
31
+ ```
32
+ staging:
33
+ domain: "staging.example.com"
34
+ links:
35
+ - test1.example.com
36
+ - test2.example.com
37
+ production:
38
+ domain: "production.example.com"
39
+
40
+ Now you can use your file in the project:
41
+
42
+ ```
43
+ puts Configuration.staging.domain
44
+ puts Configuration.production.domain
45
+ ```
22
46
 
23
47
  ## Contributing
24
48
 
@@ -15,7 +15,9 @@ module SimpleConf
15
15
  end
16
16
 
17
17
  def path
18
- "./config/#{klass.name.downcase}.yml"
18
+ class_name = klass.name.downcase.split("::").last
19
+
20
+ "./config/#{class_name}.yml"
19
21
  end
20
22
 
21
23
  def yaml_file
@@ -1,3 +1,3 @@
1
1
  module SimpleConf
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -8,6 +8,12 @@ class Options
8
8
  include SimpleConf
9
9
  end
10
10
 
11
+ module ConfigModule
12
+ class Options
13
+ include SimpleConf
14
+ end
15
+ end
16
+
11
17
  describe SimpleConf do
12
18
  context "on include to config class generate properties" do
13
19
  it { Configuration.staging.domain.should == "staging.example.com" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-conf
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: