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 +2 -0
- data/README.md +5 -0
- data/lib/qor_dsl.rb +10 -0
- data/lib/qor_dsl/class_method.rb +1 -1
- data/lib/qor_dsl/config.rb +8 -12
- data/lib/qor_dsl/exception.rb +6 -0
- data/lib/qor_dsl/node.rb +9 -13
- data/qor_dsl.gemspec +1 -1
- data/test/layout_test.rb +4 -0
- metadata +9 -3
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Qor Dsl - DSL made easy!
|
2
2
|
=======
|
3
3
|
|
4
|
+
[][travis]
|
5
|
+
[][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!
|
data/lib/qor_dsl.rb
CHANGED
@@ -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
|
data/lib/qor_dsl/class_method.rb
CHANGED
data/lib/qor_dsl/config.rb
CHANGED
@@ -41,18 +41,14 @@ module Qor
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def to_s
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
data/lib/qor_dsl/node.rb
CHANGED
@@ -89,19 +89,15 @@ module Qor
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def to_s
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
data/qor_dsl.gemspec
CHANGED
data/test/layout_test.rb
CHANGED
@@ -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.
|
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-
|
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:
|