dsl 0.1.0 → 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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 c00lryguy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -6,7 +6,9 @@ dsl.rb is a small script (26 lines) to help create domain specific languages wit
6
6
 
7
7
  ## Install
8
8
 
9
- Until I setup the gem... just clone and play around with it.
9
+ `gem update --system`
10
+ `gem update`
11
+ `gem install dsl`
10
12
 
11
13
  ## Quick Example
12
14
 
@@ -44,6 +46,29 @@ When the block is closed, all of the instance variables are then transfered back
44
46
 
45
47
  Therefor, creating a Domain Specific Language is as easy as subclassing the `DSL` class. That's it!
46
48
 
49
+ ## Use with any block:
50
+
51
+ To illustrate how to use with any block, The above example could be written like so:
52
+
53
+ require 'dsl'
54
+
55
+ class UserDSL < DSL
56
+ def name(n); @name = n; end
57
+ def gender(g); @gender = g; end
58
+ def age(a); @age = a; end
59
+ end
60
+
61
+ class User
62
+ attr :name, :gender, :age
63
+ def edit(&blk)
64
+ UserDSL.call(self, &blk)
65
+ end
66
+ end
67
+
68
+ The class method `call` takes a parent and a block. The parent that you give will get it's instance variables delegated to a new instance of your DSL class.
69
+
70
+ You could easily delegate instance variables from another class instance other than `self`
71
+
47
72
  ## Copyright
48
73
 
49
74
  Copyright (c) 2010 Ryan Lewis. See LICENSE for details.
@@ -0,0 +1,69 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "dsl"
8
+ gem.summary = "A small library for creating Domain Specific Languages (DSLs)"
9
+ gem.description = gem.summary
10
+ gem.email = "c00lryguy@gmail.com"
11
+ gem.homepage = "http://github.com/c00lryguy/dsl"
12
+ gem.authors = ["c00lryguy"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ begin
44
+ require 'reek/adapters/rake_task'
45
+ Reek::RakeTask.new do |t|
46
+ t.fail_on_error = true
47
+ t.verbose = false
48
+ t.source_files = 'lib/**/*.rb'
49
+ end
50
+ rescue LoadError
51
+ task :reek do
52
+ abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
53
+ end
54
+ end
55
+
56
+ begin
57
+ require 'roodi'
58
+ require 'roodi_task'
59
+ RoodiTask.new do |t|
60
+ t.verbose = false
61
+ end
62
+ rescue LoadError
63
+ task :roodi do
64
+ abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
65
+ end
66
+ end
67
+
68
+ task :default => :test
69
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
File without changes
File without changes
File without changes
@@ -17,7 +17,7 @@ class DSL
17
17
  end
18
18
  end
19
19
  end
20
-
20
+
21
21
  class Module
22
22
  def dsl_method(opts)
23
23
  # Complain if the argument isn't a hash
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'dsl'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestDsl < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata CHANGED
@@ -1,40 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
- - Ryan Lewis
13
+ - c00lryguy
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-16 00:00:00 -04:00
18
+ date: 2010-08-28 00:00:00 -04:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: Easily create Domain Specific Languages with any block. You can also link instance methods to your DSL.
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: thoughtbot-shoulda
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: A small library for creating Domain Specific Languages (DSLs)
23
36
  email: c00lryguy@gmail.com
24
37
  executables: []
25
38
 
26
39
  extensions: []
27
40
 
28
41
  extra_rdoc_files:
42
+ - LICENSE
29
43
  - README.md
30
44
  files:
31
- - .gitignore
45
+ - LICENSE
32
46
  - README.md
47
+ - Rakefile
33
48
  - VERSION
34
- - dsl.rb
35
49
  - examples/database.rb
36
50
  - examples/user.rb
37
51
  - examples/webapp.rb
52
+ - lib/dsl.rb
53
+ - test/helper.rb
54
+ - test/test_dsl.rb
38
55
  has_rdoc: true
39
56
  homepage: http://github.com/c00lryguy/dsl
40
57
  licenses: []
@@ -70,6 +87,8 @@ signing_key:
70
87
  specification_version: 3
71
88
  summary: A small library for creating Domain Specific Languages (DSLs)
72
89
  test_files:
73
- - examples/webapp.rb
90
+ - test/test_dsl.rb
91
+ - test/helper.rb
74
92
  - examples/database.rb
75
93
  - examples/user.rb
94
+ - examples/webapp.rb
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- Rakefile