doodle 0.0.10 → 0.1.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.
Files changed (67) hide show
  1. data/CREDITS +22 -0
  2. data/{ChangeLog → History.txt} +22 -3
  3. data/License.txt +20 -0
  4. data/Manifest.txt +61 -0
  5. data/README.txt +166 -0
  6. data/Rakefile +4 -0
  7. data/config/hoe.rb +77 -0
  8. data/config/requirements.rb +15 -0
  9. data/examples/doodle-errors.rb +25 -0
  10. data/examples/event-location.rb +3 -7
  11. data/examples/example-01.rb +1 -1
  12. data/examples/example-01.rdoc +3 -3
  13. data/examples/example-02.rb +15 -4
  14. data/examples/example-02.rdoc +17 -5
  15. data/examples/mail-datatypes.rb +104 -0
  16. data/examples/mail.rb +85 -0
  17. data/examples/parent.rb +40 -0
  18. data/examples/profile-options.rb +67 -0
  19. data/examples/smtp_tls.rb +65 -0
  20. data/examples/test-datatypes.rb +55 -0
  21. data/examples/yaml-example.rb +40 -0
  22. data/examples/yaml-example2.rb +42 -0
  23. data/lib/doodle.rb +364 -301
  24. data/lib/doodle/datatypes.rb +148 -0
  25. data/lib/doodle/rfc822.rb +31 -0
  26. data/lib/doodle/utils.rb +13 -0
  27. data/lib/doodle/version.rb +9 -0
  28. data/log/debug.log +0 -0
  29. data/script/console +10 -0
  30. data/script/destroy +14 -0
  31. data/script/generate +14 -0
  32. data/script/txt2html +82 -0
  33. data/setup.rb +1585 -0
  34. data/spec/arg_order_spec.rb +5 -5
  35. data/spec/attributes_spec.rb +66 -24
  36. data/spec/bugs_spec.rb +109 -6
  37. data/spec/class_spec.rb +7 -4
  38. data/spec/class_validation_spec.rb +46 -0
  39. data/spec/class_var_spec.rb +76 -0
  40. data/spec/collector_spec.rb +16 -30
  41. data/spec/conversion_spec.rb +8 -3
  42. data/spec/defaults_spec.rb +4 -4
  43. data/spec/doodle_context_spec.rb +3 -4
  44. data/spec/doodle_spec.rb +25 -15
  45. data/spec/extra_args_spec.rb +1 -1
  46. data/spec/factory_spec.rb +3 -3
  47. data/spec/init_spec.rb +11 -11
  48. data/spec/new_doodle_spec.rb +19 -0
  49. data/spec/required_spec.rb +1 -1
  50. data/spec/serialization_spec.rb +3 -6
  51. data/spec/singleton_spec.rb +5 -5
  52. data/spec/spec.opts +1 -0
  53. data/spec/spec_helper.rb +44 -0
  54. data/spec/superclass_spec.rb +6 -5
  55. data/spec/validation2_spec.rb +248 -0
  56. data/spec/validation_spec.rb +26 -37
  57. data/tasks/deployment.rake +34 -0
  58. data/tasks/environment.rake +7 -0
  59. data/tasks/rspec.rake +21 -0
  60. data/tasks/website.rake +17 -0
  61. metadata +76 -20
  62. data/COPYING +0 -18
  63. data/README +0 -57
  64. data/examples/event.rb +0 -39
  65. data/examples/example-03.rb +0 -45
  66. data/examples/example-03.rdoc +0 -55
  67. data/lib/semantic.cache +0 -8
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doodle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean O'Halpin
@@ -9,40 +9,92 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-13 00:00:00 +01:00
12
+ date: 2008-04-26 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description:
17
- email: sean.ohalpin@gmail.com
16
+ description: "Doodle is a gem for simplifying the definition of Ruby classes by making attributes and their properties more declarative. Doodle is eco-friendly: it does not globally modify Object, Class or Module."
17
+ email:
18
+ - sean.ohalpin@gmail.com
18
19
  executables: []
19
20
 
20
21
  extensions: []
21
22
 
22
23
  extra_rdoc_files:
23
- - README
24
- - COPYING
25
- - ChangeLog
24
+ - History.txt
25
+ - License.txt
26
+ - Manifest.txt
27
+ - README.txt
26
28
  files:
27
- - lib/doodle.rb
28
- - lib/molic_orderedhash.rb
29
- - lib/semantic.cache
30
- - examples/example-03.rb
29
+ - History.txt
30
+ - License.txt
31
+ - Manifest.txt
32
+ - README.txt
33
+ - CREDITS
34
+ - Rakefile
35
+ - config/hoe.rb
36
+ - config/requirements.rb
37
+ - examples/smtp_tls.rb
31
38
  - examples/example-01.rdoc
32
- - examples/example-03.rdoc
39
+ - examples/profile-options.rb
40
+ - examples/doodle-errors.rb
33
41
  - examples/event-location.rb
42
+ - examples/parent.rb
34
43
  - examples/example-02.rb
35
- - examples/event.rb
36
44
  - examples/example-02.rdoc
37
45
  - examples/example-01.rb
38
- - README
39
- - COPYING
40
- - ChangeLog
46
+ - examples/mail.rb
47
+ - examples/yaml-example2.rb
48
+ - examples/yaml-example.rb
49
+ - examples/test-datatypes.rb
50
+ - examples/mail-datatypes.rb
51
+ - lib/doodle.rb
52
+ - lib/molic_orderedhash.rb
53
+ - lib/doodle/datatypes.rb
54
+ - lib/doodle/rfc822.rb
55
+ - lib/doodle/utils.rb
56
+ - lib/doodle/version.rb
57
+ - log/debug.log
58
+ - script/console
59
+ - script/destroy
60
+ - script/generate
61
+ - script/txt2html
62
+ - setup.rb
63
+ - spec/arg_order_spec.rb
64
+ - spec/attributes_spec.rb
65
+ - spec/bugs_spec.rb
66
+ - spec/class_spec.rb
67
+ - spec/class_var_spec.rb
68
+ - spec/collector_spec.rb
69
+ - spec/conversion_spec.rb
70
+ - spec/defaults_spec.rb
71
+ - spec/doodle_context_spec.rb
72
+ - spec/doodle_spec.rb
73
+ - spec/extra_args_spec.rb
74
+ - spec/factory_spec.rb
75
+ - spec/flatten_first_level_spec.rb
76
+ - spec/init_spec.rb
77
+ - spec/new_doodle_spec.rb
78
+ - spec/required_spec.rb
79
+ - spec/serialization_spec.rb
80
+ - spec/singleton_spec.rb
81
+ - spec/spec.opts
82
+ - spec/spec_helper.rb
83
+ - spec/superclass_spec.rb
84
+ - spec/validation_spec.rb
85
+ - spec/validation2_spec.rb
86
+ - tasks/deployment.rake
87
+ - tasks/environment.rake
88
+ - tasks/rspec.rake
89
+ - tasks/website.rake
41
90
  has_rdoc: true
42
- homepage: http://doodle.rubyforge.org/
43
- post_install_message:
44
- rdoc_options: []
91
+ homepage: http://doodle.rubyforge.org
92
+ post_install_message: |
93
+ For more information on doodle, see http://doodle.rubyforge.org
45
94
 
95
+ rdoc_options:
96
+ - --main
97
+ - README.txt
46
98
  require_paths:
47
99
  - lib
48
100
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -63,16 +115,19 @@ rubyforge_project: doodle
63
115
  rubygems_version: 1.1.1
64
116
  signing_key:
65
117
  specification_version: 2
66
- summary: Declarative attribute definitions, validations and conversions
118
+ summary: "Doodle is a gem for simplifying the definition of Ruby classes by making attributes and their properties more declarative. Doodle is eco-friendly: it does not globally modify Object, Class or Module."
67
119
  test_files:
68
120
  - spec/bugs_spec.rb
121
+ - spec/class_var_spec.rb
69
122
  - spec/factory_spec.rb
70
123
  - spec/flatten_first_level_spec.rb
124
+ - spec/new_doodle_spec.rb
71
125
  - spec/attributes_spec.rb
72
126
  - spec/arg_order_spec.rb
73
127
  - spec/serialization_spec.rb
74
128
  - spec/singleton_spec.rb
75
129
  - spec/superclass_spec.rb
130
+ - spec/validation2_spec.rb
76
131
  - spec/init_spec.rb
77
132
  - spec/validation_spec.rb
78
133
  - spec/class_spec.rb
@@ -81,5 +136,6 @@ test_files:
81
136
  - spec/required_spec.rb
82
137
  - spec/defaults_spec.rb
83
138
  - spec/conversion_spec.rb
139
+ - spec/class_validation_spec.rb
84
140
  - spec/doodle_spec.rb
85
141
  - spec/doodle_context_spec.rb
data/COPYING DELETED
@@ -1,18 +0,0 @@
1
- Copyright (c) 2008 Sean O'Halpin <monkeymind.textdriven.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README DELETED
@@ -1,57 +0,0 @@
1
- = README
2
- == doodle
3
-
4
- Version 0.0.1
5
-
6
- *doodle* is my attempt at a metaprogramming framework that tries not to
7
- have to inject methods into core Ruby objects such as Object, Class
8
- and Module.
9
-
10
- While doodle itself is useful for defining classes, my main goal is to
11
- come up with a useful DSL notation for class definitions which can be
12
- reused in many contexts.
13
-
14
- Note that this is very much the first version of a
15
- work-in-progress. Despite a fair number of specifications, you can
16
- expect there to be bugs and unexpected behaviours.
17
-
18
- Read more at http://doodle.rubyforge.org
19
-
20
- == Examples
21
- === Simple example
22
-
23
- :include: examples/example-01.rdoc
24
-
25
- === More complex example
26
-
27
- :include: examples/example-02.rdoc
28
-
29
- == Known bugs
30
-
31
- * Not compatible with ruby 1.9
32
-
33
- == To do
34
-
35
- * Better documentation
36
- * Make compatible with ruby 1.9
37
- * Add examples showing other uses of DSL aspect
38
- * More specs
39
-
40
- == Similar and related libraries
41
-
42
- * traits[http://www.codeforpeople.com/lib/ruby/traits/]
43
- * attributes[http://www.codeforpeople.com/lib/ruby/attributes/]
44
-
45
- == Thanks
46
-
47
- *doodle* was developed using
48
- BDD[http://en.wikipedia.org/wiki/Behavior_driven_development] with
49
- RSpec[http://rspec.rubyforge.org/], autotest (part of the
50
- ZenTest[http://www.zenspider.com/ZSS/Products/ZenTest/] suite) and
51
- rcov[http://eigenclass.org/hiki.rb?rcov] - fantastic tools.
52
-
53
- == Confessions of a crap artist
54
-
55
- There is at least one horrible hack in there (see
56
- Doodle::Inherited#parents[classes/Doodle/Inherited.html#M000021]) -
57
- though some may consider the whole thing a horrible hack :)
@@ -1,39 +0,0 @@
1
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- require 'rubygems'
3
- require 'date'
4
- require 'pp'
5
- require 'doodle'
6
-
7
- class Location < Doodle::Base
8
- has :name, :kind => String
9
- has :events, :init => [], :collect => :Event
10
- end
11
-
12
- class Event
13
- # or if you want to inherit from another class
14
- include Doodle::Helper
15
- include Doodle::Factory
16
-
17
- has :name, :kind => String
18
- has :date do
19
- kind Date
20
- default { Date.today }
21
- must 'be >= today' do |value|
22
- value >= Date.today
23
- end
24
- from String do |s|
25
- Date.parse(s)
26
- end
27
- end
28
- has :locations, :init => [], :collect => {:place => "Location"}
29
- end
30
-
31
- event = Event "Festival" do
32
- date '2008-04-01'
33
- place "The muddy field"
34
- place "Beer tent" do
35
- event "Drinking"
36
- end
37
- end
38
-
39
- pp event
@@ -1,45 +0,0 @@
1
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- require 'doodle'
3
-
4
- # collect works for anything that provides a :<< method
5
-
6
- class Text < Doodle::Base
7
- has :text, :init => "", :collect => :part
8
- end
9
-
10
- text = Text do
11
- part "Hello"
12
- part " "
13
- part "World"
14
- end
15
-
16
- puts text.text
17
-
18
- class Lines < Doodle::Base
19
- has :lines, :init => [], :collect => :line
20
- end
21
-
22
- lines = Lines do
23
- line "Hello"
24
- line "World"
25
- end
26
-
27
- puts lines.lines.join("\n")
28
-
29
- require 'set'
30
-
31
- class Thing < Doodle::Base
32
- has :properties, :init => Set.new, :collect => :prop
33
- end
34
-
35
- # this is a contrived example
36
- thing = Thing do
37
- prop 'name'
38
- prop 'size'
39
- prop 'size'
40
- prop 'name'
41
- end
42
-
43
- thing.prop 'name'
44
- p thing
45
-
@@ -1,55 +0,0 @@
1
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- require 'doodle'
3
-
4
- # collect works for anything that provides a :<< method
5
-
6
- class Text < Doodle::Base
7
- has :text, :init => "", :collect => :part
8
- end
9
-
10
- text = Text do
11
- part "Hello"
12
- part " "
13
- part "World"
14
- end
15
-
16
- puts text.text
17
-
18
- class Lines < Doodle::Base
19
- has :lines, :init => [], :collect => :line
20
- end
21
-
22
- lines = Lines do
23
- line "Hello"
24
- line "World"
25
- end
26
-
27
- puts lines.lines.join("\n")
28
-
29
- require 'set'
30
-
31
- class Thing < Doodle::Base
32
- has :properties, :init => Set.new, :collect => :prop
33
- end
34
-
35
- # this is a contrived example
36
- thing = Thing do
37
- prop 'name'
38
- prop 'size'
39
- prop 'size'
40
- prop 'name'
41
- end
42
-
43
- thing.prop 'name'
44
- p thing
45
-
46
- # >> [:collector_klass, nil]
47
- # >> [:collector_klass, nil]
48
- # >> [:collector_klass, nil]
49
- # >> [:collector_klass, nil]
50
- # >> Hello World
51
- # >> [:collector_klass, nil]
52
- # >> Hello
53
- # >> World
54
- # >> [:collector_klass, nil]
55
- # >> #<Thing:0xb7b6a6b8 @properties=#<Set: {"name", "size"}>>