jzimmek-easy_dsl 0.1.1 → 0.1.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/VERSION +1 -1
- data/easy_dsl.gemspec +5 -2
- data/lib/easy_dsl/container.rb +8 -4
- data/test/easy_dsl/test/apache.rb +1 -1
- data/test/easy_dsl/test/rewrite.rb +1 -1
- data/test/easy_dsl/test/virtual_host.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/easy_dsl.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{easy_dsl}
|
5
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Jan Zimmek"]
|
9
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-09-17}
|
10
13
|
s.email = %q{jan.zimmek@web.de}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"LICENSE",
|
data/lib/easy_dsl/container.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
require 'base64'
|
3
|
+
require 'guid'
|
3
4
|
require 'easy_dsl/attribute'
|
4
5
|
|
5
6
|
module EasyDsl
|
@@ -10,7 +11,7 @@ module EasyDsl
|
|
10
11
|
attr_reader :attributes
|
11
12
|
attr_reader :children
|
12
13
|
|
13
|
-
def initialize(
|
14
|
+
def initialize(container, name)
|
14
15
|
@name = name
|
15
16
|
@container = container
|
16
17
|
@attributes = {}
|
@@ -125,7 +126,7 @@ module EasyDsl
|
|
125
126
|
}
|
126
127
|
|
127
128
|
@nested.values.each do |nested_clazz|
|
128
|
-
nested = nested_clazz.new("default"
|
129
|
+
nested = nested_clazz.new(self, "default")
|
129
130
|
nested.selfdoc(doc)
|
130
131
|
end
|
131
132
|
|
@@ -145,8 +146,11 @@ module EasyDsl
|
|
145
146
|
instance_variable_get("@all_#{nested_name}")
|
146
147
|
end
|
147
148
|
|
148
|
-
self.class.send(:define_method, nested_name) do |obj_name, &block|
|
149
|
-
|
149
|
+
# self.class.send(:define_method, nested_name) do |obj_name=nil, &block|
|
150
|
+
self.class.send(:define_method, nested_name) do |*args, &block|
|
151
|
+
obj_name = args.length > 0 ? args[0] : Guid.new.to_s
|
152
|
+
|
153
|
+
obj = clazz.new(self, obj_name)
|
150
154
|
instance_variable_get("@all_#{nested_name}")[obj_name] = obj
|
151
155
|
|
152
156
|
@children << obj
|
@@ -5,7 +5,7 @@ module EasyDsl
|
|
5
5
|
module Test
|
6
6
|
class Apache < EasyDsl::Container
|
7
7
|
def initialize(name)
|
8
|
-
super(
|
8
|
+
super(nil, name)
|
9
9
|
|
10
10
|
attribute :webmaster_email, :inheritable => true, :required => true, :filter => Proc.new{|value|value.strip}
|
11
11
|
attribute :port, :inheritable => true, :required => true
|
@@ -4,7 +4,7 @@ require 'easy_dsl/test/rewrite'
|
|
4
4
|
module EasyDsl
|
5
5
|
module Test
|
6
6
|
class VirtualHost < EasyDsl::Container
|
7
|
-
def initialize(
|
7
|
+
def initialize(container, name)
|
8
8
|
super
|
9
9
|
attribute :document_root, :inheritable => false, :required => true
|
10
10
|
attribute :webmaster_email
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jzimmek-easy_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Zimmek
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|