ramaze 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -259
- data/bin/ramaze +52 -25
- data/doc/AUTHORS +6 -0
- data/doc/CHANGELOG +1363 -42
- data/doc/INSTALL +1 -1
- data/doc/README +48 -35
- data/doc/README.html +637 -0
- data/doc/TODO +7 -16
- data/doc/allison/allison.css +6 -7
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/cache/STYLE +1 -2
- data/doc/changes.txt +3375 -0
- data/doc/changes.xml +3378 -0
- data/doc/meta/announcement.txt +47 -0
- data/doc/meta/configuration.txt +179 -0
- data/doc/meta/internals.txt +111 -0
- data/doc/readme_chunks/features.txt +8 -16
- data/doc/readme_chunks/installing.txt +7 -1
- data/doc/tutorial/todolist.txt +2 -3
- data/examples/blog/main.rb +9 -8
- data/examples/blog/public/styles/blog.css +132 -0
- data/examples/blog/src/controller.rb +14 -41
- data/examples/blog/src/model.rb +12 -13
- data/examples/blog/src/view.rb +16 -0
- data/examples/blog/template/edit.xhtml +19 -8
- data/examples/blog/template/index.xhtml +14 -22
- data/examples/blog/template/new.xhtml +18 -5
- data/examples/caching.rb +5 -8
- data/examples/element.rb +3 -3
- data/examples/hello.rb +3 -5
- data/examples/simple.rb +4 -7
- data/examples/templates/template/external.haml +8 -7
- data/examples/templates/template/external.mab +11 -8
- data/examples/templates/template_amrita2.rb +4 -4
- data/examples/templates/template_erubis.rb +3 -3
- data/examples/templates/template_ezamar.rb +1 -2
- data/examples/templates/template_haml.rb +24 -23
- data/examples/templates/template_liquid.rb +3 -1
- data/examples/templates/template_markaby.rb +15 -9
- data/examples/todolist/src/element/page.rb +1 -1
- data/lib/proto/conf/benchmark.yaml +6 -20
- data/lib/proto/conf/debug.yaml +6 -19
- data/lib/proto/conf/live.yaml +7 -19
- data/lib/proto/conf/silent.yaml +6 -16
- data/lib/proto/conf/stage.yaml +6 -18
- data/lib/proto/public/error.zmr +2 -2
- data/lib/ramaze.rb +34 -72
- data/lib/ramaze/adapter.rb +21 -18
- data/lib/ramaze/adapter/mongrel.rb +0 -3
- data/lib/ramaze/adapter/webrick.rb +6 -6
- data/lib/ramaze/cache/memcached.rb +3 -0
- data/lib/ramaze/controller.rb +227 -183
- data/lib/ramaze/dispatcher.rb +34 -129
- data/lib/ramaze/dispatcher/action.rb +28 -0
- data/lib/ramaze/dispatcher/error.rb +43 -0
- data/lib/ramaze/dispatcher/file.rb +34 -0
- data/lib/ramaze/global.rb +89 -48
- data/lib/ramaze/helper/aspect.rb +8 -6
- data/lib/ramaze/helper/auth.rb +3 -3
- data/lib/ramaze/helper/cache.rb +2 -2
- data/lib/ramaze/helper/file.rb +14 -0
- data/lib/ramaze/helper/inform.rb +36 -0
- data/lib/ramaze/helper/link.rb +7 -3
- data/lib/ramaze/helper/markaby.rb +30 -0
- data/lib/ramaze/helper/redirect.rb +2 -0
- data/lib/ramaze/inform.rb +8 -182
- data/lib/ramaze/inform/analogger.rb +19 -0
- data/lib/ramaze/inform/growl.rb +28 -0
- data/lib/ramaze/inform/hub.rb +26 -0
- data/lib/ramaze/inform/informer.rb +92 -0
- data/lib/ramaze/inform/informing.rb +44 -0
- data/lib/ramaze/inform/syslog.rb +27 -0
- data/lib/ramaze/inform/xosd.rb +42 -0
- data/lib/ramaze/snippets.rb +6 -2
- data/lib/ramaze/snippets/object/traits.rb +13 -1
- data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
- data/lib/ramaze/snippets/string/color.rb +27 -0
- data/lib/ramaze/snippets/string/each.rb +6 -0
- data/lib/ramaze/snippets/struct/fill.rb +15 -0
- data/lib/ramaze/template/ezamar.rb +13 -22
- data/lib/ramaze/template/ezamar/element.rb +12 -12
- data/lib/ramaze/template/liquid.rb +19 -18
- data/lib/ramaze/template/markaby.rb +37 -58
- data/lib/ramaze/tool/localize.rb +128 -0
- data/lib/ramaze/tool/tidy.rb +51 -21
- data/lib/ramaze/trinity.rb +3 -3
- data/lib/ramaze/trinity/request.rb +41 -23
- data/lib/ramaze/trinity/response.rb +10 -5
- data/lib/ramaze/trinity/session.rb +17 -3
- data/lib/ramaze/version.rb +2 -2
- data/rake_tasks/conf.rake +56 -0
- data/rake_tasks/gem.rake +44 -0
- data/rake_tasks/maintaince.rake +187 -0
- data/spec/all.rb +32 -0
- data/spec/examples/caching.rb +19 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +11 -0
- data/spec/examples/simple.rb +51 -0
- data/spec/examples/templates/template_amrita2.rb +14 -0
- data/spec/examples/templates/template_erubis.rb +21 -0
- data/spec/examples/templates/template_ezamar.rb +22 -0
- data/spec/examples/templates/template_haml.rb +23 -0
- data/spec/examples/templates/template_liquid.rb +24 -0
- data/spec/examples/templates/template_markaby.rb +21 -0
- data/spec/helper.rb +81 -0
- data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
- data/spec/helper/layout.rb +55 -0
- data/spec/helper/mock_http.rb +66 -0
- data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
- data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
- data/spec/helper/wrap.rb +193 -0
- data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
- data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
- data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
- data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
- data/spec/ramaze/conf/locale_de.yaml +6 -0
- data/spec/ramaze/conf/locale_en.yaml +6 -0
- data/spec/ramaze/controller.rb +184 -0
- data/spec/ramaze/controller/template/greet.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +54 -0
- data/spec/ramaze/dependencies.rb +16 -0
- data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
- data/spec/ramaze/error.rb +64 -0
- data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
- data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
- data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
- data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
- data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
- data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
- data/spec/ramaze/helper/file.rb +17 -0
- data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
- data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
- data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
- data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
- data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
- data/spec/ramaze/inform/informer.rb +40 -0
- data/spec/ramaze/inform/syslog.rb +10 -0
- data/spec/ramaze/localize.rb +40 -0
- data/spec/ramaze/morpher.rb +82 -0
- data/spec/ramaze/params.rb +124 -0
- data/spec/{public → ramaze/public}/error404.xhtml +0 -0
- data/spec/{public → ramaze/public}/favicon.ico +0 -0
- data/spec/{public → ramaze/public}/ramaze.png +0 -0
- data/spec/{public → ramaze/public}/test_download.css +0 -0
- data/spec/ramaze/request.rb +129 -0
- data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
- data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
- data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
- data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
- data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
- data/spec/ramaze/template.rb +86 -0
- data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
- data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
- data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
- data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
- data/spec/ramaze/template/ezamar.rb +62 -0
- data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
- data/spec/ramaze/template/ezamar/nested.zmr +1 -0
- data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
- data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
- data/spec/{template → ramaze/template}/haml/index.haml +0 -0
- data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
- data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
- data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
- data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
- data/spec/ramaze/template/markaby.rb +59 -0
- data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
- data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
- metadata +145 -81
- data/examples/blog/public/screen.css +0 -106
- data/examples/blog/src/element.rb +0 -58
- data/examples/blog/template/view.xhtml +0 -15
- data/examples/blog/test/tc_entry.rb +0 -18
- data/lib/proto/public/404.jpg +0 -0
- data/spec/request_tc_helper.rb +0 -135
- data/spec/spec_all.rb +0 -118
- data/spec/spec_helper.rb +0 -66
- data/spec/tc_controller.rb +0 -49
- data/spec/tc_dependencies.rb +0 -13
- data/spec/tc_error.rb +0 -43
- data/spec/tc_morpher.rb +0 -88
- data/spec/tc_params.rb +0 -125
- data/spec/tc_template_ezamar.rb +0 -64
- data/spec/tc_template_markaby.rb +0 -72
- data/spec/template/ezamar/nested.zmr +0 -1
@@ -6,14 +6,17 @@ html do
|
|
6
6
|
h1 "The #{@action} Template for Markaby"
|
7
7
|
a("Home", :href => R(:/))
|
8
8
|
p do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
10
|
+
br
|
11
|
+
a("external/one", :href => Rs(@action, :one))
|
12
|
+
br
|
13
|
+
a("external/one/two/three", :href => Rs(@action, :one, :two, :three))
|
14
|
+
br
|
15
|
+
a("external/one?foo=bar", :href => Rs(@action, :one, :foo => :bar))
|
16
|
+
br
|
15
17
|
end
|
16
|
-
div
|
18
|
+
div do
|
19
|
+
text "The arguments you have passed to this action are:"
|
17
20
|
if @args.empty?
|
18
21
|
"none"
|
19
22
|
else
|
@@ -22,6 +25,6 @@ html do
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
25
|
-
div request.params.inspect
|
28
|
+
div @request.params.inspect
|
26
29
|
end
|
27
30
|
end
|
@@ -9,15 +9,15 @@ include Ramaze
|
|
9
9
|
# implement the amrita2 example, man, this engine is awkward :P
|
10
10
|
|
11
11
|
class MainController < Controller
|
12
|
-
|
12
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
13
13
|
trait :engine => Template::Amrita2
|
14
14
|
|
15
15
|
def index
|
16
|
-
%{ #{
|
16
|
+
%{ #{Rs()} | #{Rs(:internal)} | #{Rs(:external)} }
|
17
17
|
end
|
18
18
|
|
19
19
|
def title
|
20
|
-
"The
|
20
|
+
"The #@action Template for Amrita2"
|
21
21
|
end
|
22
22
|
|
23
23
|
def link_home
|
@@ -45,4 +45,4 @@ class MainController < Controller
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
start
|
48
|
+
Ramaze.start
|
@@ -6,7 +6,7 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
-
|
9
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
10
10
|
trait :engine => Template::Erubis
|
11
11
|
|
12
12
|
def index
|
@@ -15,13 +15,13 @@ class MainController < Controller
|
|
15
15
|
|
16
16
|
def internal *args
|
17
17
|
@args = args
|
18
|
-
|
18
|
+
%q{
|
19
19
|
<html>
|
20
20
|
<head>
|
21
21
|
<title>Template::Erubis internal</title>
|
22
22
|
</head>
|
23
23
|
<body>
|
24
|
-
<h1>The <%= @action %> Template</h1>
|
24
|
+
<h1>The <%= @action %> Template for Erubis</h1>
|
25
25
|
<%= link :/, :title => 'Home' %>
|
26
26
|
<p>
|
27
27
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
@@ -6,8 +6,7 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
-
|
10
|
-
helper :link
|
9
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
11
10
|
|
12
11
|
def index
|
13
12
|
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
@@ -6,7 +6,7 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
-
|
9
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
10
10
|
trait :engine => Template::Haml
|
11
11
|
|
12
12
|
def index
|
@@ -15,30 +15,31 @@ class MainController < Controller
|
|
15
15
|
|
16
16
|
def internal *args
|
17
17
|
@args = args
|
18
|
-
@title = "The
|
18
|
+
@title = "The #@action Template for Haml"
|
19
19
|
|
20
20
|
%q{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
%
|
21
|
+
%html
|
22
|
+
%head
|
23
|
+
%title Template::Haml internal
|
24
|
+
%body
|
25
|
+
%h1= @title
|
26
|
+
= Rs(:/, :title => 'Home')
|
27
|
+
%p
|
28
|
+
Here you can pass some stuff if you like, parameters are just passed like this:
|
29
|
+
%br/
|
30
|
+
= link( R(self, @action, :one), :title => "#@action/one")
|
31
|
+
%br/
|
32
|
+
= link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
|
33
|
+
%br/
|
34
|
+
= link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
|
35
|
+
%div
|
36
|
+
The arguments you have passed to this action are:
|
37
|
+
- if @args.empty?
|
38
|
+
none
|
39
|
+
- else
|
40
|
+
- @args.each do |arg|
|
41
|
+
%span= arg
|
42
|
+
%div= request.params.inspect
|
42
43
|
}
|
43
44
|
end
|
44
45
|
|
@@ -6,14 +6,16 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
9
10
|
trait :engine => Template::Liquid
|
11
|
+
|
10
12
|
def index
|
11
13
|
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
12
14
|
end
|
13
15
|
|
14
16
|
def liquid_hash(*args)
|
15
17
|
{
|
16
|
-
'header' => "The #{@action} Template",
|
18
|
+
'header' => "The #{@action} Template for Liquid",
|
17
19
|
'link_home' => link( :/, :title => 'Home'),
|
18
20
|
'link_one' => link(self, @action, :one, :title => "#@action/one"),
|
19
21
|
'link_two' => link(self, @action, :one, :two, :three, :title => "#@action/one/two/three"),
|
@@ -6,14 +6,17 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
+
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
9
10
|
trait :engine => Template::Markaby
|
11
|
+
|
12
|
+
helper :markaby
|
13
|
+
|
10
14
|
def index
|
11
|
-
%{ #{
|
15
|
+
%{ #{Rlink self.class} | #{Rlink self.class, :internal} | #{Rlink self.class, :external} }
|
12
16
|
end
|
13
17
|
|
14
18
|
def internal *args
|
15
|
-
@args
|
16
|
-
mab do
|
19
|
+
mab :action => @action, :args => args, :request => request, :this => self do
|
17
20
|
html do
|
18
21
|
head do
|
19
22
|
title "Template::Markaby internal"
|
@@ -21,16 +24,18 @@ class MainController < Controller
|
|
21
24
|
body do
|
22
25
|
h1 "The #{@action} Template for Markaby"
|
23
26
|
a("Home", :href => R(:/))
|
24
|
-
p
|
27
|
+
p do
|
28
|
+
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
25
29
|
br
|
26
|
-
a("external/one", :href => R(
|
30
|
+
a("external/one", :href => R(@this, @action, :one))
|
27
31
|
br
|
28
|
-
a("external/one/two/three", :href => R(
|
32
|
+
a("external/one/two/three", :href => R(@this, @action, :one, :two, :three))
|
29
33
|
br
|
30
|
-
a("external/one?foo=bar", :href => R(
|
34
|
+
a("external/one?foo=bar", :href => R(@this, @action, :one, :foo => :bar))
|
31
35
|
br
|
32
36
|
end
|
33
|
-
div
|
37
|
+
div do
|
38
|
+
text "The arguments you have passed to this action are:"
|
34
39
|
if @args.empty?
|
35
40
|
"none"
|
36
41
|
else
|
@@ -39,7 +44,7 @@ class MainController < Controller
|
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
42
|
-
div request.params.inspect
|
47
|
+
div @request.params.inspect
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end.to_s
|
@@ -47,6 +52,7 @@ class MainController < Controller
|
|
47
52
|
|
48
53
|
def external *args
|
49
54
|
@args = args
|
55
|
+
@request = request
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|
@@ -11,25 +11,11 @@ mapping:
|
|
11
11
|
/: :MainController
|
12
12
|
|
13
13
|
|
14
|
-
host:
|
15
|
-
|
16
|
-
|
17
|
-
error_page: true
|
18
|
-
autoreload: 60
|
14
|
+
host: 0.0.0.0
|
15
|
+
error_page: true
|
16
|
+
autoreload: 60
|
19
17
|
|
20
|
-
cache:
|
21
|
-
cache_all:
|
18
|
+
cache: :MemoryCache
|
19
|
+
cache_all: false
|
22
20
|
|
23
|
-
|
24
|
-
inform_timestamp: "%Y-%m-%d %H:%M:%S"
|
25
|
-
inform_prefix_error: "ERROR"
|
26
|
-
inform_prefix_debug: "DEBUG"
|
27
|
-
inform_prefix_info: "INFO "
|
28
|
-
inform_backtrace_size: 10
|
29
|
-
|
30
|
-
inform_tags: !ruby/object:Set
|
31
|
-
hash:
|
32
|
-
:benchmark: true
|
33
|
-
:debug: true
|
34
|
-
:info: true
|
35
|
-
:error: true
|
21
|
+
benchmarking: true
|
data/lib/proto/conf/debug.yaml
CHANGED
@@ -11,24 +11,11 @@ mapping:
|
|
11
11
|
/: :MainController
|
12
12
|
|
13
13
|
|
14
|
-
host:
|
15
|
-
|
16
|
-
|
17
|
-
error_page: true
|
18
|
-
autoreload: 5
|
14
|
+
host: 0.0.0.0
|
15
|
+
error_page: true
|
16
|
+
autoreload: 5
|
19
17
|
|
20
|
-
cache:
|
21
|
-
cache_all:
|
18
|
+
cache: :MemoryCache
|
19
|
+
cache_all: false
|
22
20
|
|
23
|
-
|
24
|
-
inform_timestamp: "%Y-%m-%d %H:%M:%S"
|
25
|
-
inform_prefix_error: "ERROR"
|
26
|
-
inform_prefix_debug: "DEBUG"
|
27
|
-
inform_prefix_info: "INFO "
|
28
|
-
inform_backtrace_size: 10
|
29
|
-
|
30
|
-
inform_tags: !ruby/object:Set
|
31
|
-
hash:
|
32
|
-
:debug: true
|
33
|
-
:info: true
|
34
|
-
:error: true
|
21
|
+
benchmarking: false
|
data/lib/proto/conf/live.yaml
CHANGED
@@ -3,7 +3,7 @@ port: !ruby/range
|
|
3
3
|
begin: 7000
|
4
4
|
end: 7000
|
5
5
|
|
6
|
-
adapter: :
|
6
|
+
adapter: :mongrel
|
7
7
|
|
8
8
|
template_root: "template"
|
9
9
|
|
@@ -11,23 +11,11 @@ mapping:
|
|
11
11
|
/: :MainController
|
12
12
|
|
13
13
|
|
14
|
-
host:
|
15
|
-
|
16
|
-
|
17
|
-
error_page: true
|
18
|
-
autoreload: 60
|
14
|
+
host: 0.0.0.0
|
15
|
+
error_page: true
|
16
|
+
autoreload: 60
|
19
17
|
|
20
|
-
cache:
|
21
|
-
cache_all:
|
18
|
+
cache: :MemoryCache
|
19
|
+
cache_all: false
|
22
20
|
|
23
|
-
|
24
|
-
inform_timestamp: "%Y-%m-%d %H:%M:%S"
|
25
|
-
inform_prefix_error: "ERROR"
|
26
|
-
inform_prefix_debug: "DEBUG"
|
27
|
-
inform_prefix_info: "INFO "
|
28
|
-
inform_backtrace_size: 10
|
29
|
-
|
30
|
-
inform_tags: !ruby/object:Set
|
31
|
-
hash:
|
32
|
-
:info: true
|
33
|
-
:error: true
|
21
|
+
benchmarking: false
|
data/lib/proto/conf/silent.yaml
CHANGED
@@ -11,21 +11,11 @@ mapping:
|
|
11
11
|
/: :MainController
|
12
12
|
|
13
13
|
|
14
|
-
host:
|
15
|
-
|
16
|
-
|
17
|
-
error_page: true
|
18
|
-
autoreload: 60
|
14
|
+
host: 0.0.0.0
|
15
|
+
error_page: true
|
16
|
+
autoreload: 5
|
19
17
|
|
20
|
-
cache:
|
21
|
-
cache_all:
|
18
|
+
cache: :MemoryCache
|
19
|
+
cache_all: false
|
22
20
|
|
23
|
-
|
24
|
-
inform_timestamp: "%Y-%m-%d %H:%M:%S"
|
25
|
-
inform_prefix_error: "ERROR"
|
26
|
-
inform_prefix_debug: "DEBUG"
|
27
|
-
inform_prefix_info: "INFO "
|
28
|
-
inform_backtrace_size: 10
|
29
|
-
|
30
|
-
inform_tags: !ruby/object:Set
|
31
|
-
hash: {}
|
21
|
+
benchmarking: false
|
data/lib/proto/conf/stage.yaml
CHANGED
@@ -11,23 +11,11 @@ mapping:
|
|
11
11
|
/: :MainController
|
12
12
|
|
13
13
|
|
14
|
-
host:
|
15
|
-
|
16
|
-
|
17
|
-
error_page: true
|
18
|
-
autoreload: 60
|
14
|
+
host: 0.0.0.0
|
15
|
+
error_page: true
|
16
|
+
autoreload: 60
|
19
17
|
|
20
|
-
cache:
|
21
|
-
cache_all:
|
18
|
+
cache: :MemoryCache
|
19
|
+
cache_all: false
|
22
20
|
|
23
|
-
|
24
|
-
inform_timestamp: "%Y-%m-%d %H:%M:%S"
|
25
|
-
inform_prefix_error: "ERROR"
|
26
|
-
inform_prefix_debug: "DEBUG"
|
27
|
-
inform_prefix_info: "INFO "
|
28
|
-
inform_backtrace_size: 10
|
29
|
-
|
30
|
-
inform_tags: !ruby/object:Set
|
31
|
-
hash:
|
32
|
-
:info: true
|
33
|
-
:error: true
|
21
|
+
benchmarking: false
|
data/lib/proto/public/error.zmr
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
options = {
|
36
36
|
:wrap => :div,
|
37
37
|
:line_numbers => :inline,
|
38
|
-
:line_number_start => (lineno.to_i - Global.
|
38
|
+
:line_number_start => (lineno.to_i - Global.backtrace_size)
|
39
39
|
}
|
40
40
|
?>
|
41
41
|
#{CodeRay.scan(code, :ruby).html(options)}
|
@@ -43,7 +43,7 @@
|
|
43
43
|
<?r lines.each do |llineno, lcode, lcurrent| ?>
|
44
44
|
<tr class="source" #{'style="background:#faa;"' if lcurrent}>
|
45
45
|
<td>#{llineno}</td>
|
46
|
-
<td><pre>#{lcode.rstrip}</pre></td>
|
46
|
+
<td><pre>#{lcode.to_s.rstrip}</pre></td>
|
47
47
|
</tr>
|
48
48
|
<?r end ?>
|
49
49
|
<?r end ?>
|
data/lib/ramaze.rb
CHANGED
@@ -16,22 +16,21 @@ require 'set'
|
|
16
16
|
require 'pp'
|
17
17
|
|
18
18
|
require 'ramaze/snippets'
|
19
|
-
require 'ramaze/cache'
|
20
|
-
require 'ramaze/trinity'
|
21
19
|
require 'ramaze/error'
|
22
|
-
require 'ramaze/
|
23
|
-
require 'ramaze/gestalt'
|
24
|
-
require 'ramaze/global'
|
20
|
+
require 'ramaze/cache'
|
25
21
|
require 'ramaze/inform'
|
26
|
-
require 'ramaze/
|
22
|
+
require 'ramaze/global'
|
23
|
+
require 'ramaze/dispatcher'
|
27
24
|
require 'ramaze/helper'
|
28
25
|
require 'ramaze/controller'
|
29
26
|
require 'ramaze/template/ezamar'
|
30
|
-
require 'ramaze/
|
27
|
+
require 'ramaze/http_status'
|
28
|
+
require 'ramaze/gestalt'
|
31
29
|
require 'ramaze/version'
|
32
30
|
|
31
|
+
Thread.abort_on_exception = true
|
32
|
+
|
33
33
|
module Ramaze
|
34
|
-
include Inform
|
35
34
|
|
36
35
|
# This initializes all the other stuff, Controller, Adapter and Global
|
37
36
|
# which in turn kickstart Ramaze into duty.
|
@@ -65,12 +64,8 @@ module Ramaze
|
|
65
64
|
|
66
65
|
init_global options
|
67
66
|
|
68
|
-
Thread.abort_on_exception = true
|
69
|
-
|
70
67
|
return if options.delete(:fake_start)
|
71
68
|
|
72
|
-
info "Starting up Ramaze (Version #{VERSION})"
|
73
|
-
|
74
69
|
startup
|
75
70
|
end
|
76
71
|
|
@@ -118,7 +113,7 @@ module Ramaze
|
|
118
113
|
end
|
119
114
|
rescue Object => ex
|
120
115
|
exit if ex.is_a?(SystemExit)
|
121
|
-
error
|
116
|
+
Inform.error(ex)
|
122
117
|
end
|
123
118
|
end
|
124
119
|
end
|
@@ -126,48 +121,20 @@ module Ramaze
|
|
126
121
|
# kill all threads except Thread.main before #shutdown
|
127
122
|
|
128
123
|
def kill_threads
|
129
|
-
info
|
124
|
+
Inform.info("Killing the Threads")
|
130
125
|
Global.adapter_klass.stop rescue nil
|
131
126
|
(Thread.list - [Thread.main]).each do |thread|
|
132
127
|
Timeout.timeout(2) do
|
128
|
+
if thread[:adapter] and thread[:adapter].respond_to?(:shutdown)
|
129
|
+
thread[:adapter].shutdown
|
130
|
+
end
|
133
131
|
thread.kill
|
134
132
|
end
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
138
|
-
# closes the IO that Global.inform_to points to.
|
139
|
-
|
140
|
-
def close_inform
|
141
|
-
[Global.inform_to].flatten.each do |io|
|
142
|
-
if io = Global.inform_to and io.respond_to?(:close)
|
143
|
-
debug "close #{io.inspect}"
|
144
|
-
io.close until io.closed?
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
# first, search for all the classes that end with 'Controller'
|
150
|
-
# like FooController, BarController and so on
|
151
|
-
# then we search the classes within Ramaze::Controller as well
|
152
|
-
|
153
|
-
def find_controllers
|
154
|
-
Global.controllers ||= Set.new
|
155
|
-
|
156
|
-
Module.constants.each do |klass|
|
157
|
-
Global.controllers << constant(klass) if klass =~ /.+?Controller/
|
158
|
-
end
|
159
|
-
|
160
|
-
Ramaze::Controller.constants.each do |klass|
|
161
|
-
klass = constant("Ramaze::Controller::#{klass}")
|
162
|
-
Global.controllers << klass
|
163
|
-
end
|
164
|
-
|
165
|
-
debug "Found following Controllers: #{Global.controllers.inspect}"
|
166
|
-
end
|
167
|
-
|
168
136
|
# Setup the Controllers
|
169
|
-
# This autogenerates a mapping and
|
170
|
-
# in every found Controller.
|
137
|
+
# This autogenerates a mapping and does some munging/validation on the way
|
171
138
|
|
172
139
|
def setup_controllers
|
173
140
|
Global.mapping ||= {}
|
@@ -176,27 +143,15 @@ module Ramaze
|
|
176
143
|
Global.mapping[route] = constant(controller.to_s)
|
177
144
|
end
|
178
145
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
if %w[Main Base Index].include?(name)
|
184
|
-
mapping['/'] = c
|
185
|
-
else
|
186
|
-
mapping["/#{name.split('::').last.snake_case}"] = c
|
146
|
+
Global.controllers.each do |controller|
|
147
|
+
if map = controller.mapping
|
148
|
+
Global.mapping[map] ||= controller
|
149
|
+
Inform.debug("mapped #{map} => #{controller}")
|
187
150
|
end
|
188
151
|
end
|
189
152
|
|
190
|
-
|
191
|
-
|
192
|
-
# Now we make them to real Ramaze::Controller s :)
|
193
|
-
# also we set controller-variable as we go along, in case there
|
194
|
-
# is only one controller it ends up hooked on '/'
|
195
|
-
# otherwise we get some random one ...
|
196
|
-
|
197
|
-
Global.controllers.map! do |controller|
|
198
|
-
controller = constant(controller)
|
199
|
-
end
|
153
|
+
Inform.debug("found Controllers: #{Global.controllers.inspect}")
|
154
|
+
Inform.debug("mapped Controllers: #{Global.mapping.inspect}")
|
200
155
|
end
|
201
156
|
|
202
157
|
# Initialize the Kernel#autoreload with the value of Global.autoreload
|
@@ -232,6 +187,11 @@ module Ramaze
|
|
232
187
|
# Global.running_adapter
|
233
188
|
|
234
189
|
def init_adapter
|
190
|
+
unless Global.adapter
|
191
|
+
Inform.info "No adapter will be used."
|
192
|
+
return
|
193
|
+
end
|
194
|
+
|
235
195
|
(Thread.list - [Thread.current]).each do |thread|
|
236
196
|
thread.kill if thread[:task] == :adapter
|
237
197
|
end
|
@@ -249,7 +209,7 @@ module Ramaze
|
|
249
209
|
end
|
250
210
|
Global.running_adapter.join unless Global.run_loose
|
251
211
|
rescue Object => ex
|
252
|
-
debug
|
212
|
+
Inform.debug(ex.message) unless ex.is_a? Interrupt
|
253
213
|
shutdown
|
254
214
|
end
|
255
215
|
|
@@ -264,11 +224,11 @@ module Ramaze
|
|
264
224
|
adapter_klass = Ramaze::Adapter.const_get(adapter.to_s.capitalize)
|
265
225
|
Global.adapter_klass = adapter_klass
|
266
226
|
|
267
|
-
info
|
227
|
+
Inform.info("Found adapter: #{adapter_klass}, trying to connect to #{host}:#{port} ...")
|
268
228
|
|
269
229
|
parse_port(port)
|
270
230
|
shutdown unless test_connections(host, Global.ports)
|
271
|
-
info
|
231
|
+
Inform.info("and we're running: #{host}:#{port}")
|
272
232
|
|
273
233
|
adapter_klass.start host, Global.ports
|
274
234
|
end
|
@@ -278,7 +238,7 @@ module Ramaze
|
|
278
238
|
def require_adapter adapter
|
279
239
|
require "ramaze/adapter" / adapter.to_s.downcase
|
280
240
|
rescue LoadError => ex
|
281
|
-
|
241
|
+
Inform.error(ex)
|
282
242
|
puts "Please make sure you have an adapter called #{adapter}"
|
283
243
|
shutdown
|
284
244
|
end
|
@@ -289,10 +249,11 @@ module Ramaze
|
|
289
249
|
# that to the same (7000..7000)
|
290
250
|
|
291
251
|
def parse_port port
|
292
|
-
|
293
|
-
|
252
|
+
from_port, to_port = port.to_s.split('..')
|
253
|
+
if from_port and to_port
|
254
|
+
Global.ports = (from_port.to_i..to_port.to_i)
|
294
255
|
else
|
295
|
-
Global.ports = from_port.to_i..from_port.to_i
|
256
|
+
Global.ports = (from_port.to_i..from_port.to_i)
|
296
257
|
end
|
297
258
|
Global.port = Global.ports.begin
|
298
259
|
end
|
@@ -300,6 +261,7 @@ module Ramaze
|
|
300
261
|
# test if a connection can be made at the specified host/ports.
|
301
262
|
|
302
263
|
def test_connections host, ports
|
264
|
+
return true unless Global.test_connections
|
303
265
|
ports.map{|port| connection_possible(host, port) }.all?
|
304
266
|
end
|
305
267
|
|
@@ -310,7 +272,7 @@ module Ramaze
|
|
310
272
|
TCPServer.open(host, port){ true }
|
311
273
|
end
|
312
274
|
rescue => ex
|
313
|
-
|
275
|
+
Inform.error(ex)
|
314
276
|
false
|
315
277
|
end
|
316
278
|
extend self
|