abyss 0.2.1 → 0.3.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.
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'rake'
4
+
3
5
  # Specify your gem's dependencies in abyss.gemspec
4
6
  gemspec
5
7
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Abyss
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/jtrim/abyss.png)](http://travis-ci.org/jtrim/abyss)
4
+
3
5
  Ruby DSL for defining arbitrarily-deep configuration.
4
6
 
5
7
  ## Installation
@@ -17,4 +17,34 @@ module Abyss
17
17
  self.configuration.instance_eval &block
18
18
  end
19
19
 
20
+ # Check to see if a configuration has been defined.
21
+ #
22
+ # Examples:
23
+ #
24
+ # Abyss.configure do
25
+ # three do
26
+ # levels do
27
+ # deep do
28
+ # day "Monday"
29
+ # end
30
+ # end
31
+ # end
32
+ # end
33
+ #
34
+ # Abyss.has?("three/levels/deep/day") #=> true
35
+ # Abyss.has?("non/existent/thing") #=> false
36
+ #
37
+ def self.has?(path)
38
+ path.split('/').inject(Abyss.configuration) do |acc, current_path_item|
39
+ begin
40
+ target = acc.send(current_path_item)
41
+ return false if target.nil?
42
+ rescue NoMethodError
43
+ return false
44
+ end
45
+ target
46
+ end
47
+ true
48
+ end
49
+
20
50
  end
@@ -1,3 +1,3 @@
1
1
  module Abyss
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -2,21 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module Abyss
4
4
 
5
- describe ".configure" do
6
-
7
- before { Abyss.configuration = nil }
8
-
9
- it 'is shorthand for the Abyss Store API' do
10
- expected_block = Proc.new { }
11
- fake_config = mock()
12
- Store.stub(:new).and_return(fake_config)
13
- fake_config.should_receive(:instance_eval).with(&expected_block)
14
-
15
- Abyss.configure &expected_block
16
- end
17
-
18
- end
19
-
20
5
  describe Store do
21
6
 
22
7
  subject { Store.new }
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Abyss do
4
+
5
+ before { Abyss.configuration = nil }
6
+ after { Abyss.configuration = nil }
7
+
8
+ describe ".configure" do
9
+
10
+ it 'is shorthand for the Abyss Store API' do
11
+ expected_block = Proc.new { }
12
+ fake_config = mock()
13
+ Abyss::Store.stub(:new).and_return(fake_config)
14
+ fake_config.should_receive(:instance_eval).with(&expected_block)
15
+
16
+ Abyss.configure &expected_block
17
+ end
18
+
19
+ end
20
+
21
+ describe '.has?' do
22
+
23
+ context "when given a path to an existing configuration" do
24
+
25
+ before do
26
+ Abyss.configure do
27
+ three do
28
+ levels do
29
+ deep do
30
+ here "hey!"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ specify { Abyss.has?('three/levels/deep/here').should be_true }
38
+
39
+ end
40
+
41
+ context "when the config doesn't exist" do
42
+
43
+ before do
44
+ Abyss.configure {}
45
+ end
46
+
47
+ specify { Abyss.has?('three/levels/deep/here').should be_false }
48
+ specify { Abyss.has?('nope').should be_false }
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end
metadata CHANGED
@@ -1,50 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: abyss
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jesse Trimble
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-23 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70318152924440 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 3
31
- - 2
32
- - 0
20
+ - !ruby/object:Gem::Version
33
21
  version: 3.2.0
34
22
  type: :runtime
35
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: *70318152924440
36
25
  description: Manage arbitrarily-deep configurations through a friendly DSL.
37
- email:
26
+ email:
38
27
  - jesseltrimble@gmail.com
39
28
  executables: []
40
-
41
29
  extensions: []
42
-
43
30
  extra_rdoc_files: []
44
-
45
- files:
31
+ files:
46
32
  - .gitignore
47
33
  - .rspec
34
+ - .travis.yml
48
35
  - Gemfile
49
36
  - LICENSE
50
37
  - README.md
@@ -57,41 +44,34 @@ files:
57
44
  - lib/abyss/version.rb
58
45
  - spec/abyss/deep_store_spec.rb
59
46
  - spec/abyss/store_spec.rb
47
+ - spec/abyss_spec.rb
60
48
  - spec/spec_helper.rb
61
- homepage: ""
49
+ homepage: ''
62
50
  licenses: []
63
-
64
51
  post_install_message:
65
52
  rdoc_options: []
66
-
67
- require_paths:
53
+ require_paths:
68
54
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
55
+ required_ruby_version: !ruby/object:Gem::Requirement
70
56
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
62
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 3
84
- segments:
85
- - 0
86
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
87
67
  requirements: []
88
-
89
68
  rubyforge_project:
90
69
  rubygems_version: 1.8.10
91
70
  signing_key:
92
71
  specification_version: 3
93
72
  summary: Manage arbitrarily-deep configurations through a friendly DSL.
94
- test_files:
73
+ test_files:
95
74
  - spec/abyss/deep_store_spec.rb
96
75
  - spec/abyss/store_spec.rb
76
+ - spec/abyss_spec.rb
97
77
  - spec/spec_helper.rb