merb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README +41 -2
  2. data/Rakefile +4 -2
  3. data/TODO +3 -3
  4. data/bin/merb +157 -3
  5. data/doc/rdoc/classes/Hash.html +4 -4
  6. data/doc/rdoc/classes/Merb.html +2 -12
  7. data/doc/rdoc/classes/Merb/Controller.html +347 -156
  8. data/doc/rdoc/classes/Merb/RouteMatcher.html +93 -59
  9. data/doc/rdoc/classes/MerbHandler.html +117 -107
  10. data/doc/rdoc/classes/MerbHash.html +64 -58
  11. data/doc/rdoc/classes/Noroutefound.html +16 -10
  12. data/doc/rdoc/classes/Object.html +5 -5
  13. data/doc/rdoc/classes/String.html +28 -16
  14. data/doc/rdoc/classes/Symbol.html +15 -8
  15. data/doc/rdoc/created.rid +1 -1
  16. data/doc/rdoc/files/README.html +56 -4
  17. data/doc/rdoc/files/TODO.html +4 -4
  18. data/doc/rdoc/files/lib/merb/merb_controller_rb.html +1 -1
  19. data/doc/rdoc/files/lib/merb/merb_handler_rb.html +1 -1
  20. data/doc/rdoc/files/lib/merb/merb_router_rb.html +1 -1
  21. data/doc/rdoc/files/lib/merb/merb_utils_rb.html +1 -1
  22. data/doc/rdoc/files/lib/merb_rb.html +30 -2
  23. data/doc/rdoc/files/lib/{merb_config_rb.html → merb_tasks_rb.html} +4 -4
  24. data/doc/rdoc/fr_class_index.html +0 -2
  25. data/doc/rdoc/fr_file_index.html +1 -3
  26. data/doc/rdoc/fr_method_index.html +21 -21
  27. data/examples/app_skeleton/Rakefile +81 -0
  28. data/examples/app_skeleton/dist/conf/merb_init.rb +15 -0
  29. data/examples/{skeleton → app_skeleton}/dist/conf/router.rb +5 -7
  30. data/examples/app_skeleton/scripts/merb_stop +5 -0
  31. data/examples/app_skeleton/scripts/new_migration +21 -0
  32. data/examples/{skeleton → app_skeleton}/test/test_helper.rb +0 -0
  33. data/examples/sample_app/Rakefile +81 -0
  34. data/examples/sample_app/dist/app/controllers/posts.rb +26 -10
  35. data/examples/sample_app/dist/app/models/comment.rb +3 -0
  36. data/examples/sample_app/dist/app/models/post.rb +2 -11
  37. data/examples/sample_app/dist/app/views/layout/application.rhtml +59 -4
  38. data/examples/sample_app/dist/app/views/posts/_comments.rhtml +11 -0
  39. data/examples/sample_app/dist/app/views/posts/comment.merbjs +1 -0
  40. data/examples/sample_app/dist/app/views/posts/list.rhtml +2 -4
  41. data/examples/sample_app/dist/app/views/posts/new.rhtml +2 -2
  42. data/examples/sample_app/dist/app/views/posts/show.rhtml +35 -3
  43. data/examples/sample_app/dist/conf/merb_init.rb +2 -4
  44. data/examples/sample_app/dist/conf/router.rb +3 -4
  45. data/examples/sample_app/dist/public/images/bg.jpg +0 -0
  46. data/examples/sample_app/dist/public/images/book.gif +0 -0
  47. data/examples/sample_app/dist/public/images/booksmall.gif +0 -0
  48. data/examples/sample_app/dist/public/images/greenright.jpg +0 -0
  49. data/examples/sample_app/dist/public/images/louiecon.gif +0 -0
  50. data/examples/sample_app/dist/public/images/menu.gif +0 -0
  51. data/examples/sample_app/dist/public/images/menuleft.gif +0 -0
  52. data/examples/sample_app/dist/public/images/menuright.gif +0 -0
  53. data/examples/sample_app/dist/public/images/mountain.jpg +0 -0
  54. data/examples/sample_app/dist/public/images/n3.jpg +0 -0
  55. data/examples/sample_app/dist/public/images/nautica.jpg +0 -0
  56. data/examples/sample_app/dist/public/javascripts/application.js +0 -0
  57. data/examples/sample_app/dist/public/javascripts/effects.js +975 -0
  58. data/examples/sample_app/dist/public/javascripts/prototype.js +2264 -0
  59. data/examples/sample_app/dist/public/stylesheets/merb.css +277 -0
  60. data/examples/sample_app/dist/schema/migrations/001_add_comments_to_posts.rb +22 -0
  61. data/examples/sample_app/dist/schema/schema.rb +22 -0
  62. data/examples/sample_app/log/merb.log +164394 -0
  63. data/examples/sample_app/script/merb_stop +9 -0
  64. data/examples/sample_app/script/new_migration +21 -0
  65. data/lib/merb.rb +7 -4
  66. data/lib/merb/merb_controller.rb +83 -4
  67. data/lib/merb/merb_handler.rb +20 -9
  68. data/lib/merb/merb_router.rb +18 -1
  69. data/lib/merb/merb_utils.rb +11 -1
  70. data/lib/merb_tasks.rb +7 -0
  71. data/lib/tasks/db.rake +53 -0
  72. metadata +67 -34
  73. data/doc/rdoc/classes/Merb/Config.html +0 -161
  74. data/doc/rdoc/classes/Merb/Server.html +0 -288
  75. data/doc/rdoc/files/lib/merb/merb_daemon_rb.html +0 -113
  76. data/doc/rdoc/files/lib/merb/noroutefound_rb.html +0 -101
  77. data/examples/sample_app/dist/app/views/layout/posts.rhtml +0 -6
  78. data/examples/skeleton/dist/conf/merb_init.rb +0 -21
  79. data/lib/merb/merb_daemon.rb +0 -91
  80. data/lib/merb/noroutefound.rb +0 -11
  81. data/lib/merb_config.rb +0 -21
@@ -1,113 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: merb_daemon.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>merb_daemon.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/merb/merb_daemon.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Wed Oct 25 20:49:15 -0700 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- rubygems&nbsp;&nbsp;
77
- merb&nbsp;&nbsp;
78
- optparse&nbsp;&nbsp;
79
- ostruct&nbsp;&nbsp;
80
- irb&nbsp;&nbsp;
81
- irb/completion&nbsp;&nbsp;
82
- </div>
83
- </div>
84
-
85
- </div>
86
-
87
-
88
- </div>
89
-
90
-
91
- <!-- if includes -->
92
-
93
- <div id="section">
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
- <!-- if method_list -->
103
-
104
-
105
- </div>
106
-
107
-
108
- <div id="validator-badges">
109
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
110
- </div>
111
-
112
- </body>
113
- </html>
@@ -1,101 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: noroutefound.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>noroutefound.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/merb/noroutefound.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Wed Oct 25 17:09:30 -0700 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
-
73
- </div>
74
-
75
-
76
- </div>
77
-
78
-
79
- <!-- if includes -->
80
-
81
- <div id="section">
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
- <!-- if method_list -->
91
-
92
-
93
- </div>
94
-
95
-
96
- <div id="validator-badges">
97
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
- </div>
99
-
100
- </body>
101
- </html>
@@ -1,6 +0,0 @@
1
- <html>
2
- <title>Posts.rhtml</title>
3
- <body>
4
- <%= @layout_content %>
5
- </body>
6
- </html>
@@ -1,21 +0,0 @@
1
- puts "merb init called"
2
-
3
- MERB_ROOT = Merb::Server.config[:merb_root]
4
- DIST_ROOT = Merb::Server.config[:dist_root]
5
-
6
- # add your own ruby code here for app initialization and load path stuff
7
-
8
- # comment out this whole part if you dont use active_record
9
- require 'active_record'
10
-
11
- ActiveRecord::Base.establish_connection(
12
- :adapter => 'mysql',
13
- :username => 'root',
14
- :password => 'xxxx',
15
- :database => 'merb'
16
- )
17
-
18
-
19
- # leave this uncommented even without activerecord in case
20
- # you want to have models that don't inherit from AR
21
- Dir[DIST_ROOT+"/app/models/*.rb"].each { |m| require m }
@@ -1,91 +0,0 @@
1
- require 'rubygems'
2
- require 'merb'
3
- require 'optparse'
4
- require 'ostruct'
5
-
6
- module Merb
7
- end
8
-
9
-
10
- class Merb::Server
11
-
12
- def self.merb_config
13
- options = Merb::Config.setup
14
-
15
- opts = OptionParser.new do |opts|
16
- opts.on("-c", "--config [String]") do |config|
17
- options[:config] = config
18
- end
19
-
20
- opts.on("-p", "--port [Integer]") do |port|
21
- options[:port] = port
22
- end
23
-
24
- opts.on("-n", "--num-procs [Integer]") do |numprocs|
25
- options[:numprocs] = numprocs
26
- end
27
-
28
- opts.on("-h", "--host [String]") do |host|
29
- options[:host] = host
30
- end
31
-
32
- opts.on("-m", "--merb-root [String]") do |merb_root|
33
- options[:merb_root] = File.expand_path(merb_root)
34
- end
35
-
36
- opts.on("-i", "--irb-console [String]") do |console|
37
- options[:console] = true
38
- end
39
- end
40
-
41
- opts.parse!(@@merb_raw_opts)
42
-
43
-
44
- @@merb_opts = options
45
- puts %{Merb started with these options:}
46
- puts @@merb_opts.to_yaml; puts
47
- end
48
-
49
- def self.run
50
-
51
- options = {
52
- :dir => Dir.pwd + '/log/',
53
- :dir_mode => :normal
54
- }
55
-
56
- @@merb_raw_opts = ARGV
57
- merb_config
58
-
59
- @@merb_opts[:dist_root] = @@merb_opts[:merb_root]+'/dist'
60
-
61
- $LOAD_PATH.unshift( File.join(@@merb_opts[:merb_root] , '/dist/app/controllers') )
62
- $LOAD_PATH.unshift( File.join(@@merb_opts[:merb_root] , '/dist/lib') )
63
- require @@merb_opts[:merb_root]+'/dist/conf/router.rb'
64
- require @@merb_opts[:merb_root]+'/dist/conf/merb_init.rb'
65
-
66
- if @@merb_opts[:console]
67
- ARGV.clear # Avoid passing args to IRB
68
- require 'irb'
69
- require 'irb/completion'
70
- def exit
71
- exit!
72
- end
73
- if File.exists? ".irbrc"
74
- ENV['IRBRC'] = ".irbrc"
75
- end
76
- IRB.start
77
- end
78
-
79
- h = Mongrel::HttpServer.new((@@merb_opts[:host]||"0.0.0.0"), (@@merb_opts[:port]||4000))#, (@@merb_opts[:numprocs]||40))
80
- h.register("/", MerbHandler.new(@@merb_opts[:dist_root]+'/public'))
81
- h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
82
- h.run.join
83
-
84
- end
85
-
86
- def self.config
87
- @@merb_opts
88
- end
89
-
90
- end
91
-
@@ -1,11 +0,0 @@
1
- class Noroutefound < Merb::Controller
2
-
3
- def method_missing(sym, *args, &blk)
4
- "<html><body><h1>No Matching Route</h1></body></html>"
5
- end
6
-
7
- def to_s
8
- "<html><body><h1>No Matching Route s</h1></body></html>"
9
- end
10
-
11
- end
@@ -1,21 +0,0 @@
1
- module Merb
2
- end
3
-
4
- class Merb::Config
5
- def self.setup
6
- defaults = {
7
- :host => "0.0.0.0",
8
- :port => "4000",
9
- :allow_reloading => true,
10
- :merb_root => Dir.pwd
11
- }
12
-
13
- begin
14
- options = defaults.merge(YAML.load(ERB.new(IO.read("#{defaults[:merb_root]}/dist/conf/merb.yml")).result))
15
- rescue
16
- options = defaults
17
- end
18
-
19
- options
20
- end
21
- end