opendsl 1.0.0
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/HISTORY +10 -0
- data/LICENSE +22 -0
- data/README +74 -0
- data/lib/opendsl.rb +20 -0
- data/meta/authors +1 -0
- data/meta/contact +1 -0
- data/meta/created +1 -0
- data/meta/description +1 -0
- data/meta/license +1 -0
- data/meta/name +1 -0
- data/meta/released +1 -0
- data/meta/suite +1 -0
- data/meta/summary +1 -0
- data/meta/title +1 -0
- data/meta/version +1 -0
- data/qed/example.rdoc +29 -0
- metadata +80 -0
data/HISTORY
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 Thomas Sawyer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
= OpenDSL
|
2
|
+
|
3
|
+
* home: http://rubyworks.github.com/opendsl
|
4
|
+
* work: http://github.com/rubyworks/opendsl
|
5
|
+
|
6
|
+
== Free as a bird. Think like a duck.
|
7
|
+
|
8
|
+
== DESCRIPTION
|
9
|
+
|
10
|
+
OpenDSL provides an open nomenclature for writing
|
11
|
+
domain specific instructions. The idea is inline
|
12
|
+
with the idea of duck-typing. You can allow domain
|
13
|
+
instructions to be given up front free of restriction,
|
14
|
+
then applying them later their correctness plays out
|
15
|
+
as they are utilized.
|
16
|
+
|
17
|
+
The library is especailly useful for plugins systems.
|
18
|
+
|
19
|
+
|
20
|
+
== RELEASE NOTES
|
21
|
+
|
22
|
+
Please see HISTORY file.
|
23
|
+
|
24
|
+
|
25
|
+
== SYNOPSIS
|
26
|
+
|
27
|
+
There are a few different ways in which this library can be
|
28
|
+
put to use, but the basic idea for all of them can be
|
29
|
+
demonstrated simply enough.
|
30
|
+
|
31
|
+
Foo = OpenDSL.new do
|
32
|
+
foo do
|
33
|
+
'foo'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Something
|
38
|
+
include Foo
|
39
|
+
|
40
|
+
def foobar
|
41
|
+
foo + 'bar'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
OpenDSL.new creates a subclass of Module. Indeed, this library was
|
46
|
+
orginally called OpenModule, but the name was changed to focus
|
47
|
+
on it's utility, rather than it's implementation. Since an OpenDSL
|
48
|
+
object is a module you can use it just like any other module.
|
49
|
+
|
50
|
+
|
51
|
+
== HOW TO INSTALL
|
52
|
+
|
53
|
+
To install with RubyGems simply open a console and type:
|
54
|
+
|
55
|
+
gem install opendsl
|
56
|
+
|
57
|
+
Site installation requires Setup.rb (gem install setup),
|
58
|
+
then download the tarball package and type:
|
59
|
+
|
60
|
+
tar -xvzf openmodule-1.0.0.tgz
|
61
|
+
cd opendsl-1.0.0.tgz
|
62
|
+
sudo setup.rb all
|
63
|
+
|
64
|
+
Windows users use 'ruby setup.rb all'.
|
65
|
+
|
66
|
+
|
67
|
+
== LICENSE / COPYRIGHT
|
68
|
+
|
69
|
+
Copyright (c) 2009 Thomas Sawyer
|
70
|
+
|
71
|
+
This program is ditributed unser the terms of the MIT license.
|
72
|
+
|
73
|
+
See LICENSE file for details.
|
74
|
+
|
data/lib/opendsl.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
# The Stuff
|
3
|
+
class OpenDSL < Module
|
4
|
+
|
5
|
+
#
|
6
|
+
def initialize(&block)
|
7
|
+
instance_eval(&block) if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
#
|
11
|
+
def method_missing(s, *a, &b)
|
12
|
+
if block_given?
|
13
|
+
define_method(s, &b)
|
14
|
+
else
|
15
|
+
super(s, *a, &b)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
data/meta/authors
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thomas Sawyer
|
data/meta/contact
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
trans <transfire@gmail.com>
|
data/meta/created
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2008-04-14
|
data/meta/description
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
OpenDSL is like the ultimate DSL system.
|
data/meta/license
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
MIT
|
data/meta/name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
opendsl
|
data/meta/released
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2009-07-18
|
data/meta/suite
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rubyworks
|
data/meta/summary
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
The ultimate DSL.
|
data/meta/title
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
OpenDSL
|
data/meta/version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/qed/example.rdoc
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
= README Example
|
2
|
+
|
3
|
+
Require the OpenDSL library.
|
4
|
+
|
5
|
+
require 'opendsl'
|
6
|
+
|
7
|
+
Create an OpenDSL module.
|
8
|
+
|
9
|
+
Foo = OpenDSL.new do
|
10
|
+
foo do
|
11
|
+
'foo'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Apply it to a class.
|
16
|
+
|
17
|
+
class Something
|
18
|
+
include Foo
|
19
|
+
|
20
|
+
def foobar
|
21
|
+
foo + 'bar'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Verify it worked as expected.
|
26
|
+
|
27
|
+
s = Something.new
|
28
|
+
s.foobar.assert == 'foobar'
|
29
|
+
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opendsl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Thomas Sawyer
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-01 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: OpenDSL is like the ultimate DSL system.
|
22
|
+
email:
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
files:
|
30
|
+
- lib/opendsl.rb
|
31
|
+
- meta/authors
|
32
|
+
- meta/contact
|
33
|
+
- meta/created
|
34
|
+
- meta/description
|
35
|
+
- meta/license
|
36
|
+
- meta/name
|
37
|
+
- meta/released
|
38
|
+
- meta/suite
|
39
|
+
- meta/summary
|
40
|
+
- meta/title
|
41
|
+
- meta/version
|
42
|
+
- qed/example.rdoc
|
43
|
+
- LICENSE
|
44
|
+
- README
|
45
|
+
- HISTORY
|
46
|
+
has_rdoc: true
|
47
|
+
homepage:
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- --title
|
53
|
+
- OpenDSL API
|
54
|
+
- --main
|
55
|
+
- README
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project: opendsl
|
75
|
+
rubygems_version: 1.3.6.pre.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: The ultimate DSL.
|
79
|
+
test_files: []
|
80
|
+
|