ramaze 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +26 -6
- data/bin/ramaze +8 -1
- data/doc/AUTHORS +13 -11
- data/doc/CHANGELOG +472 -13
- data/doc/LEGAL +22 -0
- data/doc/README +1 -4
- data/doc/TODO +7 -2
- data/doc/changes.txt +472 -13
- data/doc/changes.xml +472 -13
- data/doc/meta/announcement.txt +21 -23
- data/doc/readme_chunks/appendix.txt +0 -3
- data/doc/readme_chunks/features.txt +1 -1
- data/examples/auth/auth.rb +49 -0
- data/examples/auth/template/layout.haml +20 -0
- data/examples/auth/template/login.haml +16 -0
- data/examples/blog/spec/blog.rb +1 -0
- data/examples/caching.rb +5 -6
- data/examples/css.rb +37 -0
- data/examples/layout.rb +3 -17
- data/examples/simple_auth.rb +23 -0
- data/examples/sourceview/public/images/file.gif +0 -0
- data/examples/sourceview/public/images/folder.gif +0 -0
- data/examples/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/sourceview/public/images/tv-item.gif +0 -0
- data/examples/sourceview/public/jquery.js +11 -0
- data/examples/sourceview/public/jquery.treeview.css +47 -0
- data/examples/sourceview/public/jquery.treeview.js +223 -0
- data/examples/sourceview/public/sourceview.js +16 -0
- data/examples/sourceview/sourceview.rb +74 -0
- data/examples/sourceview/template/index.haml +43 -0
- data/examples/templates/template/external.nag +28 -0
- data/examples/templates/template/external.xsl +57 -0
- data/examples/templates/template_amrita2.rb +2 -4
- data/examples/templates/template_erubis.rb +1 -1
- data/examples/templates/template_haml.rb +1 -1
- data/examples/templates/template_liquid.rb +2 -4
- data/examples/templates/template_markaby.rb +2 -4
- data/examples/templates/template_nagoro.rb +53 -0
- data/examples/templates/template_remarkably.rb +2 -4
- data/examples/templates/template_xslt.rb +52 -0
- data/examples/whywiki/spec/whywiki.rb +63 -0
- data/examples/whywiki/start.rb +11 -13
- data/examples/whywiki/template/edit.xhtml +3 -3
- data/examples/whywiki/template/show.xhtml +5 -8
- data/examples/wikore/spec/wikore.rb +115 -0
- data/examples/wikore/src/controller.rb +81 -0
- data/examples/wikore/src/model.rb +51 -0
- data/examples/wikore/start.rb +6 -0
- data/examples/wikore/template/index.xhtml +8 -0
- data/examples/wiktacular/spec/wiktacular.rb +1 -0
- data/examples/wiktacular/src/controller.rb +1 -1
- data/lib/ramaze.rb +6 -3
- data/lib/ramaze/action.rb +2 -13
- data/lib/ramaze/action/render.rb +36 -18
- data/lib/ramaze/adapter.rb +1 -1
- data/lib/ramaze/adapter/cgi.rb +0 -3
- data/lib/ramaze/adapter/evented_mongrel.rb +7 -0
- data/lib/ramaze/adapter/mongrel.rb +4 -13
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +7 -0
- data/lib/ramaze/cache.rb +12 -7
- data/lib/ramaze/contrib.rb +22 -0
- data/lib/ramaze/contrib/auto_params.rb +128 -0
- data/lib/ramaze/contrib/auto_params/get_args.rb +56 -0
- data/lib/ramaze/contrib/gzip_filter.rb +57 -0
- data/lib/ramaze/contrib/route.rb +40 -0
- data/lib/ramaze/contrib/sequel/fill.rb +12 -0
- data/lib/ramaze/controller.rb +17 -6
- data/lib/ramaze/controller/resolve.rb +51 -14
- data/lib/ramaze/dispatcher.rb +15 -13
- data/lib/ramaze/dispatcher/action.rb +4 -3
- data/lib/ramaze/dispatcher/directory.rb +3 -3
- data/lib/ramaze/dispatcher/error.rb +1 -1
- data/lib/ramaze/dispatcher/file.rb +17 -6
- data/lib/ramaze/error.rb +3 -0
- data/lib/ramaze/gestalt.rb +28 -8
- data/lib/ramaze/global.rb +26 -6
- data/lib/ramaze/global/globalstruct.rb +31 -6
- data/lib/ramaze/helper.rb +2 -1
- data/lib/ramaze/helper/aspect.rb +2 -2
- data/lib/ramaze/helper/auth.rb +6 -9
- data/lib/ramaze/helper/cache.rb +89 -9
- data/lib/ramaze/helper/cgi.rb +2 -2
- data/lib/ramaze/helper/formatting.rb +44 -0
- data/lib/ramaze/helper/link.rb +7 -5
- data/lib/ramaze/helper/partial.rb +6 -4
- data/lib/ramaze/helper/redirect.rb +24 -9
- data/lib/ramaze/helper/stack.rb +6 -1
- data/lib/ramaze/inform/growl.rb +1 -1
- data/lib/ramaze/inform/informer.rb +2 -1
- data/lib/ramaze/inform/informing.rb +6 -0
- data/lib/ramaze/inform/syslog.rb +1 -0
- data/lib/ramaze/snippets/array/put_within.rb +24 -0
- data/lib/ramaze/snippets/dictionary.rb +499 -0
- data/lib/ramaze/snippets/numeric/filesize_format.rb +19 -0
- data/lib/ramaze/snippets/ordered_set.rb +31 -0
- data/lib/ramaze/snippets/string/DIVIDE.rb +1 -1
- data/lib/ramaze/snippets/string/snake_case.rb +1 -1
- data/lib/ramaze/snippets/struct/values_at.rb +5 -1
- data/lib/ramaze/snippets/thread/into.rb +25 -0
- data/lib/ramaze/sourcereload.rb +39 -19
- data/lib/ramaze/spec/helper.rb +4 -1
- data/lib/ramaze/spec/helper/{context.rb → browser.rb} +3 -0
- data/lib/ramaze/spec/helper/layout.rb +3 -0
- data/lib/ramaze/spec/helper/minimal.rb +3 -0
- data/lib/ramaze/spec/helper/mock_http.rb +8 -5
- data/lib/ramaze/spec/helper/requester.rb +4 -1
- data/lib/ramaze/spec/helper/wrap.rb +15 -7
- data/lib/ramaze/template.rb +5 -1
- data/lib/ramaze/template/ezamar/engine.rb +2 -3
- data/lib/ramaze/template/ezamar/morpher.rb +26 -45
- data/lib/ramaze/template/nagoro.rb +53 -0
- data/lib/ramaze/template/none.rb +14 -0
- data/lib/ramaze/template/xslt.rb +96 -0
- data/lib/ramaze/tool.rb +0 -1
- data/lib/ramaze/tool/localize.rb +7 -2
- data/lib/ramaze/trinity/request.rb +1 -0
- data/lib/ramaze/trinity/session.rb +3 -3
- data/lib/ramaze/version.rb +2 -2
- data/rake_tasks/conf.rake +1 -2
- data/rake_tasks/{maintaince.rake → maintenance.rake} +25 -17
- data/spec/contrib/auto_params.rb +97 -0
- data/spec/contrib/route.rb +60 -0
- data/spec/contrib/sequel/fill.rb +46 -0
- data/spec/examples/caching.rb +1 -2
- data/spec/examples/css.rb +12 -0
- data/spec/examples/element.rb +0 -1
- data/spec/examples/hello.rb +0 -1
- data/spec/examples/simple.rb +0 -1
- data/spec/helper.rb +3 -2
- data/spec/ramaze/action/cache.rb +24 -7
- data/spec/ramaze/action/layout.rb +19 -11
- data/spec/ramaze/action/template/sub/sub_wrapper.xhtml +1 -0
- data/spec/ramaze/controller.rb +11 -0
- data/spec/ramaze/controller/template_resolving.rb +28 -27
- data/spec/ramaze/dispatcher.rb +32 -0
- data/spec/ramaze/dispatcher/directory.rb +2 -1
- data/spec/ramaze/element.rb +1 -1
- data/spec/ramaze/gestalt.rb +28 -0
- data/spec/ramaze/helper/aspect.rb +14 -3
- data/spec/ramaze/helper/cache.rb +78 -13
- data/spec/ramaze/helper/formatting.rb +20 -0
- data/spec/ramaze/helper/link.rb +2 -0
- data/spec/ramaze/helper/partial.rb +12 -1
- data/spec/ramaze/helper/redirect.rb +44 -8
- data/spec/ramaze/helper/stack.rb +3 -3
- data/spec/ramaze/helper/template/loop.xhtml +3 -0
- data/spec/ramaze/helper/template/num.xhtml +1 -0
- data/spec/ramaze/helper/template/recursive.xhtml +8 -0
- data/spec/ramaze/morpher.rb +25 -6
- data/spec/ramaze/params.rb +6 -2
- data/spec/ramaze/request.rb +5 -2
- data/spec/ramaze/session.rb +19 -0
- data/spec/ramaze/template.rb +2 -2
- data/spec/ramaze/template/amrita2.rb +2 -2
- data/spec/ramaze/template/erubis.rb +2 -2
- data/spec/ramaze/template/ezamar.rb +6 -3
- data/spec/ramaze/template/haml.rb +3 -3
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/nagoro.rb +65 -0
- data/spec/ramaze/template/nagoro/another/long/action.nag +1 -0
- data/spec/ramaze/template/nagoro/combined.nag +1 -0
- data/spec/ramaze/template/nagoro/file_only.nag +1 -0
- data/spec/ramaze/template/nagoro/index.nag +1 -0
- data/spec/ramaze/template/nagoro/nested.nag +1 -0
- data/spec/ramaze/template/nagoro/some__long__action.nag +1 -0
- data/spec/ramaze/template/nagoro/sum.nag +1 -0
- data/spec/ramaze/template/remarkably.rb +1 -1
- data/spec/ramaze/template/sass.rb +1 -1
- data/spec/ramaze/template/xslt.rb +93 -0
- data/spec/ramaze/template/xslt/concat_words.xsl +16 -0
- data/spec/ramaze/template/xslt/index.xsl +14 -0
- data/spec/ramaze/template/xslt/products.xsl +32 -0
- data/spec/ramaze/template/xslt/ruby_version.xsl +14 -0
- data/spec/snippets/array/put_within.rb +32 -0
- data/spec/snippets/numeric/filesize_format.rb +12 -0
- data/spec/snippets/ordered_set.rb +56 -0
- data/spec/snippets/ramaze/caller_lines.rb +6 -3
- data/spec/snippets/string/snake_case.rb +3 -0
- metadata +118 -22
- data/doc/README.html +0 -737
- data/examples/fcgi.rb +0 -13
- data/lib/ramaze/snippets/numeric/human_readable_filesize_format.rb +0 -33
- data/lib/ramaze/tool/tidy.rb +0 -104
- data/spec/ramaze/controller/template/edit.xhtml +0 -1
- data/spec/ramaze/controller/template/edit/content.xhtml +0 -1
- data/spec/ramaze/tidy.rb +0 -12
- data/spec/snippets/numeric/human_readable_filesize_format.rb +0 -11
data/examples/fcgi.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
class Numeric
|
5
|
-
HUMAN_READBLE_FILESIZE_FORMAT = [
|
6
|
-
['%.1fT', 1 << 40],
|
7
|
-
['%.1fG', 1 << 30],
|
8
|
-
['%.1fM', 1 << 20],
|
9
|
-
['%.1fK', 1 << 10],
|
10
|
-
]
|
11
|
-
|
12
|
-
def human_readable_filesize_format
|
13
|
-
HUMAN_READBLE_FILESIZE_FORMAT.each do |format, size|
|
14
|
-
return format % (self.to_f / size) if self >= size
|
15
|
-
end
|
16
|
-
|
17
|
-
self.to_s
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
=begin
|
22
|
-
$microtest_verbose = true
|
23
|
-
$microtest_run = true
|
24
|
-
|
25
|
-
require 'micro/test'
|
26
|
-
|
27
|
-
{ :description => 'format_human_filesize',
|
28
|
-
1 << 0 => '1',
|
29
|
-
1 << 10 => '1.0K',
|
30
|
-
1 << 20 => '1.0M',
|
31
|
-
1 << 30 => '1.0G',
|
32
|
-
}.test :human_readable_filesize_format
|
33
|
-
=end
|
data/lib/ramaze/tool/tidy.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
module Ramaze
|
5
|
-
module Tool
|
6
|
-
|
7
|
-
# This is a simple tool to tidy up your html-output
|
8
|
-
# in general this is just used by setting Global.tidy = true
|
9
|
-
|
10
|
-
module Tidy
|
11
|
-
|
12
|
-
trait[:enable] ||= false
|
13
|
-
|
14
|
-
# set this to define a custom path to your tidy.so
|
15
|
-
trait[:paths] ||= %w[
|
16
|
-
/usr/lib/libtidy.so
|
17
|
-
/usr/local/lib/libtidy.so
|
18
|
-
]
|
19
|
-
|
20
|
-
trait[:path] ||= nil
|
21
|
-
|
22
|
-
trait[:options] ||= {
|
23
|
-
:output_xml => true,
|
24
|
-
:input_encoding => :utf8,
|
25
|
-
:output_encoding => :utf8,
|
26
|
-
:indent_spaces => 2,
|
27
|
-
:indent => :auto,
|
28
|
-
:markup => :yes,
|
29
|
-
:wrap => 500
|
30
|
-
}
|
31
|
-
|
32
|
-
class << self
|
33
|
-
|
34
|
-
# dirty html in, tidy html out
|
35
|
-
# To activate Tidy for everything outgoing (given that it is of
|
36
|
-
# Content-Type text/html) set
|
37
|
-
# Global.tidy = true
|
38
|
-
# there is almost no speed-tradeoff but makes debugging a much
|
39
|
-
# nicer experience ;)
|
40
|
-
#
|
41
|
-
# Example:
|
42
|
-
#
|
43
|
-
# include Ramaze::Tool::Tidy
|
44
|
-
# puts tidy('<html></html>')
|
45
|
-
#
|
46
|
-
# # results in something like:
|
47
|
-
#
|
48
|
-
# <html>
|
49
|
-
# <head>
|
50
|
-
# <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
|
51
|
-
# <title></title>
|
52
|
-
# </head>
|
53
|
-
# <body></body>
|
54
|
-
# </html>
|
55
|
-
|
56
|
-
def tidy html, options = {}
|
57
|
-
require 'tidy'
|
58
|
-
|
59
|
-
unless found = trait[:path]
|
60
|
-
found = trait[:paths].find do |path|
|
61
|
-
File.exists?(path)
|
62
|
-
end
|
63
|
-
trait[:path] = found
|
64
|
-
end
|
65
|
-
|
66
|
-
path = trait[:path]
|
67
|
-
|
68
|
-
unless path
|
69
|
-
Inform.error("Could not find `libtidy.so' in #{trait[:paths].inspect}")
|
70
|
-
return html
|
71
|
-
end
|
72
|
-
|
73
|
-
::Tidy.path = path
|
74
|
-
|
75
|
-
::Tidy.open(:show_warnings => true) do |tidy|
|
76
|
-
opts = trait[:options].merge(options)
|
77
|
-
opts.each do |key, value|
|
78
|
-
tidy.options.send("#{key}=", value.to_s)
|
79
|
-
end
|
80
|
-
tidy.clean(html)
|
81
|
-
end
|
82
|
-
rescue LoadError => ex
|
83
|
-
puts ex
|
84
|
-
puts "cannot load 'tidy', please `gem install tidy`"
|
85
|
-
puts "you can find it at http://tidy.rubyforge.org/"
|
86
|
-
end
|
87
|
-
|
88
|
-
# Enables being plugged into Dispatcher::Action::FILTER
|
89
|
-
|
90
|
-
def call(response, options = {})
|
91
|
-
return response unless trait[:enable]
|
92
|
-
response.body = tidy(response.body, options)
|
93
|
-
response
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# calls Tidy::tidy
|
98
|
-
|
99
|
-
def tidy html, options = {}
|
100
|
-
Ramaze::Tool::Tidy.tidy(html, options)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#@what - #@oid
|
@@ -1 +0,0 @@
|
|
1
|
-
- #@oid
|
data/spec/ramaze/tidy.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
require 'spec/helper'
|
5
|
-
|
6
|
-
testcase_requires 'tidy', 'ramaze/tool/tidy'
|
7
|
-
|
8
|
-
describe "testing tidy" do
|
9
|
-
it "tidy some simple html" do
|
10
|
-
Ramaze::Tool::Tidy.tidy("<html></html>").should =~ %r{<html>\s+<head>\s+<meta name="generator" content="HTML Tidy (.*?)" />\s+<title></title>\s+</head>\s+<body></body>\s+</html>}
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec/helper'
|
2
|
-
|
3
|
-
describe "Numeric#human_readable_filesize_format" do
|
4
|
-
it 'it should convert filesizes to human readable format' do
|
5
|
-
1.human_readable_filesize_format.should == '1'
|
6
|
-
1024.human_readable_filesize_format.should == '1.0K'
|
7
|
-
(1 << 20).human_readable_filesize_format.should == '1.0M'
|
8
|
-
(1 << 30).human_readable_filesize_format.should == '1.0G'
|
9
|
-
(1 << 40).human_readable_filesize_format.should == '1.0T'
|
10
|
-
end
|
11
|
-
end
|