qor_dsl 0.1.3 → 0.1.4

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/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rake'
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Qor Dsl - DSL made easy!
2
2
  =======
3
3
 
4
+ [![Build Status](https://secure.travis-ci.org/qor/qor_dsl.png?branch=master)][travis]
5
+ [![Code Climate](https://codeclimate.com/badge.png)][codeclimate]
6
+ [travis]: http://travis-ci.org/qor/qor_dsl
7
+ [codeclimate]: https://codeclimate.com/github/qor/qor_dsl
8
+
4
9
  ## Description
5
10
 
6
11
  Why DSL? Easy to read, Easy to write, Easy to maintain!
@@ -1,3 +1,4 @@
1
+ require 'qor_dsl/exception'
1
2
  require 'qor_dsl/class_method'
2
3
  require 'qor_dsl/config'
3
4
  require 'qor_dsl/node'
@@ -7,5 +8,14 @@ module Qor
7
8
  def self.included(base)
8
9
  base.extend ClassMethods
9
10
  end
11
+
12
+ def self.inspect_object(obj, options)
13
+ options = options.inject({}) do |summary, value|
14
+ summary[value[0]] = value[1] if value[1] && value[1].to_s.length > 0
15
+ summary
16
+ end
17
+
18
+ "#<#{obj.class}:0x#{obj.object_id.to_s(16)} #{options.inspect}>"
19
+ end
10
20
  end
11
21
  end
@@ -45,7 +45,7 @@ module Qor
45
45
  end
46
46
 
47
47
  def load_file(file)
48
- return unless File.exist?(file.to_s)
48
+ raise Qor::Dsl::ConfigurationNotFound unless File.exist?(file.to_s)
49
49
  node_root.config.instance_eval(File.read(file))
50
50
  node_root
51
51
  end
@@ -41,18 +41,14 @@ module Qor
41
41
  end
42
42
 
43
43
  def to_s
44
- result = [
45
- ['name', __name],
46
- ['parent', __parent && __parent.__name],
47
- ['children', __children.keys],
48
- ['options', __options],
49
- ['block', __block]
50
- ].inject({}) do |s, value|
51
- s[value[0]] = value[1] if value[1] && value[1].to_s.length > 0
52
- s
53
- end.inspect
54
-
55
- "#<Qor::Dsl::Config::0x#{object_id.to_s(16)} #{result}>"
44
+ obj_options = {
45
+ 'name' => __name,
46
+ 'parent' => __parent && __parent.__name,
47
+ 'children' => __children.keys,
48
+ 'options' => __options,
49
+ 'block' => __block
50
+ }
51
+ Qor::Dsl.inspect_object(self, obj_options)
56
52
  end
57
53
  end
58
54
  end
@@ -0,0 +1,6 @@
1
+ module Qor
2
+ module Dsl
3
+ class ConfigurationNotFound < StandardError
4
+ end
5
+ end
6
+ end
@@ -89,19 +89,15 @@ module Qor
89
89
  end
90
90
 
91
91
  def to_s
92
- result = [
93
- ['name', name],
94
- ['parent', parent && parent.inspect_name],
95
- ['config', config_name],
96
- ['children', children.map(&:inspect_name)],
97
- ['data', data],
98
- ['block', block]
99
- ].inject({}) do |s, value|
100
- s[value[0]] = value[1] if value[1] && value[1].to_s.length > 0
101
- s
102
- end.inspect
103
-
104
- "#<Qor::Dsl::Node:0x#{object_id.to_s(16)} #{result}>"
92
+ obj_options = {
93
+ 'name' => name,
94
+ 'parent' => parent && parent.inspect_name,
95
+ 'config' => config_name,
96
+ 'children' => children.map(&:inspect_name),
97
+ 'data' => data,
98
+ 'block' => block
99
+ }
100
+ Qor::Dsl.inspect_object(self, obj_options)
105
101
  end
106
102
  end
107
103
  end
@@ -11,5 +11,5 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
12
  gem.name = "qor_dsl"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = "0.1.3"
14
+ gem.version = "0.1.4"
15
15
  end
@@ -69,4 +69,8 @@ describe Layout do
69
69
  Layout::Configuration.find(:template).count.must_equal 1
70
70
  Layout::Configuration.first(:template).value.must_equal "New Template"
71
71
  end
72
+
73
+ it "should raise exception if configuration not found" do
74
+ lambda { Layout::Configuration.load("non_existing_file.rb", :force => true) }.must_raise Qor::Dsl::ConfigurationNotFound
75
+ end
72
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qor_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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: 2012-10-22 00:00:00.000000000 Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Qor DSL is designed to be as flexible as possible while helping you to
15
15
  create your DSLs.
@@ -28,6 +28,7 @@ files:
28
28
  - lib/qor_dsl.rb
29
29
  - lib/qor_dsl/class_method.rb
30
30
  - lib/qor_dsl/config.rb
31
+ - lib/qor_dsl/exception.rb
31
32
  - lib/qor_dsl/node.rb
32
33
  - qor_dsl.gemspec
33
34
  - test/configure.rb
@@ -45,12 +46,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
46
  - - ! '>='
46
47
  - !ruby/object:Gem::Version
47
48
  version: '0'
49
+ segments:
50
+ - 0
51
+ hash: 3960586950278595275
48
52
  required_rubygems_version: !ruby/object:Gem::Requirement
49
53
  none: false
50
54
  requirements:
51
55
  - - ! '>='
52
56
  - !ruby/object:Gem::Version
53
57
  version: '0'
58
+ segments:
59
+ - 0
60
+ hash: 3960586950278595275
54
61
  requirements: []
55
62
  rubyforge_project:
56
63
  rubygems_version: 1.8.24
@@ -61,4 +68,3 @@ test_files:
61
68
  - test/configure.rb
62
69
  - test/layout.rb
63
70
  - test/layout_test.rb
64
- has_rdoc: