ramaze 0.3.0 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/bin/ramaze +9 -3
- data/doc/AUTHORS +6 -2
- data/doc/CHANGELOG +272 -66
- data/doc/GPL +12 -13
- data/doc/README.html +729 -0
- data/doc/changes.txt +5757 -0
- data/doc/changes.xml +5759 -0
- data/doc/meta/announcement.txt +48 -39
- data/doc/tutorial/todolist.mkd +10 -12
- data/examples/blog/start.rb +1 -0
- data/examples/caching.rb +1 -0
- data/examples/element.rb +3 -0
- data/examples/hello.rb +1 -3
- data/examples/identity.rb +5 -8
- data/examples/layout.rb +1 -0
- data/examples/linking.rb +1 -0
- data/examples/memleak_detector.rb +1 -0
- data/examples/nitro_form.rb +1 -0
- data/examples/rammit/start.rb +1 -0
- data/examples/rapaste/Rakefile +7 -0
- data/examples/rapaste/{src/controller.rb → controller/paste.rb} +28 -3
- data/examples/rapaste/{src/model.rb → model/paste.rb} +0 -4
- data/examples/rapaste/public/css/display.css +17 -0
- data/examples/rapaste/spec/rapaste.rb +2 -2
- data/examples/rapaste/start.rb +9 -4
- data/examples/rapaste/{template → view}/copy.xhtml +0 -0
- data/examples/rapaste/{template → view}/index.xhtml +0 -0
- data/examples/rapaste/{template → view}/layout.xhtml +3 -0
- data/examples/rapaste/{template → view}/list.xhtml +4 -3
- data/examples/rapaste/view/search.xhtml +41 -0
- data/examples/rapaste/{template → view}/view.xhtml +0 -0
- data/examples/simple.rb +3 -3
- data/examples/templates/template/external.amrita +9 -9
- data/examples/templates/template/external.redcloth +19 -0
- data/examples/templates/template_amrita2.rb +40 -7
- data/examples/templates/template_erubis.rb +3 -3
- data/examples/templates/template_ezamar.rb +1 -3
- data/examples/templates/template_haml.rb +1 -3
- data/examples/templates/template_liquid.rb +3 -3
- data/examples/templates/template_markaby.rb +1 -3
- data/examples/templates/template_nagoro.rb +1 -3
- data/examples/templates/template_redcloth.rb +59 -0
- data/examples/templates/template_remarkably.rb +1 -3
- data/examples/templates/template_xslt.rb +1 -4
- data/examples/todolist/src/controller/main.rb +1 -1
- data/examples/todolist/start.rb +1 -2
- data/examples/upload/start.rb +19 -0
- data/examples/upload/view/index.xhtml +25 -0
- data/examples/whywiki/start.rb +1 -3
- data/examples/wikore/start.rb +3 -0
- data/examples/wiktacular/mkd/newpagename/current.mkd +1 -0
- data/examples/wiktacular/mkd/newpagename/current.mkd.bak +1 -0
- data/examples/wiktacular/start.rb +1 -0
- data/lib/proto/controller/main.rb +0 -3
- data/lib/proto/public/js/jquery.js +106 -93
- data/lib/proto/spec/main.rb +2 -5
- data/lib/proto/start.rb +0 -3
- data/lib/ramaze.rb +3 -2
- data/lib/ramaze/action.rb +6 -10
- data/lib/ramaze/adapter/lsws.rb +19 -0
- data/lib/ramaze/contrib/email.rb +84 -0
- data/lib/ramaze/contrib/email.rb-darcs-backup0 +81 -0
- data/lib/ramaze/contrib/gettext.rb +1 -0
- data/lib/ramaze/contrib/gettext/parser.rb +46 -0
- data/lib/ramaze/contrib/route.rb +3 -36
- data/lib/ramaze/controller.rb +4 -6
- data/lib/ramaze/controller/resolve.rb +28 -1
- data/lib/ramaze/dispatcher.rb +1 -1
- data/lib/ramaze/dispatcher/file.rb +17 -0
- data/lib/ramaze/global/globalstruct.rb +7 -4
- data/lib/ramaze/helper/auth.rb +1 -1
- data/lib/ramaze/helper/identity.rb +25 -15
- data/lib/ramaze/helper/link.rb +29 -8
- data/lib/ramaze/helper/maruku.rb +7 -0
- data/lib/ramaze/helper/partial.rb +25 -10
- data/lib/ramaze/route.rb +56 -0
- data/lib/ramaze/snippets/metaid.rb +17 -0
- data/lib/ramaze/spec/helper.rb +0 -2
- data/lib/ramaze/spec/helper/mock_http.rb +6 -0
- data/lib/ramaze/spec/helper/pretty_output.rb +5 -1
- data/lib/ramaze/store/default.rb +3 -1
- data/lib/ramaze/template.rb +1 -1
- data/lib/ramaze/template/amrita2.rb +21 -15
- data/lib/ramaze/template/bijou.rb +39 -0
- data/lib/ramaze/template/builder.rb +28 -0
- data/lib/ramaze/template/redcloth.rb +24 -0
- data/lib/ramaze/template/sass.rb +3 -1
- data/lib/ramaze/tool/create.rb +2 -1
- data/lib/ramaze/tool/localize.rb +6 -1
- data/lib/ramaze/trinity/request.rb +8 -0
- data/lib/ramaze/trinity/session.rb +8 -5
- data/lib/ramaze/version.rb +1 -1
- data/rake_tasks/gem.rake +0 -1
- data/rake_tasks/maintenance.rake +4 -1
- data/spec/contrib/route.rb +14 -63
- data/spec/examples/linking.rb +2 -2
- data/spec/examples/templates/template_redcloth.rb +28 -0
- data/spec/ramaze/controller/subclass.rb +21 -0
- data/spec/ramaze/dispatcher/file.rb +31 -0
- data/spec/ramaze/helper/link.rb +46 -0
- data/spec/ramaze/helper/partial.rb +22 -1
- data/spec/ramaze/helper/template/locals.xhtml +1 -0
- data/spec/ramaze/helper/template/recursive_locals.xhtml +7 -0
- data/spec/ramaze/params.rb +8 -0
- data/spec/ramaze/request.rb +14 -0
- data/spec/ramaze/route.rb +107 -0
- data/spec/ramaze/session.rb +4 -2
- data/spec/ramaze/template/amrita2.rb +21 -7
- data/spec/ramaze/template/amrita2/external.amrita +6 -0
- data/spec/ramaze/template/amrita2/sum.amrita +1 -1
- data/spec/ramaze/template/bijou.rb +25 -0
- data/spec/ramaze/template/builder.rb +55 -0
- data/spec/ramaze/template/builder/external.rxml +3 -0
- data/spec/ramaze/template/haml.rb +15 -0
- data/spec/ramaze/template/haml/locals.haml +1 -0
- data/spec/ramaze/template/redcloth.rb +38 -0
- data/spec/ramaze/template/redcloth/external.redcloth +1 -0
- metadata +472 -442
- data/examples/rapaste/rapaste.sqlite +0 -0
- data/spec/ramaze/template/amrita2/data.amrita +0 -6
- data/spec/ramaze/template/amrita2/index.amrita +0 -1
data/doc/meta/announcement.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
This time we are proud to announce Version 0.3.
|
1
|
+
This time we are proud to announce Version 0.3.5 of Ramaze, the light and
|
2
2
|
modular open source web framework.
|
3
3
|
|
4
4
|
This release features a lot of work directly from our community and we are
|
5
5
|
really greatful for everybody who helped in testing, patching and contributing
|
6
|
-
new
|
6
|
+
exciting new features.
|
7
7
|
|
8
8
|
Our extensive set of specs and docs now covers almost every detail of
|
9
9
|
implementation and usage. Ramaze is under development by a growing community
|
@@ -34,45 +34,54 @@ Simple example:
|
|
34
34
|
|
35
35
|
Special (alphabetic) thanks go to:
|
36
36
|
|
37
|
-
Aman 'tmm1' Gupta
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
Aman 'tmm1' Gupta - patches and support
|
38
|
+
Carlo Zottmann - first patch!
|
39
|
+
Chris 'celldee' Duncan - first patch!
|
40
|
+
Gabriele 'riffraff' Renzi - patches for file dispatcher
|
41
|
+
jeedee - new Ramaze logo
|
42
|
+
Jonathan 'Kashia' Buch - patches and support
|
43
|
+
Keita Yamaguchi - first patch!
|
44
|
+
Pistos - lots of friendly support
|
45
|
+
skaar - first patch!
|
46
|
+
|
47
|
+
|
48
|
+
Selected summary of the 62 patches from 0.3.0 to 0.3.5:
|
49
|
+
|
50
|
+
Core
|
51
|
+
- Ramaze::Contrib::Route made available by default as Ramaze::Route (backwards compatibility retained)
|
52
|
+
- Support added for ETag and If-Modified-Since in Dispatcher::File
|
53
|
+
- Adapter for LiteSpeed webserver added
|
54
|
+
- Added ability to set default session cookie options using Session::COOKIE
|
55
|
+
- Support added for Content-Language based localization and gettext
|
56
|
+
|
57
|
+
Templates
|
58
|
+
- Support added for passing in locals to render_template
|
59
|
+
- Added support for symbol argument to template_root
|
60
|
+
- render_template no longer requires template extensions
|
61
|
+
- Dots allowed in template extensions (template.html.erb)
|
62
|
+
|
63
|
+
Templating Engines
|
64
|
+
- Builder templating engine added to produce XML
|
65
|
+
- RedCloth templating engine added
|
66
|
+
- Amrita2 templating engine updated to latest release
|
67
|
+
|
68
|
+
Helpers
|
69
|
+
- Simple EmailHelper added
|
70
|
+
- IdentityHelper updated for latest ruby-openid
|
71
|
+
- MarukuHelper added
|
72
|
+
- AuthHelper cleaned up
|
73
|
+
- LinkHelper improved: A(), R(), Rs() and breadcrumbs
|
74
|
+
|
75
|
+
Examples
|
76
|
+
- All examples were standardized to include rubygems
|
77
|
+
- Simple file upload example added
|
78
|
+
- Search and diff functionality added to Rapaste
|
79
|
+
|
80
|
+
Misc
|
81
|
+
- Read and read/write issues fixed in Ramaze::Store
|
82
|
+
- Fix applied for running Ramaze apps within IDEs on Windows
|
42
83
|
|
43
84
|
|
44
|
-
Selected summary of the 118 patches from 0.2.1 to 0.3.0:
|
45
|
-
|
46
|
-
- Specs switched from RSpec to bacon; Ramaze now runs on Ruby 1.9.
|
47
|
-
|
48
|
-
- /lib/proto (pregenerated base source code) updated to a new structure.
|
49
|
-
|
50
|
-
- Oddities in gem version of bin/ramaze fixed (hopefully? :) )
|
51
|
-
|
52
|
-
- Layouts fixed so the method on the right controller is called.
|
53
|
-
|
54
|
-
- contrib/facebook and simple facebook app example added.
|
55
|
-
|
56
|
-
- Lambda router support added to contrib/route.
|
57
|
-
|
58
|
-
- examples/rapaste added.
|
59
|
-
|
60
|
-
- gettext contrib added; localize ramaze via gettext.
|
61
|
-
|
62
|
-
- Adapter for Thin Ruby webserver added.
|
63
|
-
|
64
|
-
- Index files can now be put into public directories and subdirectories.
|
65
|
-
|
66
|
-
- examples/blog switched from Og to Sequel.
|
67
|
-
|
68
|
-
- view/ is now the subdirectory for templates; if not found, Ramaze falls
|
69
|
-
back to template/.
|
70
|
-
|
71
|
-
- Default error pages updated: colour gradient removed; textmate link added;
|
72
|
-
Javascript optimized; CSS tweaked.
|
73
|
-
|
74
|
-
- Templates are no longer searched for in public/.
|
75
|
-
|
76
85
|
A complete Changelog is available at
|
77
86
|
http://darcs.ramaze.net/ramaze/doc/CHANGELOG
|
78
87
|
|
data/doc/tutorial/todolist.mkd
CHANGED
@@ -50,16 +50,14 @@ Ramaze comes at the moment only with a simple wrapper of the YAML::Store.
|
|
50
50
|
So we are going to base this on the tools available, you can just do the same
|
51
51
|
with your ORM or database-library of choice.
|
52
52
|
|
53
|
-
So first,
|
53
|
+
So first, create a `model/todolist.rb` for our application:
|
54
54
|
|
55
55
|
TodoList = Store::Default.new('todolist.yaml')
|
56
56
|
|
57
57
|
Let's add some items as well to have a base to start from.
|
58
58
|
|
59
|
-
{
|
60
|
-
'Laundry' => {:done => false},
|
59
|
+
{ 'Laundry' => {:done => false},
|
61
60
|
'Wash dishes' => {:done => false},
|
62
|
-
|
63
61
|
}.each do |title, value|
|
64
62
|
TodoList[title] = value
|
65
63
|
end
|
@@ -69,7 +67,7 @@ Let's add some items as well to have a base to start from.
|
|
69
67
|
|
70
68
|
Now let's get our hands dirty and just edit the templates for our to-do list.
|
71
69
|
|
72
|
-
Start with editing `
|
70
|
+
Start with editing `view/index.xhtml`, it is using the default templating
|
73
71
|
of Ramaze, called Ezamar.
|
74
72
|
|
75
73
|
The index.xhtml currently contains a default welcome page, remove the contents.
|
@@ -142,7 +140,7 @@ application and secondly provides excellent ways of changing the complete
|
|
142
140
|
Structure of the Model or View independent from each other.
|
143
141
|
|
144
142
|
OK, enough of the theory, you will see the benefits in an instant. Go on and
|
145
|
-
edit the file `
|
143
|
+
edit the file `controller/main.rb`.
|
146
144
|
|
147
145
|
The contents of it are like following:
|
148
146
|
|
@@ -208,12 +206,12 @@ Some things you should know:
|
|
208
206
|
We set out to build the ultimate to-do list, but there are still some things
|
209
207
|
missing. First off, we want to add new tasks, so let's get that done.
|
210
208
|
|
211
|
-
Add a link on the `
|
209
|
+
Add a link on the `view/index.xhtml` like this:
|
212
210
|
|
213
211
|
<h1>TodoList</h1>
|
214
212
|
<a href="/new">New Task</a>
|
215
213
|
|
216
|
-
Open a new file `
|
214
|
+
Open a new file `view/new.xhtml` with a form to add a new task.
|
217
215
|
|
218
216
|
<html>
|
219
217
|
<head>
|
@@ -267,7 +265,7 @@ Now you can create as many tasks as you want, please don't get overworked ;)
|
|
267
265
|
Since the nature of tasks is to be done eventually
|
268
266
|
we will need some way to mark it as done or open tasks again.
|
269
267
|
|
270
|
-
Jump into `
|
268
|
+
Jump into `view/index.xhtml` and do the following:
|
271
269
|
|
272
270
|
|
273
271
|
<?r @tasks.each do |title, status, toggle| ?>
|
@@ -369,7 +367,7 @@ and an corresponding method while we're at it:
|
|
369
367
|
redirect Rs()
|
370
368
|
end
|
371
369
|
|
372
|
-
Now jumping to `
|
370
|
+
Now jumping to `view/index.xhtml` again, change it so it shows the link:
|
373
371
|
|
374
372
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
375
373
|
<li>
|
@@ -459,7 +457,7 @@ Please note that instance variables reflecting the parameters are set.
|
|
459
457
|
|
460
458
|
And let's change our templates as well.
|
461
459
|
|
462
|
-
First the `
|
460
|
+
First the `view/index.xhtml`
|
463
461
|
|
464
462
|
<Page title="TodoList">
|
465
463
|
<a href="/new">New Task</a>
|
@@ -476,7 +474,7 @@ First the `template/index.xhtml`
|
|
476
474
|
<?r end ?>
|
477
475
|
</Page>
|
478
476
|
|
479
|
-
and the `
|
477
|
+
and the `view/new.xhtml`
|
480
478
|
|
481
479
|
<Page title="New Task">
|
482
480
|
<a href="/">Back to TodoList</a>
|
data/examples/blog/start.rb
CHANGED
data/examples/caching.rb
CHANGED
data/examples/element.rb
CHANGED
data/examples/hello.rb
CHANGED
data/examples/identity.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
1
|
+
require 'rubygems'
|
4
2
|
require 'ramaze'
|
5
3
|
|
6
4
|
class MainController < Ramaze::Controller
|
@@ -8,14 +6,13 @@ class MainController < Ramaze::Controller
|
|
8
6
|
|
9
7
|
def index
|
10
8
|
if session[:openid_identity]
|
11
|
-
%{
|
12
|
-
<
|
13
|
-
<p>You are logged in as #{session[:openid_identity]}</p>
|
14
|
-
}
|
9
|
+
%{<h1>#{flash[:success]}</h1>
|
10
|
+
<p>You are logged in as #{session[:openid_identity]}</p>}
|
15
11
|
else
|
16
12
|
openid_login_form
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
20
16
|
|
21
|
-
Ramaze.
|
17
|
+
Ramaze::Inform.loggers.each{|l| l.log_levels << :dev }
|
18
|
+
Ramaze.start :adapter => :mongrel
|
data/examples/layout.rb
CHANGED
data/examples/linking.rb
CHANGED
data/examples/nitro_form.rb
CHANGED
data/examples/rammit/start.rb
CHANGED
data/examples/rapaste/Rakefile
CHANGED
@@ -17,7 +17,16 @@ class PasteController < Ramaze::Controller
|
|
17
17
|
@paginated = ordered.paginate(start.to_i, 10)
|
18
18
|
@pager = paginator(@paginated, '/list/page')
|
19
19
|
@pastes = @paginated
|
20
|
-
@style =
|
20
|
+
@style = style
|
21
|
+
end
|
22
|
+
|
23
|
+
def search
|
24
|
+
if needle = request['substring'] and not needle.empty?
|
25
|
+
limit = 50
|
26
|
+
@pastes = Paste.where( "text LIKE '%' || ? || '%'", request[ 'substring' ] ).limit( limit ).order( :created.DESC ).all
|
27
|
+
@hit_limit = ( @pastes.size == limit )
|
28
|
+
@style = session[ :theme ] || STYLE
|
29
|
+
end
|
21
30
|
end
|
22
31
|
|
23
32
|
def save
|
@@ -40,8 +49,7 @@ class PasteController < Ramaze::Controller
|
|
40
49
|
def view(id, format)
|
41
50
|
@paste, @format = paste_for(id), format
|
42
51
|
@syntax = @paste.syntax_name
|
43
|
-
@
|
44
|
-
@formatted = @paste.view(format, @style)
|
52
|
+
@formatted = @paste.view(format, style)
|
45
53
|
|
46
54
|
ordered = Paste.order(:created.DESC)
|
47
55
|
@paginated = ordered.paginate(id.to_i, 1)
|
@@ -60,10 +68,27 @@ class PasteController < Ramaze::Controller
|
|
60
68
|
session[ :theme ] = theme_name
|
61
69
|
end
|
62
70
|
|
71
|
+
def diff(from, to)
|
72
|
+
paste1, paste2 = Paste[from], Paste[to]
|
73
|
+
cs1 = Digest::MD5.hexdigest(paste1.text)
|
74
|
+
cs2 = Digest::MD5.hexdigest(paste2.text)
|
75
|
+
File.open(f1 = Dir.tmpdir/cs1, 'w+'){|io| io.puts(paste1.text) }
|
76
|
+
File.open(f2 = Dir.tmpdir/cs2, 'w+'){|io| io.puts(paste2.text) }
|
77
|
+
diff = `diff -up #{f1} #{f2}`.strip
|
78
|
+
FileUtils.rm(f1)
|
79
|
+
FileUtils.rm(f2)
|
80
|
+
|
81
|
+
Uv.parse(diff, 'xhtml', 'diff', true, style)
|
82
|
+
end
|
83
|
+
|
63
84
|
private
|
64
85
|
|
65
86
|
def paste_for(id)
|
66
87
|
redirect Rs() unless paste = Paste[:id => id.to_i]
|
67
88
|
paste
|
68
89
|
end
|
90
|
+
|
91
|
+
def style
|
92
|
+
@style ||= session[ :theme ] || STYLE
|
93
|
+
end
|
69
94
|
end
|
@@ -81,6 +81,12 @@ div.item_meta span.syntax {
|
|
81
81
|
border-right: 1px solid #ccc;
|
82
82
|
}
|
83
83
|
|
84
|
+
div.item_meta span.paste_id {
|
85
|
+
background: #fff;
|
86
|
+
padding: 0em 0.5em 0em 0.5em;
|
87
|
+
border-right: 1px solid #ccc;
|
88
|
+
}
|
89
|
+
|
84
90
|
div.item pre {
|
85
91
|
margin: 0.5em;
|
86
92
|
padding: 0.5em;
|
@@ -177,3 +183,14 @@ div#menu {
|
|
177
183
|
background: #ddd;
|
178
184
|
text-align: center;
|
179
185
|
}
|
186
|
+
|
187
|
+
form#search {
|
188
|
+
position: absolute;
|
189
|
+
top: 0px;
|
190
|
+
right: 0px;
|
191
|
+
font-size: 0.9em;
|
192
|
+
}
|
193
|
+
|
194
|
+
form#search input {
|
195
|
+
font-size: 0.9em;
|
196
|
+
}
|
@@ -9,7 +9,7 @@ require 'start'
|
|
9
9
|
describe 'RaPaste' do
|
10
10
|
behaves_like 'http'
|
11
11
|
ramaze :public_root => base/:public,
|
12
|
-
:template_root => base/:
|
12
|
+
:template_root => base/:view
|
13
13
|
|
14
14
|
it 'should show an empty list on the list page' do
|
15
15
|
page = get('/list')
|
@@ -24,7 +24,7 @@ describe 'RaPaste' do
|
|
24
24
|
|
25
25
|
it 'should show a new paste form' do
|
26
26
|
page = get('/')
|
27
|
-
form = Hpricot(page.body).at(
|
27
|
+
form = Hpricot(page.body).at('form#new_paste')
|
28
28
|
form[:action].should == '/save'
|
29
29
|
form[:method].should == 'POST'
|
30
30
|
form.at(:textarea)[:name].should == 'text'
|
data/examples/rapaste/start.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
1
4
|
require 'ramaze'
|
5
|
+
require 'sequel'
|
2
6
|
require 'uv'
|
3
7
|
|
4
8
|
Ramaze::Inform.debug "Initializing UltraViolet..."
|
@@ -11,10 +15,11 @@ UV_PRIORITY_NAMES = %w[ ruby plain_text html css javascript yaml diff ]
|
|
11
15
|
STYLE = 'iplastic'
|
12
16
|
|
13
17
|
Ramaze::Inform.debug "done."
|
14
|
-
|
15
18
|
Ramaze.contrib :route
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
DB = Sequel.sqlite
|
21
|
+
|
22
|
+
require 'model/paste'
|
23
|
+
require 'controller/paste'
|
19
24
|
|
20
|
-
Ramaze.start
|
25
|
+
Ramaze.start
|
File without changes
|
File without changes
|