merb 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/README +66 -31
  2. data/Rakefile +3 -1
  3. data/bin/merb +47 -13
  4. data/examples/app_skeleton/Rakefile +4 -3
  5. data/examples/app_skeleton/dist/app/helpers/global_helper.rb +6 -0
  6. data/examples/app_skeleton/dist/conf/merb.yml +11 -0
  7. data/examples/app_skeleton/dist/conf/mup.conf +5 -0
  8. data/examples/app_skeleton/dist/conf/router.rb +1 -3
  9. data/examples/app_skeleton/scripts/merb_stop +10 -2
  10. data/examples/sample_app/Rakefile +3 -3
  11. data/examples/sample_app/dist/app/controllers/files.rb +3 -3
  12. data/examples/sample_app/dist/app/controllers/posts.rb +25 -23
  13. data/examples/sample_app/dist/app/controllers/test.rb +7 -3
  14. data/examples/sample_app/dist/app/helpers/global_helper.rb +7 -0
  15. data/examples/sample_app/dist/app/helpers/posts_helper.rb +4 -0
  16. data/examples/sample_app/dist/app/views/layout/application.herb +5 -4
  17. data/examples/sample_app/dist/app/views/layout/foo.herb +1 -1
  18. data/examples/sample_app/dist/app/views/posts/new.herb +9 -2
  19. data/examples/sample_app/dist/app/views/shared/_test.herb +1 -0
  20. data/examples/sample_app/dist/conf/merb.yml +7 -7
  21. data/examples/sample_app/dist/conf/merb_init.rb +8 -1
  22. data/examples/sample_app/dist/conf/mup.conf +5 -11
  23. data/examples/sample_app/dist/conf/router.rb +1 -1
  24. data/examples/sample_app/dist/public/test.html +5 -0
  25. data/examples/sample_app/dist/schema/migrations/002_add_sessions_table.rb +1 -1
  26. data/examples/sample_app/dist/schema/schema.rb +1 -1
  27. data/examples/sample_app/log/merb.4000.pid +1 -0
  28. data/lib/merb.rb +35 -17
  29. data/lib/merb/core_ext.rb +2 -0
  30. data/lib/merb/{merb_class_extensions.rb → core_ext/merb_class.rb} +42 -0
  31. data/lib/merb/core_ext/merb_enumerable.rb +7 -0
  32. data/lib/merb/{merb_utils.rb → core_ext/merb_hash.rb} +1 -78
  33. data/lib/merb/core_ext/merb_kernel.rb +16 -0
  34. data/lib/merb/core_ext/merb_module.rb +10 -0
  35. data/lib/merb/core_ext/merb_numeric.rb +20 -0
  36. data/lib/merb/core_ext/merb_object.rb +6 -0
  37. data/lib/merb/core_ext/merb_string.rb +40 -0
  38. data/lib/merb/core_ext/merb_symbol.rb +12 -0
  39. data/lib/merb/merb_constants.rb +18 -0
  40. data/lib/merb/merb_controller.rb +150 -76
  41. data/lib/merb/{session/merb_drb_server.rb → merb_drb_server.rb} +13 -46
  42. data/lib/merb/merb_exceptions.rb +4 -0
  43. data/lib/merb/merb_handler.rb +29 -17
  44. data/lib/merb/merb_request.rb +95 -0
  45. data/lib/merb/merb_upload_handler.rb +46 -0
  46. data/lib/merb/merb_upload_progress.rb +48 -0
  47. data/lib/merb/merb_view_context.rb +46 -0
  48. data/lib/merb/merb_yaml_store.rb +31 -0
  49. data/lib/merb/mixins/basic_authentication_mixin.rb +2 -2
  50. data/lib/merb/mixins/controller_mixin.rb +24 -75
  51. data/lib/merb/mixins/erubis_capture_mixin.rb +84 -0
  52. data/lib/merb/mixins/javascript_mixin.rb +103 -19
  53. data/lib/merb/mixins/merb_status_codes.rb +59 -0
  54. data/lib/merb/mixins/render_mixin.rb +114 -40
  55. data/lib/merb/mixins/responder_mixin.rb +2 -1
  56. data/lib/merb/session/merb_ar_session.rb +120 -0
  57. data/lib/merb/session/merb_drb_session.rb +0 -6
  58. data/lib/merb/vendor/paginator/paginator.rb +102 -99
  59. metadata +44 -8
  60. data/examples/sample_app/script/startdrb +0 -8
  61. data/lib/merb/session/merb_session.rb +0 -64
  62. data/lib/mutex_hotfix.rb +0 -34
data/README CHANGED
@@ -7,8 +7,20 @@ for simple dynamic pages.
7
7
 
8
8
  **Sample APP included**
9
9
 
10
+ ** Dependencies **
11
+ mongrel
12
+ erubis
13
+ json or fjson
14
+ mime-types
15
+
16
+ Install these gems first then you can build the merb gem from svn trunk like so:
17
+ $ sudo gem install mongrel erubis json mime-types --include-dependencies
18
+ $ svn co http://svn.devjavu.com/merb
19
+ $ cd merb
20
+ $ sudo rake install
21
+
10
22
  **Important**
11
- The new default filename extensions for templates are as follows:
23
+ The new default filename extensions for templates are as follows
12
24
  html -> .herb
13
25
  js -> .jerb
14
26
  xml -> .xerb
@@ -16,38 +28,54 @@ xml -> .xerb
16
28
  You can change the extensions to anything you want in your config file in
17
29
  yourapp/dist/conf/merb.yml. See the default settings in the sample app.
18
30
 
19
- Unpack the gem and grab the sample app
31
+ First you need to install the dependencies. Merb requires the follwing gems
32
+
33
+ erubis
34
+
35
+ json
36
+
37
+ fjson # will be used if present. requires C extension.
38
+
39
+ # fastthread will be used if present and is reccommended.
40
+ sudo gem install fastthread --source=http://mongrel.rubyforge.org/
41
+
42
+ If you have checked out merb trunk from svn you will want to build and install
43
+ the gem to use merb. Run this command from the root of the merb svn checkout
44
+ to do that:
20
45
 
46
+ $ sudo rake install
47
+
48
+
49
+ If you installed merb from gems then unpack the gem and grab the sample app
21
50
  $ gem unpack merb
22
51
 
23
- cd merb*
24
- cd examples/sample_app
52
+ now with either the svn or the unpacked gem you can try out the sample app.
25
53
 
26
- $ merb
54
+ $ cd merb*
55
+ $ cd examples/sample_app
27
56
 
28
- then the sample app will be running on port 4000 in the foreground.
29
- you can go to a few urls:
57
+ $ merb
30
58
 
31
59
  You will need the mongrel_upload_progress gem installed to go to /files
60
+ so use the -f flag to load a config file for mongrel_upload_progress
61
+ $ merb -f dist/conf/mup.conf
32
62
 
63
+ then the sample app will be running on port 4000 in the foreground.
64
+ you can go to a few urls:
33
65
  http://localhost:4000/files/start
34
66
 
35
67
  http://localhost:4000/foo/123/baz/12234345
36
68
 
37
- If you have checked out merb trunk from svn you will want to build and install
38
- the gem to use merb. Run this command from the root of the merb svn checkout
39
- to do that:
40
-
41
- $ sudo rake install
69
+ **FEATURES**
42
70
 
43
- *note* you may have to run this comand twice if it fails the first time.
44
-
45
- **FEATURES** 1. Mongrel handler built in that parses incoming requests
71
+ *Mongrel handler*
72
+ built in that parses incoming requests
46
73
  including multipart uploads and post as well as ?query=strings. Puts the
47
74
  params into params and the cookies into cookies when it instantiates your
48
75
  controller class.
49
76
 
50
- 2. RouteMatcher and route compiler. Reads your route definition and compiles
77
+ *RouteMatcher and route compiler*
78
+ Reads your route definition and compiles
51
79
  a method on the fly that will match the request path against each route and do the
52
80
  right thing. So the following routes:
53
81
 
@@ -78,7 +106,8 @@ lambda{|path|
78
106
  end
79
107
  }
80
108
 
81
- 3. Simple controller classes with built in render method and template handling
109
+ *Simple Controllers*
110
+ classes with built in render method and template handling
82
111
  with instance vars available in the views automatically. Merb also supports
83
112
  layouts. It will look for a layout named after your controller class first and
84
113
  then fall back to application.herb if no layout exists named after your controller.
@@ -124,7 +153,7 @@ def ajax_action
124
153
  end
125
154
 
126
155
  # ajax_action.jerb
127
- $('comments').update('<%= escape_js(partial(:posts)) %>');
156
+ $('comments').update('<%=js partial(:posts) %>');
128
157
 
129
158
  # _posts.herb
130
159
  <ul>
@@ -137,11 +166,12 @@ $('comments').update('<%= escape_js(partial(:posts)) %>');
137
166
  </ul>
138
167
 
139
168
 
140
- Controllers also now have before filters. Use the before method in
141
- your controllers. before accepts either a symbol or a Proc/lambda object.
142
- If you give it a symbol it will call a method with the same name as the
143
- symbol. If you give it a proc that takes one argument it will call the
144
- proc with the current controller as that argument.
169
+ *Controllers also now have before filters*
170
+
171
+ Use the before method in your controllers. before accepts either a symbol
172
+ or a Proc/lambda object. If you give it a symbol it will call a method with
173
+ the same name as the symbol. If you give it a proc that takes one argument
174
+ it will call the proc with the current controller as that argument.
145
175
 
146
176
  class Foo < Merb::Controller
147
177
 
@@ -162,8 +192,9 @@ Sessions are available when you start merb with the -s flag. See sample app for
162
192
  migration too add session table.
163
193
 
164
194
 
165
- 4. the server. right now you add your routes in
166
- the appdir/conf/router.rb file. So by default it runs on port 4000
195
+ *The merb server*
196
+ right now you add your routes in
197
+ the appdir/dist/conf/router.rb file. So by default it runs on port 4000
167
198
 
168
199
  $ cd /path/to/your/merb/app
169
200
  $ merb
@@ -182,13 +213,15 @@ use the -i flag
182
213
 
183
214
  $merb -i
184
215
 
185
- 5. File uploads. This is the thing that Merb was written for. Rails doesn't allow
216
+ *File uploads*
217
+ This is one of the things that Merb was written for. Rails doesn't allow
186
218
  multiple concurrent file uploads at once without blocking an entire rails backend
187
219
  for each file upload. Merb allows multiple file uploads at once. Start the server
188
- and browse to http://localhost:4000/upload/start and you will get a file upload
189
- form. There is a very simple upload controller example that handles this upload.
190
- When a file is uploaded with Merb, it gets put in a Tempfile. So you just want to
191
- copy it to the right place on the filesystem.
220
+ and browse to http://localhost:4000/files/start and you will get a file upload
221
+ form. This uses the mongrel_upload_progress gem so that must be installed first.
222
+ There is a very simple upload controller example that handles this upload with a
223
+ progress bar. When a file is uploaded with Merb, it gets put in a Tempfile. So
224
+ you just want to copy it to the right place on the filesystem.
192
225
 
193
226
  def upload
194
227
  puts params[:file].inspect
@@ -199,7 +232,9 @@ def upload
199
232
  end
200
233
 
201
234
 
202
- 6. Merb app layout. A Merb app contains everything it needs to run in production in the
235
+ *Merb app layout*
236
+
237
+ A Merb app contains everything it needs to run in production in the
203
238
  MERB_ROOT/dist directory. So for deployment you only need to deploy the dist dir. This
204
239
  keeps your test code and development plugins separate from your main app and lets you
205
240
  not deploy them to the live server. You deal with two things with this setup, MERB_ROOT
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ require File.dirname(__FILE__)+'/tools/rakehelp'
10
10
  include FileUtils
11
11
 
12
12
  NAME = "merb"
13
- VERS = "0.0.7"
13
+ VERS = "0.0.8"
14
14
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
15
15
  RDOC_OPTS = ['--quiet', '--title', "Merb Documentation",
16
16
  "--opname", "index.html",
@@ -59,6 +59,7 @@ spec = Gem::Specification.new do |s|
59
59
  s.add_dependency('mongrel')
60
60
  s.add_dependency('erubis')
61
61
  s.add_dependency('json')
62
+ s.add_dependency('mime-types')
62
63
  s.required_ruby_version = '>= 1.8.4'
63
64
 
64
65
  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{app,bin,test,lib,examples}/**/*")
@@ -85,6 +86,7 @@ end
85
86
  desc "rdoc to rubyforge"
86
87
  task :doc_rforge do
87
88
  sh %{rake doc}
89
+ sh %{sudo chmod -R 755 doc/rdoc}
88
90
  sh %{scp -r -p doc/rdoc/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb}
89
91
  end
90
92
 
data/bin/merb CHANGED
@@ -1,14 +1,35 @@
1
1
  #!/usr/local/bin/ruby
2
2
  require 'rubygems'
3
+
4
+ begin
5
+ require 'fastthread'
6
+ require 'thread'
7
+ puts 'Using FastThread'
8
+ rescue LoadError
9
+ puts "not using FastThread"
10
+ end
11
+
12
+ begin
13
+ require 'fjson'
14
+ puts "using fjson"
15
+ rescue LoadError
16
+ require 'json'
17
+ end
3
18
  require 'optparse'
4
19
  require 'ostruct'
5
20
  require 'fileutils'
6
21
  require 'yaml'
7
22
  require 'erubis'
8
23
 
9
- module Merb
24
+ module Erubis
25
+ class MEruby < Erubis::Eruby
26
+ include PercentLineEnhancer
27
+ include StringBufferEnhancer
28
+ end
10
29
  end
11
30
 
31
+ module Merb; end
32
+
12
33
  class Merb::Config
13
34
  def self.setup
14
35
  defaults = {
@@ -19,7 +40,7 @@ class Merb::Config
19
40
  :template_ext => {:html => :herb, :js => :jerb, :xml => :xerb}
20
41
  }
21
42
  begin
22
- options = defaults.merge(YAML.load(Erubis::Eruby.new(IO.read("#{defaults[:merb_root]}/dist/conf/merb.yml")).result))
43
+ options = defaults.merge(YAML.load(Erubis::MEruby.new(IO.read("#{defaults[:merb_root]}/dist/conf/merb.yml")).result))
23
44
  rescue
24
45
  options = defaults
25
46
  end
@@ -34,42 +55,53 @@ class Merb::Server
34
55
  options = Merb::Config.setup
35
56
 
36
57
  opts = OptionParser.new do |opts|
37
- opts.on("-f", "--config-file [String]") do |config|
58
+ opts.banner = "Usage: merb [fdcphmisl] [argument]"
59
+ opts.define_head "Merb Mongrel+ Erb. Lightweight replacement for ActionPack"
60
+ opts.separator '*'*80
61
+ opts.separator 'If no flags are given, Merb starts in the foreground on port 4000'
62
+ opts.separator '*'*80
63
+
64
+ opts.on("-f", "--config-file FILENAME", "This flag is for adding extra config files for things like the upload progress module") do |config|
38
65
  options[:config] = config
39
66
  end
40
67
 
41
- opts.on("-d", "--daemonize [String]") do |config|
68
+ opts.on("-d", "--daemonize", "This will run a single merb in the background") do |config|
42
69
  options[:daemonize] = true
43
70
  end
44
71
 
45
- opts.on("-c", "--cluster-nodes [String]") do |nodes|
72
+ opts.on("-c", "--cluster-nodes NUM_MERBS", "Number of merb daemons to run") do |nodes|
46
73
  options[:cluster] = nodes
47
74
  end
48
75
 
49
- opts.on("-p", "--port [Integer]") do |port|
76
+ opts.on("-p", "--port PORTNUM", "Port to run merb on, defaults to 4000") do |port|
50
77
  options[:port] = port
51
78
  end
52
79
 
53
- opts.on("-h", "--host [String]") do |host|
80
+ opts.on("-h", "--host HOSTNAME", "Host to bind to(default is all IP's)") do |host|
54
81
  options[:host] = host
55
82
  end
56
83
 
57
- opts.on("-m", "--merb-root [String]") do |merb_root|
84
+ opts.on("-m", "--merb-root MERB_ROOT", "the path to the MERB_ROOT for the app you want to run") do |merb_root|
58
85
  options[:merb_root] = File.expand_path(merb_root)
59
86
  end
60
87
 
61
- opts.on("-i", "--irb-console [String]") do |console|
88
+ opts.on("-i", "--irb-console", "This flag will start merb in irb console mode. All your models and other classes will be available for you in an irb session.") do |console|
62
89
  options[:console] = true
63
90
  end
64
91
 
65
- opts.on("-s", "--session-drb-port [Integer]") do |drb_port|
92
+ opts.on("-s", "--session-drb-port PORTNUM", "This is the port number to run the drb daemon on for sessions and uplod progress monitoring.") do |drb_port|
66
93
  options[:session] = drb_port
67
94
  end
68
95
 
69
- opts.on("-l", "--log-level [String]") do |loglevel|
96
+ opts.on("-l", "--log-level LEVEL", "Log levels can be set to any of these options: DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN") do |loglevel|
70
97
  options[:log_level] = loglevel
71
98
  end
72
99
 
100
+ opts.on("-?", "--help", "Show this help message") do
101
+ puts opts
102
+ exit
103
+ end
104
+
73
105
  end
74
106
 
75
107
  opts.parse!(@@merb_raw_opts)
@@ -161,18 +193,20 @@ class Merb::Server
161
193
  end
162
194
 
163
195
  def self.drbserver_start(port)
196
+ puts "Starting merb drb server on port: #{port}"
164
197
  require 'merb/session/merb_drb_server'
165
198
  DRb.start_service("druby://#{@@merb_opts[:host]}:#{port}", Merb::DRbSession.setup)
166
199
  DRb.thread.join
167
200
  end
168
201
 
169
202
  def self.mongrel_start(port)
203
+ @@merb_opts[:port] = port
170
204
  initialize_merb
171
205
 
172
206
  config = Mongrel::Configurator.new :host => (@@merb_opts[:host]||"0.0.0.0"), :port => (port ||4000) do
173
- load_plugins( :includes => ["mongrel"], :excludes => ["rails"] ) if @@merb_opts[:config]
207
+ config = YAML.load(Erubis::Eruby.new(IO.read(File.expand_path(@@merb_opts[:config]))).result) if @@merb_opts[:config]
174
208
  listener do
175
- run_config(@@merb_opts[:config]) if @@merb_opts[:config]
209
+ uri( "/", :handler => MerbUploadHandler.new(config), :in_front => true) if @@merb_opts[:config]
176
210
  uri "/", :handler => MerbHandler.new(@@merb_opts[:dist_root]+'/public')
177
211
  uri "/favicon.ico", :handler => Mongrel::Error404Handler.new("")
178
212
  end
@@ -6,6 +6,7 @@ require 'fileutils'
6
6
  require 'rubygems'
7
7
  require 'merb'
8
8
  require MERB_FRAMEWORK_ROOT+'/merb_tasks'
9
+ MERB_ROOT = File.dirname(__FILE__)
9
10
  include FileUtils
10
11
 
11
12
 
@@ -18,9 +19,9 @@ task :merb_init do
18
19
  require File.dirname(__FILE__)+'/dist/conf/merb_init.rb'
19
20
  end
20
21
 
21
- desc "Run schema morphing"
22
- task :schema => [:merb_init] do
23
- require File.dirname(__FILE__)+'/dist/schema/schema1.rb'
22
+ desc "Load db schema"
23
+ task :load_schema => [:merb_init] do
24
+ require File.dirname(__FILE__)+'/dist/schema/schema.rb'
24
25
  end
25
26
 
26
27
  task :uninstall => [:clean] do
@@ -0,0 +1,6 @@
1
+ module Merb
2
+ module GlobalHelper
3
+ end
4
+ end
5
+
6
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ :host: 0.0.0.0
3
+ :port: "4000"
4
+ :allow_reloading: true
5
+ #:sql_session: true
6
+ #:basic_auth:
7
+ # :username: ezra
8
+ # :password: test
9
+ # :domain: localhost
10
+ #:daemonize: true
11
+ #:cluster: 3
@@ -0,0 +1,5 @@
1
+ # upload progress conf
2
+ ---
3
+ :drb: true
4
+ :path_info: /files/upload
5
+ :frequency: 2
@@ -11,10 +11,8 @@
11
11
 
12
12
  puts "Compiling routes: \n"
13
13
  Merb::RouteMatcher.prepare do |r|
14
- r.add '/foo/:bar/baz/:id', :controller => 'Test', :action => 'foo'
15
14
  r.add '/:controller/:action/:id'
16
- r.add '/bar/:*rest', :controller => 'Test', :action => 'glob'
17
- r.add '', :controller => 'posts', :action =>'index'
15
+ #r.add '', :controller => 'SomeController', :action =>'foo'
18
16
  end
19
17
 
20
18
  m = Merb::RouteMatcher.new
@@ -1,5 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'fileutils'
2
3
 
3
- pid = File.open(File.dirname(__FILE__)+"/../log/merb.pid"){|f| f.read.chomp.to_i }
4
+ pids=[]
4
5
 
5
- Process.kill(9, pid)
6
+ port_or_star = ARGV[0] || '*'
7
+
8
+ Dir[File.dirname(__FILE__)+"/../log/merb.#{port_or_star}.pid"].each do |f|
9
+ pid = IO.read(f).chomp.to_i
10
+ puts "killing PID: #{pid}"
11
+ Process.kill(9, pid)
12
+ FileUtils.rm f
13
+ end
@@ -19,9 +19,9 @@ task :merb_init do
19
19
  require File.dirname(__FILE__)+'/dist/conf/merb_init.rb'
20
20
  end
21
21
 
22
- desc "Run schema morphing"
23
- task :schema => [:merb_init] do
24
- require File.dirname(__FILE__)+'/dist/schema/schema1.rb'
22
+ desc "Load db schema"
23
+ task :load_schema => [:merb_init] do
24
+ require File.dirname(__FILE__)+'/dist/schema/schema.rb'
25
25
  end
26
26
 
27
27
  task :uninstall => [:clean] do
@@ -1,12 +1,12 @@
1
1
  class Files < Merb::Controller
2
2
 
3
3
  def start
4
- render_no_layout
4
+ render :layout => :none
5
5
  end
6
6
 
7
7
  def index
8
8
  @args = params
9
- render 'start'
9
+ render :action => 'start'
10
10
  end
11
11
 
12
12
  def upload
@@ -25,7 +25,7 @@ class Files < Merb::Controller
25
25
  end
26
26
 
27
27
  def file
28
- send_file DIST_ROOT+'/public/files/'+params[:file]
28
+ send_file params[:file]
29
29
  end
30
30
 
31
31
  end
@@ -1,9 +1,13 @@
1
1
 
2
2
  class Posts < Merb::Controller
3
3
 
4
+ def access_denied
5
+ render
6
+ end
7
+
4
8
  def new
5
- session[:foo] = 'bar'
6
- puts session.sess_id
9
+ #session[:foo] = 'foo'
10
+ #puts session.session_id
7
11
  render
8
12
  end
9
13
 
@@ -13,29 +17,29 @@ class Posts < Merb::Controller
13
17
  end
14
18
 
15
19
  def show
16
- puts session[:foo]
17
- session[:foo] = 'changed'
20
+ #puts session[:foo]
21
+ #session[:foo] = 'changed'
18
22
  @post = Post.find params[:id]
19
23
  @comments = @post.comments
20
24
  render
21
25
  end
22
26
 
23
27
  def test
24
- puts "protocol: #{protocol}"
25
- puts "ssl?: #{ssl?}"
26
- puts "uri: #{uri}"
27
- puts "path: #{path}"
28
- puts "path_info: #{path_info}"
29
- puts "port: #{port}"
30
- puts "host: #{host}"
31
- puts "domain: #{domain}"
32
- puts "get?: #{get?}"
33
- puts "post?: #{post?}"
34
- puts "put?: #{put?}"
35
- puts "delete?: #{delete?}"
36
- puts "head?: #{head?}"
37
- puts "xhr?: #{xhr?}"
38
- puts @env.inspect
28
+ puts "request.protocol: #{request.protocol}"
29
+ puts "request.ssl?: #{request.ssl?}"
30
+ puts "request.uri: #{request.uri}"
31
+ puts "request.path: #{request.path}"
32
+ puts "request.path_info: #{request.path_info}"
33
+ puts "request.port: #{request.port}"
34
+ puts "request.host: #{request.host}"
35
+ puts "request.domain: #{request.domain}"
36
+ puts "request.get?: #{request.get?}"
37
+ puts "request.post?: #{request.post?}"
38
+ puts "request.put?: #{request.put?}"
39
+ puts "request.delete?: #{request.delete?}"
40
+ puts "request.head?: #{request.head?}"
41
+ puts "request.xhr?: #{request.xhr?}"
42
+ puts request.inspect
39
43
  end
40
44
 
41
45
  def xml_test
@@ -43,6 +47,7 @@ class Posts < Merb::Controller
43
47
  end
44
48
 
45
49
  def list
50
+ #session[:foo] = 'hi'
46
51
  @posts = Post.find :all, :limit => 4
47
52
  render
48
53
  end
@@ -62,8 +67,5 @@ class Posts < Merb::Controller
62
67
  @comments = @post.comments.reload
63
68
  render_js 'comment'
64
69
  end
65
-
66
- def index
67
- list
68
- end
70
+
69
71
  end