cuca 0.07 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +10 -0
  3. data/README.md +51 -0
  4. data/application_skeleton/app/test.rb +16 -0
  5. data/application_skeleton/conf/config.rb +8 -1
  6. data/application_skeleton/public/dispatch-fwdev.cgi +3 -1
  7. data/application_skeleton/public/dispatch.cgi +1 -1
  8. data/application_skeleton/public/dispatch.fcgi +1 -1
  9. data/application_skeleton/scripts/server-lighttpd-fcgi.rb +43 -4
  10. data/application_skeleton/scripts/server-lighttpd.rb +58 -5
  11. data/application_skeleton/scripts/server-webrick.rb +1 -1
  12. data/application_skeleton/tests/functional/basic.rb +32 -0
  13. data/bin/cuca +7 -3
  14. data/lib/cuca.rb +1 -1
  15. data/lib/cuca/app.rb +44 -31
  16. data/lib/cuca/cgi_emu.rb +17 -6
  17. data/lib/cuca/const.rb +1 -1
  18. data/lib/cuca/controller.rb +0 -2
  19. data/lib/cuca/generator/view.rb +7 -5
  20. data/lib/cuca/mimetypes.rb +2 -0
  21. data/lib/cuca/sessionpage.rb +18 -4
  22. data/lib/cuca/stdlib/README +2 -0
  23. data/lib/cuca/stdlib/form.rb +1 -1
  24. data/lib/cuca/stdlib/listwidget/dblist.rb +13 -2
  25. data/lib/cuca/stdlib/listwidget/querydef.rb +11 -17
  26. data/lib/cuca/test/helpers.rb +55 -2
  27. data/lib/cuca/urlmap.rb +18 -9
  28. data/tests/all.rb +4 -1
  29. data/tests/controller.rb +26 -9
  30. data/tests/test_app/app/test.rb +0 -0
  31. data/tests/urlmap.rb +7 -0
  32. data/tests/widget.rb +2 -2
  33. metadata +106 -128
  34. data/README +0 -43
  35. data/application_skeleton/public/dispatch.cgi-old +0 -18
  36. data/application_skeleton/public/dispatch.fcgi-old +0 -25
  37. data/application_skeleton/scripts/rack-test.rb +0 -52
  38. data/application_skeleton/scripts/server-rack-thin.rb +0 -40
  39. data/application_skeleton/scripts/server-rack-webrick.rb +0 -22
  40. data/lib/cuca/stdlib/old_arform.rb +0 -254
@@ -1,5 +1,8 @@
1
- require 'test/unit'
2
1
 
2
+
3
+ $: << File.expand_path(File.dirname(__FILE__) + '/../')
4
+
5
+ require 'test/unit'
3
6
  require 'tests/widget'
4
7
  require 'tests/urlmap'
5
8
  require 'tests/controller'
@@ -13,6 +13,16 @@ class TestAController < Cuca::Controller
13
13
  def post
14
14
  @_content = 'POST'
15
15
  end
16
+ def delete
17
+ @_content = 'DELETE'
18
+ end
19
+ def patch
20
+ @_content = 'PATCH'
21
+ end
22
+ def head
23
+ @_content = 'HEAD'
24
+ end
25
+
16
26
  end
17
27
  class TestBController < Cuca::Controller
18
28
  def run
@@ -54,11 +64,11 @@ class FilterController < Cuca::Controller
54
64
  def filter_pri
55
65
  @filter = ['zero']
56
66
  end
57
-
67
+
58
68
  def afilter_pri
59
69
  @_content << ')'
60
70
  end
61
-
71
+
62
72
 
63
73
  def filter_one
64
74
  @filter << 'one'
@@ -103,8 +113,8 @@ end
103
113
 
104
114
 
105
115
  class ChainAController < Cuca::Controller
106
- before_filter 'a', 1
107
- def a
116
+ before_filter 'a', 1
117
+ def a
108
118
  @out ||= ''
109
119
  @out << 'a'
110
120
  end
@@ -131,17 +141,17 @@ end
131
141
 
132
142
  class StopFilterController < Cuca::Controller
133
143
  before_filter 'stop_it'
134
-
144
+
135
145
  def stop_it
136
146
  stop :cancel_execution => true
137
147
  end
138
-
148
+
139
149
  def run
140
150
  raise "Never got here"
141
151
  end
142
152
  end
143
-
144
-
153
+
154
+
145
155
 
146
156
  class ControllerTests < Test::Unit::TestCase
147
157
 
@@ -155,6 +165,13 @@ class ControllerTests < Test::Unit::TestCase
155
165
  a = TestAController.new
156
166
  a._do('post')
157
167
  assert_equal 'POST', a.to_s
168
+ a._do('delete')
169
+ assert_equal 'DELETE', a.to_s
170
+ a._do('patch')
171
+ assert_equal 'PATCH', a.to_s
172
+ a._do('head')
173
+ assert_equal 'HEAD', a.to_s
174
+
158
175
 
159
176
  b = TestBController.new
160
177
  b._do('run')
@@ -211,6 +228,6 @@ class ControllerTests < Test::Unit::TestCase
211
228
  def test_stop_in_filter
212
229
  c = StopFilterController.new
213
230
  c.run_before_filters
214
- c._do('run')
231
+ c._do('run')
215
232
  end
216
233
  end
File without changes
@@ -91,6 +91,13 @@ class URLMapTest < Test::Unit::TestCase
91
91
 
92
92
  assert !(map.action_module.object_id == map2.action_module.object_id)
93
93
  end
94
+
95
+ def test_path_tree
96
+ map = ::Cuca::URLMap.new(path, '/agent/index')
97
+ assert_equal 2, map.path_tree.size
98
+ map = ::Cuca::URLMap.new(path, '/test')
99
+ assert_equal 1, map.path_tree.size
100
+ end
94
101
 
95
102
 
96
103
  end
@@ -86,8 +86,8 @@ class WidgetTest < Test::Unit::TestCase
86
86
 
87
87
  Cuca::Widget::clear_hints
88
88
 
89
- assert w.hints, {}
90
- assert w2.hints, {}
89
+ assert_equal w.hints, {}
90
+ assert_equal w2.hints, {}
91
91
  end
92
92
 
93
93
  def test_external_accessors
metadata CHANGED
@@ -1,174 +1,152 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cuca
3
- version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 7
9
- version: "0.07"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.12'
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Martin Boese
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2011-05-19 00:00:00 +01:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: markaby
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 1
29
- segments:
30
- - 0
31
- - 5
32
- version: "0.5"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- description: |
36
- Cuca is a light web development framework that supports CGI and FastCGI. It has
37
- a widget-bases approach to reuse functionality and does not implement an MVC architecture. Content
38
- can be generated directly by the controller with the help of external widgets that can generate code using
39
- markaby, eruby or any other user implemented 'generator'. It supports pretty URL's, layouts,
40
- sessions and the rendering of 'partials'.
41
-
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ description: "Cuca is a light web development framework that supports CGI and FastCGI.
28
+ It has \na widget-bases approach to reuse functionality and does not stricktly implement
29
+ an MVC architecture, \nalthough possible. Content can be generated directly by the
30
+ controller with the help of external \nwidgets that can generate code using markaby,
31
+ eruby or any other user implemented 'generator'. It \nsupports pretty URL's, layouts,
32
+ sessions and the rendering of 'partials'.\n"
42
33
  email: boesemar@gmx.de
43
- executables:
34
+ executables:
44
35
  - cuca
45
36
  extensions: []
46
-
47
- extra_rdoc_files:
37
+ extra_rdoc_files:
48
38
  - CHANGELOG
49
- - README
50
- files:
39
+ - README.md
40
+ files:
41
+ - CHANGELOG
42
+ - README.md
43
+ - application_skeleton/README
44
+ - application_skeleton/app/_controllers/application.rb
45
+ - application_skeleton/app/_layouts/simple.rb
46
+ - application_skeleton/app/_widgets/sourcecode.rb
47
+ - application_skeleton/app/_widgets/test.rb
48
+ - application_skeleton/app/demo.rb
49
+ - application_skeleton/app/index.rb
50
+ - application_skeleton/app/test.rb
51
+ - application_skeleton/conf/config.rb
52
+ - application_skeleton/conf/environment.rb
53
+ - application_skeleton/log/access.log
54
+ - application_skeleton/log/error.log
55
+ - application_skeleton/log/messages
56
+ - application_skeleton/public/404.html
57
+ - application_skeleton/public/500.html
58
+ - application_skeleton/public/css/style.css
59
+ - application_skeleton/public/dispatch-fwdev.cgi
60
+ - application_skeleton/public/dispatch.cgi
61
+ - application_skeleton/public/dispatch.fcgi
62
+ - application_skeleton/public/img/cuca-seagull.png
63
+ - application_skeleton/scripts/console.rb
64
+ - application_skeleton/scripts/server-lighttpd-fcgi.rb
65
+ - application_skeleton/scripts/server-lighttpd.rb
66
+ - application_skeleton/scripts/server-webrick-cgihandler.rb
67
+ - application_skeleton/scripts/server-webrick.rb
68
+ - application_skeleton/scripts/test.rb
69
+ - application_skeleton/tests/functional/basic.rb
70
+ - application_skeleton/tests/widgets/link.rb
51
71
  - bin/cuca
52
72
  - lib/cuca.rb
53
- - lib/cuca_console.rb
54
- - lib/cuca_cli.rb
55
- - lib/cuca/layout.rb
56
- - lib/cuca/cgi_emu.rb
57
73
  - lib/cuca/app.rb
74
+ - lib/cuca/app_cgi.rb
75
+ - lib/cuca/cgi_emu.rb
76
+ - lib/cuca/cgi_fix.rb
77
+ - lib/cuca/config.rb
58
78
  - lib/cuca/const.rb
59
- - lib/cuca/generator/view.rb
79
+ - lib/cuca/controller.rb
60
80
  - lib/cuca/generator/markaby.rb
61
- - lib/cuca/app_cgi.rb
62
- - lib/cuca/widget.rb
81
+ - lib/cuca/generator/view.rb
82
+ - lib/cuca/generator_context.rb
83
+ - lib/cuca/layout.rb
84
+ - lib/cuca/mimetypes.rb
63
85
  - lib/cuca/session.rb
64
86
  - lib/cuca/session.rb-cgi
65
- - lib/cuca/urlmap.rb
87
+ - lib/cuca/sessionflash.rb
66
88
  - lib/cuca/sessionpage.rb
67
- - lib/cuca/controller.rb
68
- - lib/cuca/test/helpers.rb
69
- - lib/cuca/stdlib/slink.rb
70
- - lib/cuca/stdlib/old_arform.rb
71
- - lib/cuca/stdlib/formelements.rb
89
+ - lib/cuca/stdlib/README
72
90
  - lib/cuca/stdlib/arform.rb
73
- - lib/cuca/stdlib/link.rb
74
- - lib/cuca/stdlib/list.rb
75
- - lib/cuca/stdlib/formelements.rbs
76
- - lib/cuca/stdlib/form.rb
77
91
  - lib/cuca/stdlib/arview.rb
92
+ - lib/cuca/stdlib/form.rb
93
+ - lib/cuca/stdlib/formelements.rb
94
+ - lib/cuca/stdlib/formelements.rbs
78
95
  - lib/cuca/stdlib/formerrors.rb
96
+ - lib/cuca/stdlib/link.rb
97
+ - lib/cuca/stdlib/list.rb
79
98
  - lib/cuca/stdlib/listwidget/dblist.rb
80
99
  - lib/cuca/stdlib/listwidget/list.rb
81
100
  - lib/cuca/stdlib/listwidget/querydef.rb
82
101
  - lib/cuca/stdlib/listwidget/staticdatalist.rb
83
- - lib/cuca/mimetypes.rb
84
- - lib/cuca/generator_context.rb
85
- - lib/cuca/cgi_fix.rb
86
- - lib/cuca/sessionflash.rb
87
- - lib/cuca/config.rb
102
+ - lib/cuca/stdlib/slink.rb
103
+ - lib/cuca/test/helpers.rb
104
+ - lib/cuca/urlmap.rb
105
+ - lib/cuca/widget.rb
106
+ - lib/cuca_cli.rb
107
+ - lib/cuca_console.rb
108
+ - tests/all.rb
109
+ - tests/app.rb
110
+ - tests/controller.rb
88
111
  - tests/generator_markaby.rb
89
112
  - tests/generator_view.rb
90
- - tests/app.rb
91
- - tests/widget.rb
92
- - tests/all.rb
93
- - tests/test_app/app/user/list.rb
94
- - tests/test_app/app/user/__username/index.rb
113
+ - tests/mimetypes.rb
114
+ - tests/test_app/README
95
115
  - tests/test_app/app/_views/test_template.rhtml
96
116
  - tests/test_app/app/agent/index.rb
97
117
  - tests/test_app/app/agent/list.rb
98
- - tests/test_app/conf/environment.rb
118
+ - tests/test_app/app/test.rb
119
+ - tests/test_app/app/user/__username/index.rb
120
+ - tests/test_app/app/user/list.rb
99
121
  - tests/test_app/conf/config.rb
122
+ - tests/test_app/conf/environment.rb
100
123
  - tests/test_app/log/messages
101
- - tests/test_app/README
102
124
  - tests/urlmap.rb
103
- - tests/controller.rb
104
- - tests/mimetypes.rb
105
- - application_skeleton/tests/widgets/link.rb
106
- - application_skeleton/scripts/server-lighttpd.rb
107
- - application_skeleton/scripts/server-webrick.rb
108
- - application_skeleton/scripts/server-webrick-cgihandler.rb
109
- - application_skeleton/scripts/console.rb
110
- - application_skeleton/scripts/server-rack-thin.rb
111
- - application_skeleton/scripts/test.rb
112
- - application_skeleton/scripts/server-lighttpd-fcgi.rb
113
- - application_skeleton/scripts/rack-test.rb
114
- - application_skeleton/scripts/server-rack-webrick.rb
115
- - application_skeleton/public/dispatch.fcgi
116
- - application_skeleton/public/dispatch.cgi
117
- - application_skeleton/public/dispatch.fcgi-old
118
- - application_skeleton/public/dispatch-fwdev.cgi
119
- - application_skeleton/public/css/style.css
120
- - application_skeleton/public/dispatch.cgi-old
121
- - application_skeleton/public/img/cuca-seagull.png
122
- - application_skeleton/public/500.html
123
- - application_skeleton/public/404.html
124
- - application_skeleton/app/index.rb
125
- - application_skeleton/app/demo.rb
126
- - application_skeleton/app/_controllers/application.rb
127
- - application_skeleton/app/_widgets/test.rb
128
- - application_skeleton/app/_widgets/sourcecode.rb
129
- - application_skeleton/app/_layouts/simple.rb
130
- - application_skeleton/conf/environment.rb
131
- - application_skeleton/conf/config.rb
132
- - application_skeleton/log/error.log
133
- - application_skeleton/log/messages
134
- - application_skeleton/log/access.log
135
- - application_skeleton/README
136
- - CHANGELOG
137
- - README
138
- has_rdoc: true
125
+ - tests/widget.rb
139
126
  homepage: http://cuca.rubyforge.org/
140
- licenses: []
141
-
127
+ licenses:
128
+ - MIT
129
+ metadata: {}
142
130
  post_install_message:
143
- rdoc_options:
144
- - --main
131
+ rdoc_options:
132
+ - "--main"
145
133
  - README
146
- require_paths:
134
+ require_paths:
147
135
  - lib
148
- required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
151
138
  - - ">="
152
- - !ruby/object:Gem::Version
153
- hash: 3
154
- segments:
155
- - 0
156
- version: "0"
157
- required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
- requirements:
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
160
143
  - - ">="
161
- - !ruby/object:Gem::Version
162
- hash: 3
163
- segments:
164
- - 0
165
- version: "0"
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
166
146
  requirements: []
167
-
168
147
  rubyforge_project: cuca
169
- rubygems_version: 1.3.7
148
+ rubygems_version: 2.4.8
170
149
  signing_key:
171
- specification_version: 3
150
+ specification_version: 4
172
151
  summary: A widget-based web framework
173
152
  test_files: []
174
-
data/README DELETED
@@ -1,43 +0,0 @@
1
- # = Cuca - a web application framework
2
- #
3
- # Cuca is another web application framework written in Ruby. It's made to
4
- # build applications with focus on functionality - less design. You can
5
- # create and application without writing HTML. Once written Widgets
6
- # (a smart screen element) can be reused thorough your project with
7
- # minimum effort allowing to build fast and secure web applications.
8
- #
9
- # It implements the following concepts:
10
- # * A Widget is a screen element. Can be a full page or part of it.
11
- # The Controller and the Layout are Widgets, too.
12
- # * A Controller deals with one request URI (get, post or both) and can set variables
13
- # other widgets can make use of. It can also define a Layout and filters.
14
- # * A Layout wraps the output of a controller and finally return the
15
- # built web page.
16
- # * A Generator (NOT "code generator") can be used within any Widget to help building the web content.
17
- # Cuca comes with a Markaby and eruby Generator.
18
- # * A Session can used optionally to keep stateful data.
19
- #
20
- #
21
- # == Installation & Getting started
22
- #
23
- # Download and install from the internet:
24
- #
25
- # gem install --remote cuca
26
- #
27
- #
28
- # Create an application skeleton:
29
- #
30
- # cuca my_project # this will create a new project
31
- # cd my_project
32
- # ruby ./script/server-webrick.rb
33
- #
34
- # Open http://localhost:2000/
35
- #
36
- #
37
- # == Read on
38
- #
39
- # * Cuca::Widget
40
- # * Cuca::Controller
41
- # * Cuca::Layout
42
- # * Cuca::Session
43
- # * Cuca::App
@@ -1,18 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- $cuca_path = File.dirname(__FILE__)+"/../"
4
-
5
- require 'rubygems'
6
- require 'cuca'
7
-
8
- Signal.trap("INT") do
9
- $stderr.puts "INT caught"
10
- exit
11
- end
12
-
13
- start = (Time.now.to_f * 1000).to_i
14
- application = Cuca::App.new
15
- application.cgicall
16
- stop = (Time.now.to_f * 1000).to_i
17
- dur_msec = stop - start
18
- application.logger.info("App::cgicall: #{dur_msec} msec [= #{(1000 / dur_msec).to_i} pages / second]")