ruby_mvc 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/LICENSE +19 -0
  2. data/README.md +69 -0
  3. data/lib/ruby_mvc.rb +33 -0
  4. data/lib/ruby_mvc/application.rb +53 -0
  5. data/lib/ruby_mvc/controllers/app_controller.rb +93 -0
  6. data/lib/ruby_mvc/controllers/rails_controller.rb +71 -0
  7. data/lib/ruby_mvc/models.rb +28 -0
  8. data/lib/ruby_mvc/models/array_table_model.rb +59 -0
  9. data/lib/ruby_mvc/models/keyed_array_table_model.rb +83 -0
  10. data/lib/ruby_mvc/models/table_model.rb +42 -0
  11. data/lib/ruby_mvc/module.rb +35 -0
  12. data/lib/ruby_mvc/renderers.rb +26 -0
  13. data/lib/ruby_mvc/renderers/html4_table_model_renderer.rb +100 -0
  14. data/lib/ruby_mvc/toolkit.rb +31 -0
  15. data/lib/ruby_mvc/toolkit/app.rb +32 -0
  16. data/lib/ruby_mvc/toolkit/dialog.rb +31 -0
  17. data/lib/ruby_mvc/toolkit/frame.rb +34 -0
  18. data/lib/ruby_mvc/toolkit/notification.rb +202 -0
  19. data/lib/ruby_mvc/toolkit/peers/wxruby.rb +31 -0
  20. data/lib/ruby_mvc/toolkit/peers/wxruby/app.rb +44 -0
  21. data/lib/ruby_mvc/toolkit/peers/wxruby/box_layout.rb +48 -0
  22. data/lib/ruby_mvc/toolkit/peers/wxruby/common.rb +72 -0
  23. data/lib/ruby_mvc/toolkit/peers/wxruby/frame.rb +49 -0
  24. data/lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb +87 -0
  25. data/lib/ruby_mvc/toolkit/web_view.rb +60 -0
  26. data/lib/ruby_mvc/toolkit/widget.rb +108 -0
  27. data/lib/ruby_mvc/views.rb +85 -0
  28. data/lib/ruby_mvc/views/ar_model_editor.rb +84 -0
  29. data/lib/ruby_mvc/views/ar_type_editor.rb +65 -0
  30. data/lib/ruby_mvc/views/ar_type_list.rb +45 -0
  31. data/lib/ruby_mvc/views/table_view.rb +96 -0
  32. data/lib/ruby_mvc/views/web_view.rb +65 -0
  33. data/lib/ruby_mvc/wx.rb +26 -0
  34. data/ruby_mvc.gemspec +37 -0
  35. data/sample/frame.rb +28 -0
  36. data/sample/mvc.rb +29 -0
  37. data/sample/test.html +118 -0
  38. data/sample/web_view.rb +34 -0
  39. data/test/unit/models/test_array_table_model.rb +56 -0
  40. data/test/unit/models/test_keyed_array_table_model.rb +54 -0
  41. data/test/unit/test_array_table_model.rb +38 -0
  42. metadata +107 -0
@@ -0,0 +1,26 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: wx.rb
21
+ # Created: Wed 23 Nov 2011 17:10:35 GMT
22
+ #
23
+ #####################################################################
24
+ #++
25
+
26
+ require 'ruby_mvc/toolkit/peers/wxruby'
data/ruby_mvc.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: ruby_mvc.gemspec
21
+ # Created: Sat 19 Nov 2011 11:45:06 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'rake'
27
+
28
+ Gem::Specification.new do |s|
29
+ s.name = "ruby_mvc"
30
+ s.version = "0.0.0"
31
+ s.summary = "Ruby MVC"
32
+ s.description = "A simple, cross-platform MVC framework for Ruby"
33
+ s.authors = [ "Andrew S. Townley" ]
34
+ s.email = "ast@atownley.org"
35
+ s.files = FileList['lib/**/*.rb', 'sample/**/*', 'test/**/*', '[A-Z]*', 'ruby_mvc.gemspec'].to_a
36
+ s.homepage = "https://github.com/atownley/ruby_mvc"
37
+ end
data/sample/frame.rb ADDED
@@ -0,0 +1,28 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: frame.rb
21
+ # Created: Wed 23 Nov 2011 10:53:15 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'mvc'
27
+
28
+ RubyMVC.app :title => "Test Frame", :width => 800, :height => 600
data/sample/mvc.rb ADDED
@@ -0,0 +1,29 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: mvc.rb
21
+ # Created: Wed 23 Nov 2011 10:51:08 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ $:.unshift File.join(File.dirname(__FILE__), "../lib")
27
+
28
+ require 'ruby_mvc'
29
+ require 'ruby_mvc/wx'
data/sample/test.html ADDED
@@ -0,0 +1,118 @@
1
+ <html>
2
+ <head>
3
+ <title>Test HTML</title>
4
+ </head>
5
+ <body>
6
+ <h1>Hello WebView!</h1>
7
+ <p>
8
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit
9
+ amet leo enim. Curabitur ultricies, dolor a fermentum molestie, ante
10
+ dui imperdiet magna, sed tincidunt enim nisl sit amet quam. Ut
11
+ adipiscing luctus adipiscing. Nullam elementum, arcu a molestie
12
+ laoreet, lorem arcu pretium dolor, ut auctor nisi quam eget odio.
13
+ Proin sagittis accumsan erat, a vestibulum diam pharetra ut. Nullam
14
+ vitae leo tellus, id venenatis erat. Vivamus a nisi tellus, et
15
+ volutpat augue. Nam ac massa nunc, eget consequat neque. Proin
16
+ tincidunt, eros sed pretium gravida, ipsum lectus blandit ipsum, ut
17
+ laoreet leo velit non risus. Nullam at dolor purus, vitae iaculis
18
+ lorem.
19
+ </p><p>
20
+ Pellentesque habitant morbi tristique senectus et netus et malesuada
21
+ fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci
22
+ luctus et ultrices posuere cubilia Curae; Pellentesque eu enim odio.
23
+ Sed rhoncus ornare magna, lacinia porttitor nunc tincidunt ut.
24
+ Vestibulum sed placerat nunc. Nulla ut eros eget urna ornare volutpat.
25
+ Suspendisse egestas lacus vitae velit congue ut tincidunt mauris
26
+ faucibus. Donec non felis est, a fermentum quam. Morbi auctor justo
27
+ non nibh rhoncus sed consequat nibh sollicitudin. Vivamus consectetur,
28
+ eros eu lobortis dignissim, justo sapien mollis metus, ac vehicula
29
+ velit leo in nisi. Suspendisse potenti. Suspendisse ut eleifend enim.
30
+ Donec dignissim tincidunt purus vitae tempor.
31
+ </p><p>
32
+ Aenean felis elit, facilisis at dapibus varius, vulputate ac nisl.
33
+ Vestibulum cursus semper fermentum. Duis consectetur ante et mauris
34
+ tempor gravida. Praesent sodales magna tortor, nec dapibus est. Aenean
35
+ laoreet mollis arcu, ut gravida felis scelerisque non. Proin dapibus
36
+ volutpat sapien, eget tincidunt enim tincidunt non. Nullam a lacus
37
+ arcu, at imperdiet nisl. Proin hendrerit imperdiet tellus sit amet
38
+ facilisis. Morbi eu massa tempus erat ullamcorper fringilla id in
39
+ ligula. Nam egestas blandit elementum. Duis congue justo id leo
40
+ bibendum congue. Mauris semper dictum quam, eu consectetur mi commodo
41
+ eget.
42
+ </p><p>
43
+ Aenean id quam nec dolor fringilla rutrum. Nunc malesuada fermentum
44
+ purus ut aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing
45
+ elit. Praesent quis velit eu tortor elementum vestibulum. Pellentesque
46
+ enim mauris, dapibus sed auctor vel, facilisis commodo nisi. Aenean
47
+ tempor consequat quam, ac volutpat ante convallis vel. Donec ac
48
+ aliquet velit. Integer non nulla felis, non sodales risus.
49
+ </p><p>
50
+ Nulla vitae est sem, nec feugiat ligula. Quisque nec neque et quam
51
+ suscipit lobortis et at elit. Praesent pretium dui quis nisi euismod
52
+ in fringilla enim luctus. Aenean eget quam orci, sed sodales nibh.
53
+ Praesent ante ipsum, tristique sit amet luctus in, fringilla ac quam.
54
+ Phasellus non neque non tellus aliquet suscipit. Aenean at turpis
55
+ erat. In hac habitasse platea dictumst. Donec sed cursus leo. Nam a
56
+ purus sit amet orci consectetur ullamcorper volutpat id eros.
57
+ </p><p>
58
+ Phasellus venenatis est ac diam ornare quis eleifend neque euismod.
59
+ Mauris semper sollicitudin ante, vel hendrerit mi pretium sit amet.
60
+ Pellentesque vulputate euismod augue, at tincidunt orci iaculis ac.
61
+ Fusce in imperdiet nunc. Pellentesque eget sapien non lorem congue
62
+ mollis. Donec lobortis rutrum orci in suscipit. Aliquam non
63
+ pellentesque lacus. Cras dignissim sapien vitae ipsum viverra
64
+ placerat. Fusce hendrerit tincidunt tortor in mollis. Proin tempor
65
+ urna eget nulla gravida aliquam. Sed suscipit, lacus non volutpat
66
+ mollis, lectus ligula cursus diam, non vulputate turpis ipsum nec
67
+ quam.
68
+ </p><p>
69
+ Integer interdum nisi sed leo pharetra at ultrices ipsum mollis.
70
+ Maecenas interdum elit ut diam viverra et fermentum dui porta.
71
+ Curabitur cursus dictum dictum. Integer hendrerit malesuada massa vel
72
+ auctor. Donec eu tincidunt nulla. Vestibulum velit ipsum, pharetra vel
73
+ sodales id, fermentum id dui. Phasellus fringilla rutrum tortor,
74
+ molestie feugiat quam laoreet in. Quisque lacinia, nunc eu auctor
75
+ tempus, ipsum nulla eleifend nisi, non venenatis purus urna ac nisi.
76
+ Vestibulum sed eros at arcu hendrerit scelerisque at non ligula.
77
+ Quisque pharetra congue massa sed pretium. Aenean bibendum ante vitae
78
+ ligula tincidunt sollicitudin. Integer hendrerit justo a lacus
79
+ tristique ac aliquet diam suscipit. Suspendisse potenti. Donec eu
80
+ augue non ante ornare adipiscing.
81
+ </p><p>
82
+ Nunc porta risus sed purus dapibus auctor. Duis facilisis, orci id
83
+ sagittis vulputate, erat velit molestie est, nec facilisis tortor nisi
84
+ vel nibh. Nulla eleifend condimentum viverra. Nulla dolor urna,
85
+ vehicula et iaculis nec, aliquam vel magna. Nam faucibus enim vel
86
+ tellus luctus eu condimentum felis malesuada. Duis vitae ipsum erat,
87
+ sit amet commodo nibh. Suspendisse dictum congue elementum. Donec eu
88
+ elit id dolor elementum placerat. Nulla est augue, vestibulum vitae
89
+ facilisis eu, sagittis eget tortor. Aenean ultrices rhoncus erat sit
90
+ amet pulvinar. Mauris et dolor ut elit pellentesque rhoncus.
91
+ </p><p>
92
+ Integer placerat urna ante. Lorem ipsum dolor sit amet, consectetur
93
+ adipiscing elit. Fusce ut lacus id purus imperdiet blandit. Quisque
94
+ fermentum turpis eget elit dapibus semper. Quisque id ullamcorper
95
+ nulla. Nunc vestibulum sapien vitae ante ultricies pellentesque. Fusce
96
+ commodo nibh sollicitudin nulla mollis tincidunt. Sed lacinia nulla
97
+ pharetra velit blandit lobortis. Phasellus elit erat, eleifend quis
98
+ sagittis non, vehicula sed nisi. Proin ornare sem quis sapien
99
+ venenatis dapibus. Pellentesque sem quam, interdum in aliquet id,
100
+ placerat id risus. Sed auctor convallis vehicula. Aenean congue rutrum
101
+ blandit. Mauris nec magna magna, sit amet iaculis purus. Sed mollis
102
+ tincidunt nulla, sed porta dui dapibus vitae.
103
+ </p><p>
104
+ Integer ligula tellus, fringilla in malesuada at, cursus nec sapien.
105
+ Vestibulum id justo at massa lobortis porta sit amet quis elit. Nulla
106
+ massa nisl, malesuada non varius molestie, tempor et nisi.
107
+ Pellentesque habitant morbi tristique senectus et netus et malesuada
108
+ fames ac turpis egestas. Vivamus ac dolor nec urna bibendum feugiat.
109
+ Sed tristique tellus quis ante consectetur consectetur. Quisque velit
110
+ neque, iaculis ullamcorper sodales eu, auctor eget dolor. Phasellus
111
+ facilisis viverra sapien in facilisis. Suspendisse vulputate tempor
112
+ cursus. Pellentesque porttitor dui a nisi posuere sit amet lacinia
113
+ eros consequat. Vivamus varius tempus nibh, quis euismod ligula
114
+ pretium at. Sed elementum mi fermentum leo facilisis quis malesuada
115
+ massa consequat.
116
+ </p>
117
+ </body>
118
+ </html>
@@ -0,0 +1,34 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: web_view.rb
21
+ # Created: Wed 23 Nov 2011 13:11:34 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'mvc'
27
+
28
+ include RubyMVC
29
+
30
+ RubyMVC.app :title => "WebView", :width => 800, :height => 600 do
31
+ html = Toolkit::WebView.new
32
+ frame.add(html)
33
+ html.open "test.html"
34
+ end
@@ -0,0 +1,56 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: test_array_table_model.rb
21
+ # Created: Sat 19 Nov 2011 20:00:25 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'testy'
27
+ require 'ruby_mvc/models'
28
+
29
+ include RubyMVC::Models
30
+
31
+ Testy.testing "Core ArrayTableModel tests" do
32
+ test "Basic functionality" do |result|
33
+ keys = [ :foo, :bar ]
34
+ data = [
35
+ { :foo => "Foo1", :bar => "Bar1" },
36
+ { :foo => "Foo2", :bar => "Bar2" } ]
37
+
38
+ model = ArrayTableModel.new(data)
39
+ model.each_with_index do |row, i|
40
+ keys.each do |key|
41
+ result.check "row[#{i}][:#{key}] value is correct",
42
+ :expect => data[i][key],
43
+ :actual => row[key]
44
+ end
45
+ end
46
+
47
+ data << { :foo => "Foo3", :bar => "Bar3" }
48
+ model.each_with_index do |row, i|
49
+ keys.each do |key|
50
+ result.check "row[#{i}][:#{key}] value is correct after add",
51
+ :expect => data[i][key],
52
+ :actual => row[key]
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,54 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: test_keyed_array_table_model.rb
21
+ # Created: Sat 19 Nov 2011 19:17:50 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'testy'
27
+ require 'shoes_mvc/models'
28
+
29
+ include ShoesMVC::Models
30
+
31
+ Testy.testing "Core KeyedArrayTableModel tests" do
32
+ test "Basic functionality" do |result|
33
+ keys = %w( foo bar )
34
+ data = [ [ "Foo1", "Bar1" ], [ "Foo2", "Bar2" ] ]
35
+
36
+ model = KeyedArrayTableModel.new(keys, data)
37
+ model.each_with_index do |row, i|
38
+ keys.each_with_index do |key, j|
39
+ result.check "row[#{i}][:#{key}] value is correct",
40
+ :expect => data[i][j],
41
+ :actual => row[key]
42
+ end
43
+ end
44
+
45
+ data << [ "Foo3", "Bar3" ]
46
+ model.each_with_index do |row, i|
47
+ keys.each_with_index do |key, j|
48
+ result.check "row[#{i}][:#{key}] value is correct after add",
49
+ :expect => data[i][j],
50
+ :actual => row[key]
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,38 @@
1
+ #--
2
+ ######################################################################
3
+ #
4
+ # Copyright 2011 Andrew S. Townley
5
+ #
6
+ # Permission to use, copy, modify, and disribute this software for
7
+ # any purpose with or without fee is hereby granted, provided that
8
+ # the above copyright notices and this permission notice appear in
9
+ # all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
12
+ # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14
+ # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT OR
15
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
17
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ #
20
+ # File: test_ruby_mvc.rb
21
+ # Created: Mon 21 Nov 2011 18:10:45 GMT
22
+ #
23
+ ######################################################################
24
+ #++
25
+
26
+ require 'testy'
27
+ require 'ruby_mvc/module'
28
+
29
+ Testy.testing "Core module tests" do
30
+ test "Basic functionality" do |result|
31
+ data = %w( some_path some_path module_klass )
32
+ %w( /some_path /somePath Module::Klass ).each_with_index do |uri, i|
33
+ result.check "uri to method_name #{uri}",
34
+ :expect => data[i],
35
+ :actual => RubyMVC.method_name(uri)
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_mvc
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Andrew S. Townley
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-24 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: A simple, cross-platform MVC framework for Ruby
23
+ email: ast@atownley.org
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/ruby_mvc/application.rb
32
+ - lib/ruby_mvc/controllers/app_controller.rb
33
+ - lib/ruby_mvc/controllers/rails_controller.rb
34
+ - lib/ruby_mvc/models/array_table_model.rb
35
+ - lib/ruby_mvc/models/keyed_array_table_model.rb
36
+ - lib/ruby_mvc/models/table_model.rb
37
+ - lib/ruby_mvc/models.rb
38
+ - lib/ruby_mvc/module.rb
39
+ - lib/ruby_mvc/renderers/html4_table_model_renderer.rb
40
+ - lib/ruby_mvc/renderers.rb
41
+ - lib/ruby_mvc/toolkit/app.rb
42
+ - lib/ruby_mvc/toolkit/dialog.rb
43
+ - lib/ruby_mvc/toolkit/frame.rb
44
+ - lib/ruby_mvc/toolkit/notification.rb
45
+ - lib/ruby_mvc/toolkit/peers/wxruby/app.rb
46
+ - lib/ruby_mvc/toolkit/peers/wxruby/box_layout.rb
47
+ - lib/ruby_mvc/toolkit/peers/wxruby/common.rb
48
+ - lib/ruby_mvc/toolkit/peers/wxruby/frame.rb
49
+ - lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb
50
+ - lib/ruby_mvc/toolkit/peers/wxruby.rb
51
+ - lib/ruby_mvc/toolkit/web_view.rb
52
+ - lib/ruby_mvc/toolkit/widget.rb
53
+ - lib/ruby_mvc/toolkit.rb
54
+ - lib/ruby_mvc/views/ar_model_editor.rb
55
+ - lib/ruby_mvc/views/ar_type_editor.rb
56
+ - lib/ruby_mvc/views/ar_type_list.rb
57
+ - lib/ruby_mvc/views/table_view.rb
58
+ - lib/ruby_mvc/views/web_view.rb
59
+ - lib/ruby_mvc/views.rb
60
+ - lib/ruby_mvc/wx.rb
61
+ - lib/ruby_mvc.rb
62
+ - sample/frame.rb
63
+ - sample/mvc.rb
64
+ - sample/test.html
65
+ - sample/web_view.rb
66
+ - test/unit/models/test_array_table_model.rb
67
+ - test/unit/models/test_keyed_array_table_model.rb
68
+ - test/unit/test_array_table_model.rb
69
+ - LICENSE
70
+ - README.md
71
+ - ruby_mvc.gemspec
72
+ has_rdoc: true
73
+ homepage: https://github.com/atownley/ruby_mvc
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options: []
78
+
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ requirements: []
100
+
101
+ rubyforge_project:
102
+ rubygems_version: 1.6.2
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Ruby MVC
106
+ test_files: []
107
+