confucious 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/README.rdoc +7 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/{confu.rb → confucious.rb} +5 -5
- data/lib/{confu → confucious}/config.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/{test_confu.rb → test_confucious.rb} +8 -8
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
=
|
1
|
+
= confucious
|
2
2
|
|
3
|
-
I found myself duplicating this code, so I wrote it into a gem.
|
3
|
+
I found myself duplicating this code, so I wrote it into a gem (named: `confucious`).
|
4
4
|
|
5
5
|
This is an `incredibly` simple gem with only a few lines of code and a few helpers to help define a configuration for a class.
|
6
6
|
|
@@ -27,7 +27,11 @@ Then the `MyClass` that included the module has a magic method called `config`.
|
|
27
27
|
|
28
28
|
MyClass.new.config.a # new value for a
|
29
29
|
|
30
|
-
|
30
|
+
To install:
|
31
|
+
|
32
|
+
gem install confucious
|
33
|
+
|
34
|
+
== Contributing to confucious
|
31
35
|
|
32
36
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
33
37
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "confucious"
|
18
|
-
gem.homepage = "http://github.com/auser/
|
18
|
+
gem.homepage = "http://github.com/auser/confucious"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = %Q{Drop-dead simple configuration}
|
21
21
|
gem.description = %Q{Drop-dead simple configuration for an application. See `README.rdoc` for details}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -1,10 +1,10 @@
|
|
1
|
-
$:.unshift(File.expand_path("
|
1
|
+
$:.unshift(File.expand_path("confucious", File.dirname(__FILE__)))
|
2
2
|
require 'hashie'
|
3
3
|
require 'logger'
|
4
4
|
|
5
5
|
require 'config'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Confucious
|
8
8
|
module ClassMethods
|
9
9
|
# This allows us to do cool things like set our
|
10
10
|
# own configuration in a block
|
@@ -17,15 +17,15 @@ module Confu
|
|
17
17
|
@config = nil # reset!
|
18
18
|
mash = Hashie::Mash.new(opts)
|
19
19
|
yield mash if block_given?
|
20
|
-
|
20
|
+
Confucious::Config.defaults.merge!(mash)
|
21
21
|
end
|
22
22
|
|
23
23
|
def configuration(&block)
|
24
|
-
|
24
|
+
Confucious::Config.instance_eval(&block) if block_given?
|
25
25
|
end
|
26
26
|
|
27
27
|
def config
|
28
|
-
@config ||=
|
28
|
+
@config ||= Confucious::Config.new
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/test/helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
4
|
-
context "
|
3
|
+
class TestConfucious < Test::Unit::TestCase
|
4
|
+
context "Confucious" do
|
5
5
|
|
6
|
-
class
|
7
|
-
include
|
6
|
+
class TestConfuciousDude
|
7
|
+
include Confucious
|
8
8
|
|
9
9
|
configuration do
|
10
10
|
property :useless, :default => "useless"
|
@@ -14,16 +14,16 @@ class TestConfu < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
setup do
|
17
|
-
@tcd =
|
17
|
+
@tcd = TestConfuciousDude.new
|
18
18
|
@config = @tcd.config
|
19
19
|
end
|
20
20
|
|
21
21
|
should "be able to set configuration" do
|
22
|
-
|
22
|
+
TestConfuciousDude.configure do |c|
|
23
23
|
c.no_default = "this is a value"
|
24
24
|
end
|
25
25
|
|
26
|
-
assert_equal "this is a value",
|
26
|
+
assert_equal "this is a value", TestConfuciousDude.new.config.no_default
|
27
27
|
end
|
28
28
|
|
29
29
|
should "be able to be included in another class" do
|
@@ -41,7 +41,7 @@ class TestConfu < Test::Unit::TestCase
|
|
41
41
|
end
|
42
42
|
|
43
43
|
should "only create one instance of config" do
|
44
|
-
assert_equal @config,
|
44
|
+
assert_equal @config, TestConfuciousDude.new.config
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: confucious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ari Lerner
|
@@ -96,12 +96,12 @@ files:
|
|
96
96
|
- README.rdoc
|
97
97
|
- Rakefile
|
98
98
|
- VERSION
|
99
|
-
- lib/
|
100
|
-
- lib/
|
99
|
+
- lib/confucious.rb
|
100
|
+
- lib/confucious/config.rb
|
101
101
|
- test/helper.rb
|
102
|
-
- test/
|
102
|
+
- test/test_confucious.rb
|
103
103
|
has_rdoc: true
|
104
|
-
homepage: http://github.com/auser/
|
104
|
+
homepage: http://github.com/auser/confucious
|
105
105
|
licenses:
|
106
106
|
- MIT
|
107
107
|
post_install_message:
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
117
|
+
hash: 3452877008982530935
|
118
118
|
segments:
|
119
119
|
- 0
|
120
120
|
version: "0"
|