manveru-ramaze 2009.04 → 2009.04.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/CHANGELOG +0 -405
  2. data/MANIFEST +16 -16
  3. data/Rakefile +4 -24
  4. data/bin/ramaze +52 -275
  5. data/doc/tutorial/todolist.html +5 -83
  6. data/doc/tutorial/todolist.txt +33 -85
  7. data/examples/app/auth/layout/{auth.xhtml → auth.nag} +0 -0
  8. data/examples/app/auth/view/{index.xhtml → index.nag} +0 -0
  9. data/examples/app/auth/view/{login.xhtml → login.nag} +0 -0
  10. data/examples/app/auth/view/{secret.xhtml → secret.nag} +0 -0
  11. data/examples/app/blog/app.rb +1 -1
  12. data/examples/app/blog/controller/comment.rb +1 -1
  13. data/examples/app/blog/controller/entry.rb +3 -12
  14. data/examples/app/blog/model/init.rb +0 -5
  15. data/examples/app/blog/model/tag.rb +2 -2
  16. data/examples/app/blog/start.rb +1 -1
  17. data/examples/app/blog/view/entry/index.nag +3 -3
  18. data/examples/app/blog/view/feed.atom.nag +1 -1
  19. data/examples/app/blog/view/feed.rss.nag +1 -1
  20. data/examples/app/blog/view/index.nag +1 -1
  21. data/examples/app/blog/view/tag/index.nag +1 -1
  22. data/examples/app/todolist/model/init.rb +0 -3
  23. data/examples/app/wikore/spec/wikore.rb +6 -4
  24. data/examples/app/wikore/src/controller.rb +11 -9
  25. data/examples/app/wikore/src/model.rb +10 -7
  26. data/examples/app/wikore/start.rb +1 -1
  27. data/examples/app/wikore/{view → template}/index.xhtml +0 -0
  28. data/examples/helpers/provide.rb +23 -0
  29. data/examples/misc/rapp.rb +17 -28
  30. data/examples/templates/template_redcloth.rb +2 -2
  31. data/examples/templates/template_xslt.rb +48 -0
  32. data/examples/templates/view/external.xsl +57 -0
  33. data/lib/proto/config.ru +5 -4
  34. data/lib/proto/controller/init.rb +2 -2
  35. data/lib/proto/layout/{default.xhtml → default.nag} +0 -0
  36. data/lib/proto/spec/main.rb +8 -7
  37. data/lib/proto/start.rb +10 -6
  38. data/lib/proto/view/{index.xhtml → index.nag} +0 -0
  39. data/lib/proto/view/page.nag +27 -0
  40. data/lib/ramaze/app.rb +5 -5
  41. data/lib/ramaze/cache.rb +2 -3
  42. data/lib/ramaze/contrib/email.rb +0 -2
  43. data/lib/ramaze/contrib/sequel/create_join.rb +0 -1
  44. data/lib/ramaze/contrib/sequel/fill.rb +12 -0
  45. data/lib/ramaze/contrib/sequel/form_field.rb +4 -4
  46. data/lib/ramaze/contrib/sequel/image.rb +11 -9
  47. data/lib/ramaze/contrib/sequel/relation.rb +3 -17
  48. data/lib/ramaze/controller/default.rb +0 -5
  49. data/lib/ramaze/helper/cache.rb +8 -22
  50. data/lib/ramaze/helper/formatting.rb +0 -2
  51. data/lib/ramaze/helper/httpdigest.rb +1 -1
  52. data/lib/ramaze/helper/link.rb +5 -2
  53. data/lib/ramaze/helper/localize.rb +3 -13
  54. data/lib/ramaze/helper/paginate.rb +0 -1
  55. data/lib/ramaze/helper/partial.rb +10 -85
  56. data/lib/ramaze/helper.rb +16 -6
  57. data/lib/ramaze/request.rb +1 -22
  58. data/lib/ramaze/snippets/ramaze/deprecated.rb +1 -0
  59. data/lib/ramaze/snippets/string/each.rb +19 -0
  60. data/lib/ramaze/spec.rb +2 -9
  61. data/lib/ramaze/version.rb +1 -1
  62. data/lib/ramaze/view/haml.rb +0 -1
  63. data/lib/ramaze/view/liquid.rb +11 -45
  64. data/lib/ramaze/view/nagoro/render_partial.rb +9 -9
  65. data/lib/ramaze/view.rb +0 -4
  66. data/lib/ramaze.rb +0 -2
  67. data/ramaze.gemspec +12 -12
  68. data/spec/contrib/sequel/fill.rb +47 -0
  69. data/spec/examples/helpers/httpdigest.rb +67 -42
  70. data/spec/examples/templates/template_markaby.rb +1 -1
  71. data/spec/examples/templates/template_xslt.rb +10 -0
  72. data/spec/ramaze/dispatcher/file.rb +20 -22
  73. data/spec/ramaze/error.rb +1 -1
  74. data/spec/ramaze/helper/auth.rb +40 -29
  75. data/spec/ramaze/helper/cache.rb +3 -43
  76. data/spec/ramaze/helper/flash.rb +14 -10
  77. data/spec/ramaze/helper/httpdigest.rb +65 -47
  78. data/spec/ramaze/helper/localize.rb +9 -9
  79. data/spec/ramaze/helper/partial.rb +40 -0
  80. data/spec/ramaze/helper/sequel_form.rb +1 -1
  81. data/spec/ramaze/helper/simple_captcha.rb +13 -9
  82. data/spec/ramaze/helper/stack.rb +39 -31
  83. data/spec/ramaze/helper/user.rb +13 -15
  84. data/spec/ramaze/request.rb +0 -12
  85. data/tasks/bacon.rake +21 -38
  86. data/tasks/release.rake +22 -4
  87. metadata +24 -22
  88. data/lib/proto/app.rb +0 -15
  89. data/lib/ramaze/cache/localmemcache.rb +0 -56
  90. data/lib/ramaze/contrib/app_graph.rb +0 -64
  91. data/lib/ramaze/tool/create.rb +0 -48
  92. data/lib/ramaze/tool/project_creator.rb +0 -111
  93. data/spec/ramaze/cache/localmemcache.rb +0 -49
  94. data/tasks/setup.rake +0 -24
File without changes
File without changes
File without changes
File without changes
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'ramaze'
3
3
 
4
4
  Ramaze.setup :verbose => true do
5
- gem 'sequel', '2.12.0'
5
+ gem 'sequel', '2.11.0'
6
6
  gem 'maruku', '0.5.9'
7
7
  end
8
8
 
@@ -23,7 +23,7 @@ module Blog
23
23
  if @comment.update(@entry, request)
24
24
  redirect @comment.href
25
25
  else
26
- render_partial(:form, :comment => @comment, :entry => @entry)
26
+ partial_content(:form, :comment => @comment, :entry => @entry)
27
27
  end
28
28
  end
29
29
 
@@ -25,6 +25,9 @@ module Blog
25
25
  @comment_count = number_counter(@entry.comments.count, 'comment')
26
26
  end
27
27
 
28
+ def feed
29
+ end
30
+
28
31
  def edit(slug)
29
32
  login_required
30
33
  @entry = Entry.from_slug(slug)
@@ -58,18 +61,6 @@ module Blog
58
61
  Entry.from_slug(slug).destroy
59
62
  end
60
63
 
61
- def trackback(slug)
62
- render_partial(:index){|a|
63
- a.method = :index
64
- a.params << slug
65
- } + <<-COMMENT.strip
66
- I really have not the faintest idea about what this is supposed to do.<br />
67
- People tell me it's broken, but nobody tells me how to fix it :)<br />
68
- For now I'll just use it to show off how to modify an action that requires a
69
- method parameter.
70
- COMMENT
71
- end
72
-
73
64
  private
74
65
 
75
66
  def fetch_tags
@@ -1,15 +1,10 @@
1
1
  require 'sequel'
2
- require 'sequel/extensions/inflector'
3
2
 
4
3
  module Blog
5
4
  DB = Sequel.sqlite("#{__DIR__}/../blog.db")
6
5
  # DB = Sequel.connect("sqlite:///#{__DIR__}/../blog.db")
7
6
  end
8
7
 
9
- Sequel::Model.plugin :validation_class_methods
10
- Sequel::Model.plugin :schema
11
- Sequel::Model.plugin :hook_class_methods
12
-
13
8
  require 'model/tag'
14
9
  require 'model/entry'
15
10
  require 'model/comment'
@@ -7,8 +7,8 @@ module Blog
7
7
  foreign_key :tag_id
8
8
  end
9
9
 
10
- many_to_one :entry, :class => 'Blog::Entry'
11
- many_to_one :tag, :class => 'Blog::Tag'
10
+ belongs_to :entry, :class => 'Blog::Entry'
11
+ belongs_to :tag, :class => 'Blog::Tag'
12
12
 
13
13
  create_table unless table_exists?
14
14
  end
@@ -2,4 +2,4 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
 
3
3
  require 'app'
4
4
 
5
- Ramaze.start(:adapter => :webrick, :mode => :dev) if $0 == __FILE__
5
+ Ramaze.start(:adapter => :webrick, :mode => :dev)
@@ -1,7 +1,7 @@
1
- #{ Blog::Entries.render_partial(:show, :entry => @entry) }
1
+ #{ Blog::Entries.partial_content(:show, :entry => @entry) }
2
2
  <div id="comments" class="comments">
3
3
  <?r @entry.comments.each do |comment| ?>
4
- #{ Blog::Comments.render_partial(:show, :comment => comment) }
4
+ #{ Blog::Comments.partial_content(:show, :comment => comment) }
5
5
  <?r end ?>
6
- #{ Blog::Comments.render_partial(:form, :entry => @entry) }
6
+ #{ Blog::Comments.partial_content(:form, :entry => @entry) }
7
7
  </div>
@@ -13,6 +13,6 @@
13
13
  <id>#{ "#{ Blog.options.uuid }/atom" }</id>
14
14
  <generator uri='#{ @generator_uri }'>#{ @generator }</generator>
15
15
  <?r @entries.each do |entry| ?>
16
- #{ Blog::Entries.render_partial('feed.atom', :entry => entry) }
16
+ #{ Blog::Entries.partial_content('feed.atom', :entry => entry) }
17
17
  <?end ?>
18
18
  </feed>
@@ -19,7 +19,7 @@
19
19
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
20
20
  <ttl>240</ttl>
21
21
  <?r @entries.each do |entry| ?>
22
- #{ Blog::Entries.render_partial('feed.rss', :entry => entry) }
22
+ #{ Blog::Entries.partial_content('feed.rss', :entry => entry) }
23
23
  <?r end ?>
24
24
  </channel>
25
25
  </rss>
@@ -1,6 +1,6 @@
1
1
  <div id="entries">
2
2
  <?r @pager.each do |entry| ?>
3
- #{Blog::Entries.render_partial(:show, :entry => entry)}
3
+ #{Blog::Entries.partial_content(:show, :entry => entry)}
4
4
  <?r end ?>
5
5
  #{ @pager.navigation if @pager.needed? }
6
6
  </div>
@@ -1,5 +1,5 @@
1
1
  <?r @tags.each do |tag| ?>
2
2
  <?r tag.entries.each do |entry| ?>
3
- #{Blog::Entries.render_partial(:show, :entry => entry)}
3
+ #{Blog::Entries.partial_content(:show, :entry => entry)}
4
4
  <?r end ?>
5
5
  <?r end ?>
@@ -1,7 +1,4 @@
1
1
  module TodoList
2
- # yeah, we're lazy
3
- Sequel::Model.plugin(:schema)
4
-
5
2
  # Uncomment the line for the DB you want to use.
6
3
 
7
4
  # Sqlite In memory, fastest, but cannot persist over restarts.
@@ -1,18 +1,20 @@
1
1
  require 'ramaze'
2
- require 'ramaze/spec'
2
+ require 'ramaze/spec/helper'
3
3
 
4
- spec_requires 'hpricot', 'sequel'
4
+ spec_require 'hpricot', 'sequel'
5
5
 
6
6
  $LOAD_PATH.unshift base = __DIR__('..')
7
7
  require 'start'
8
8
 
9
9
  describe 'Wikore' do
10
- behaves_like :mock
10
+ behaves_like 'http'
11
+ ramaze :public_root => base/:public,
12
+ :view_root => base/:template
11
13
 
12
14
  def check_redirect(to = '/')
13
15
  response = yield
14
16
  response.status.should == 302
15
- response.body.should =~ /<a href='.*#{to}'>/
17
+ response.body.should =~ /<a href="#{to}">/
16
18
  end
17
19
 
18
20
  def page_should_exist(name, *matches)
@@ -18,28 +18,26 @@ class MainController < Ramaze::Controller
18
18
  end
19
19
  end
20
20
 
21
- class Pages < Ramaze::Controller
21
+ class PageController < Ramaze::Controller
22
22
  map '/page'
23
23
 
24
- def create
25
- redirect_referer unless request.post?
24
+ helper :aspect
26
25
 
26
+ def create
27
27
  change "Created Page '%s'" do |title, text|
28
28
  Page.create(:title => title, :text => text, :version => 1)
29
- redirect MainController.r(:/, title)
29
+ redirect R(MainController, title)
30
30
  end
31
31
  end
32
32
 
33
33
  def save
34
- redirect_referer unless request.post?
35
-
36
34
  change "Updated Page '%s'" do |title, text|
37
35
  page = Page[:title => title]
38
36
  page.backup
39
37
  page.text = text
40
38
  page.version += 1
41
39
  page.save
42
- redirect MainController.r(:/, title)
40
+ redirect R(MainController, title)
43
41
  end
44
42
  end
45
43
 
@@ -62,7 +60,11 @@ class Pages < Ramaze::Controller
62
60
  def revert(title)
63
61
  page = Page[:title => title]
64
62
  page.revert
65
- redirect MainController.r(:/, title)
63
+ redirect R(MainController, title)
64
+ end
65
+
66
+ before :create, :save do
67
+ redirect_referer unless request.post?
66
68
  end
67
69
 
68
70
  private
@@ -73,6 +75,6 @@ class Pages < Ramaze::Controller
73
75
  message % title
74
76
  end
75
77
 
76
- redirect MainController.r(redirect_to)
78
+ redirect(R(MainController, redirect_to))
77
79
  end
78
80
  end
@@ -1,14 +1,17 @@
1
1
  require 'sequel'
2
2
 
3
- if $wikore_db == :memory
4
- DB = Sequel.sqlite
5
- else
6
- DB_FILE = __DIR__('wikore.db')
7
- DB = Sequel.connect("sqlite://#{DB_FILE}")
3
+ begin
4
+ case $wikore_db
5
+ when :memory
6
+ DB = Sequel.sqlite
7
+ else
8
+ DB_FILE = __DIR__('wikore.db')
9
+ DB = Sequel.connect("sqlite://#{DB_FILE}")
10
+ end
11
+ rescue NoMethodError
12
+ raise LoadError, 'Install latest Sequel gem'
8
13
  end
9
14
 
10
- Sequel::Model.plugin :schema
11
-
12
15
  module Model
13
16
  PAGE_SCHEMA = lambda{
14
17
  primary_key :id
@@ -6,4 +6,4 @@ $wikore = {}
6
6
  require 'src/model'
7
7
  require 'src/controller'
8
8
 
9
- Ramaze.start :file => __FILE__
9
+ Ramaze.start
File without changes
@@ -0,0 +1,23 @@
1
+ require 'ramaze'
2
+ require 'fjson'
3
+
4
+ class User
5
+ def to_yaml
6
+ "Look, I'm YAML!".to_yaml
7
+ end
8
+
9
+ def to_json
10
+ "Look, I'm YSON!".to_json
11
+ end
12
+ end
13
+
14
+ class MainController < Ramaze::Controller
15
+ helper :provide
16
+ provides :yaml, :json
17
+
18
+ def user
19
+ display User.new
20
+ end
21
+ end
22
+
23
+ Ramaze.start
@@ -4,13 +4,10 @@
4
4
  require 'rubygems'
5
5
  require 'ramaze'
6
6
  require 'sequel'
7
- require 'abbrev'
8
7
 
9
- DB = Sequel.sqlite
8
+ DB = Sequel.sqlite :logger => Ramaze::Log
10
9
 
11
10
  class Post < Sequel::Model
12
- plugin :schema
13
- plugin :hook_class_methods
14
11
  set_schema{ primary_key :id; time :created_at; text :text }
15
12
  before_create{ self.created_at ||= Time.now }
16
13
  create_table
@@ -21,35 +18,27 @@ end
21
18
  class MainController < Ramaze::Controller
22
19
  def index
23
20
  @posts = Post.order(:created_at.desc).first(10)
24
-
25
- <<-'TEMPLATE'.strip
26
- <html>
27
- <head><title>Rapp</title></head>
28
- <body>
29
- <h1>Welcome to Rapp</h1>
30
- <h2>A minimal chat wall</h2>
31
- <p>Recent Posts:</p>
32
- <div id="posts" class="container">
33
- <?r @posts.each do |post| ?>
34
- <div id="post-#{post.id}" class="post">
35
- <p class="text">#{post.text}</p>
36
- <p class="created">#{post.created_at}</p>
37
- </div>
38
- <?r end ?>
21
+ %q(<h1>Welcome to Rapp</h1>
22
+ <h2>A minimal chat wall</h2>
23
+ <p>Recent Posts:</p>
24
+ <div id="posts" class="container">
25
+ <?r @posts.each do |post| ?>
26
+ <div id="post-#{post.id}" class="post">
27
+ <p class="text">#{post.text}</p>
28
+ <p class="created">#{post.created_at}</p>
39
29
  </div>
40
- <p>Post Something:</p>
41
- <form action="#{r(:create)}" method="POST">
42
- <input type="text" size="40" name="text" />
43
- <input type="submit" value="Post Message!" />
44
- </form>
45
- </body>
46
- </html>
47
- TEMPLATE
30
+ <?r end ?>
31
+ </div>
32
+ <p>Post Something:</p>
33
+ <form action="#{Rs(:create)}" method="POST">
34
+ <input type="text" size="40" name="text" />
35
+ <input type="submit" value="Post Message!" />
36
+ </form>)
48
37
  end
49
38
 
50
39
  def create
51
40
  Post.create(:text => request[:text])
52
- redirect r(:/)
41
+ redirect Rs(:/)
53
42
  end
54
43
  end
55
44
 
@@ -42,13 +42,13 @@ __REDCLOTH__
42
42
  end
43
43
 
44
44
  def layout
45
- <<'__HTML__'
45
+ <<__HTML__
46
46
  <html>
47
47
  <head>
48
48
  <title>Template::RedCloth <%= @place %></title>
49
49
  </head>
50
50
  <body>
51
- <%= @content %>
51
+ #{@content}
52
52
  </body>
53
53
  </html>
54
54
  __HTML__
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'ramaze'
3
+ require 'ramaze/gestalt'
4
+
5
+ class MainController < Ramaze::Controller
6
+ engine :XSLT
7
+
8
+ def index
9
+ redirect R(:external)
10
+ end
11
+
12
+ def external *args
13
+ r = lambda { |*a| R(*a) }
14
+ response['Content-Type'] = 'application/xhtml+xml'
15
+
16
+ #options = {:place => :internal, :action => 'internal',
17
+ # :args => args, :request => request, :this => self}
18
+ Ramaze::Gestalt.build do
19
+ page(:title=>"Template::XSLT") do
20
+ heading "The external Template for XSLT"
21
+ text "Here you can pass some stuff if you like, parameters are just passed like this:"
22
+ list do
23
+ item {
24
+ link(:href => r.call(@this, :external, :one)) { "external/one" }
25
+ }
26
+ item {
27
+ link(:href => r.call(@this, :external, :one, :two, :three)) { "external/one/two/three" }
28
+ }
29
+ item {
30
+ link(:href => r.call(@this, :external, :one, :foo => :bar)) { "external/one?foo=bar" }
31
+ }
32
+ end
33
+ text "The arguments you have passed to this action are:"
34
+ if args.empty?
35
+ text "none"
36
+ else
37
+ list {
38
+ args.each do |arg|
39
+ item arg
40
+ end
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Ramaze.start :file => __FILE__
@@ -0,0 +1,57 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns="http://www.w3.org/1999/xhtml"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
+ exclude-result-prefixes="xsl">
6
+
7
+ <xsl:output method="xml"
8
+ version="1.0"
9
+ encoding="utf-8"
10
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
11
+ doctype-system="DTD/xhtml1-strict.dtd"
12
+ indent="yes"/>
13
+
14
+ <xsl:template match="/page">
15
+ <html>
16
+ <head>
17
+ <title>
18
+ <xsl:value-of select="@title"/>
19
+ </title>
20
+ </head>
21
+ <body>
22
+ <xsl:apply-templates/>
23
+ </body>
24
+ </html>
25
+ </xsl:template>
26
+
27
+ <xsl:template match="heading">
28
+ <h1>
29
+ <xsl:apply-templates/>
30
+ </h1>
31
+ </xsl:template>
32
+
33
+ <xsl:template match="list">
34
+ <ul>
35
+ <xsl:apply-templates/>
36
+ </ul>
37
+ </xsl:template>
38
+
39
+ <xsl:template match="list/item">
40
+ <li>
41
+ <xsl:apply-templates/>
42
+ </li>
43
+ </xsl:template>
44
+
45
+ <xsl:template match="link">
46
+ <a href="{@href}">
47
+ <xsl:apply-templates/>
48
+ </a>
49
+ </xsl:template>
50
+
51
+ <xsl:template match="text">
52
+ <p>
53
+ <xsl:apply-templates/>
54
+ </p>
55
+ </xsl:template>
56
+
57
+ </xsl:stylesheet>
data/lib/proto/config.ru CHANGED
@@ -8,9 +8,10 @@
8
8
  # Rack::Builder DSL to configure middleware and build up applications easily.
9
9
  #
10
10
  # rackup automatically figures out the environment it is run in, and runs your
11
- # application as FastCGI, CGI, or standalone with Mongrel or WEBrick -- all from
11
+ # application as FastCGI, CGI, or standalone with Mongrel or WEBrickall from
12
12
  # the same configuration.
13
13
 
14
- require File.expand_path('app', File.dirname(__FILE__))
15
- Ramaze.start(:file => __FILE__, :started => true)
16
- run Ramaze
14
+ cwd = File.dirname(__FILE__)
15
+ require "#{cwd}/start"
16
+ Ramaze.start(:started => true)
17
+ run Innate
@@ -2,9 +2,9 @@
2
2
  # controllers
3
3
 
4
4
  class Controller < Ramaze::Controller
5
- layout :default
5
+ layout 'default'
6
6
  helper :xhtml
7
- engine :Etanni
7
+ engine :Nagoro
8
8
  end
9
9
 
10
10
  # Here go your requires for subclasses of Controller:
File without changes
@@ -2,20 +2,21 @@ require 'ramaze'
2
2
  require 'ramaze/spec'
3
3
 
4
4
  require __DIR__('../start')
5
- Ramaze.options.roots = __DIR__('../')
6
5
 
7
6
  describe MainController do
8
7
  behaves_like :mock
9
8
 
10
9
  should 'show start page' do
11
- get('/').status.should == 200
12
- last_response['Content-Type'].should == 'text/html'
13
- last_response.should =~ /<h1>Welcome to Ramaze!<\/h1>/
10
+ got = get('/')
11
+ got.status.should == 200
12
+ got['Content-Type'].should == 'text/html'
13
+ got.body.should =~ /<h1>Welcome to Ramaze!<\/h1>/
14
14
  end
15
15
 
16
16
  should 'show /notemplate' do
17
- get('/notemplate').status.should == 200
18
- last_response['Content-Type'].should == 'text/html'
19
- last_response.should =~ /there is no 'notemplate\.xhtml' associated with this action/
17
+ got = get('/notemplate')
18
+ got.status.should == 200
19
+ got['Content-Type'].should == 'text/html'
20
+ got.body.should =~ /there is no 'notemplate.xhtml' associated with this action/
20
21
  end
21
22
  end
data/lib/proto/start.rb CHANGED
@@ -1,8 +1,12 @@
1
- # Use this file directly like `ruby start.rb` if you don't want to use the
2
- # `ramaze start` command.
3
- # All application related things should go into `app.rb`, this file is simply
4
- # for options related to running the application locally.
1
+ require 'rubygems'
2
+ require 'ramaze'
5
3
 
6
- require File.expand_path('app', File.dirname(__FILE__))
4
+ # Add the directory this file resides in to the load path, so you can run the
5
+ # app from any other working directory
6
+ $LOAD_PATH.unshift(__DIR__)
7
7
 
8
- Ramaze.start(:adapter => :webrick, :port => 7000, :file => __FILE__)
8
+ # Initialize controllers and models
9
+ require 'controller/init'
10
+ require 'model/init'
11
+
12
+ Ramaze.start(:adapter => :webrick, :port => 7000) if __FILE__ == $0
File without changes
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <title>#{@title}</title>
7
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
8
+ <meta http-equiv="Content-Style-Type" content="text/css" />
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="expires" content="0" />
11
+ <meta name="description" content="Description for search engines" />
12
+ <meta name="generator" content="Ramaze #{Ramaze::VERSION}" />
13
+ <meta name="keywords" content="Ramaze, Your own keywords" />
14
+ <meta name="author" content="Max Mustermann" />
15
+ <meta name="date" content="#{Time.now.iso8601}" />
16
+ <style type="text/css">
17
+ body { margin: 2em; }
18
+ #content { margin-left: 2em; }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <h1>#{@title}</h1>
23
+ <div id="content">
24
+ #@content
25
+ </div>
26
+ </body>
27
+ </html>
data/lib/ramaze/app.rb CHANGED
@@ -68,11 +68,11 @@ module Ramaze
68
68
 
69
69
  APP_LIST = {}
70
70
 
71
- attr_reader :name, :location, :url_map, :options
71
+ attr_reader :name, :location, :map, :options
72
72
 
73
73
  def initialize(name, location)
74
74
  @name = name.to_sym
75
- @url_map = Innate::URLMap.new
75
+ @map = Innate::URLMap.new
76
76
  self.location = location
77
77
 
78
78
  APP_LIST[@name] = self
@@ -95,16 +95,16 @@ module Ramaze
95
95
 
96
96
  def to_app
97
97
  files = Ramaze::Files.new(*public_roots)
98
- app = Current.new(Route.new(url_map), Rewrite.new(url_map))
98
+ app = Current.new(Route.new(@map), Rewrite.new(@map))
99
99
  Rack::Cascade.new([files, app])
100
100
  end
101
101
 
102
102
  def map(location, object)
103
- url_map.map(location, object)
103
+ @map.map(location, object)
104
104
  end
105
105
 
106
106
  def to(object)
107
- return unless mapped = url_map.to(object)
107
+ return unless mapped = @map.to(object)
108
108
  [location, mapped].join('/').squeeze('/')
109
109
  end
110
110
 
data/lib/ramaze/cache.rb CHANGED
@@ -7,9 +7,8 @@ module Ramaze
7
7
  Cache = Innate::Cache
8
8
 
9
9
  class Cache
10
- autoload :LocalMemCache, 'ramaze/cache/localmemcache'
11
- autoload :MemCache, 'ramaze/cache/memcache'
12
- autoload :Sequel, 'ramaze/cache/sequel'
10
+ autoload :MemCache, 'ramaze/cache/memcache'
11
+ autoload :Sequel, 'ramaze/cache/sequel'
13
12
 
14
13
  def self.clear_after_reload
15
14
  action.clear if respond_to?(:action)
@@ -30,8 +30,6 @@ require 'net/smtp'
30
30
 
31
31
  module Ramaze
32
32
  class EmailHelper
33
- include Innate::Traited
34
-
35
33
  # Required to be set
36
34
  trait :smtp_server => 'smtp.your-isp.com'
37
35
  trait :smtp_helo_domain => 'your.helo.domain.com'
@@ -1,5 +1,4 @@
1
1
  require 'sequel'
2
- require 'sequel/extensions/inflector'
3
2
 
4
3
  module Sequel
5
4
  class Model