Changeset 152
- Timestamp:
- 01/15/07 17:03:42 (2 years ago)
- Files:
-
- trunk/Rakefile (modified) (2 diffs)
- trunk/examples/README_EXAMPLES (modified) (1 diff)
- trunk/examples/skeleton (deleted)
- trunk/examples/skeleton.tar (added)
- trunk/lib/merb/generators/merb_app/merb_app.rb (modified) (3 diffs)
- trunk/lib/merb/merb_handler.rb (modified) (1 diff)
- trunk/lib/merb/mixins/basic_authentication_mixin.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Rakefile
r135 r152 7 7 require 'code_statistics' 8 8 require 'fileutils' 9 require File.dirname(__FILE__)+'/tools/rakehelp' 9 def __DIR__ 10 File.dirname(__FILE__) 11 end 12 13 require __DIR__+'/tools/rakehelp' 10 14 include FileUtils 15 11 16 12 17 NAME = "merb" … … 85 90 end 86 91 92 93 desc "Pack skeleton app as a tar.gz file" 94 task :skeleton do 95 require 'archive/tar/minitar' 96 include Archive::Tar 97 Find.find(File.join(__DIR__,'examples/skeleton')) do |f| 98 FileUtils.rm_rf(f) if /\.svn$/ =~ f 99 end 100 File.open(File.join(__DIR__,'examples/skeleton.tar'), 'wb') do |tar| 101 Dir.chdir 'examples/skeleton' 102 Minitar.pack('.', tar, true) 103 end 104 end 105 87 106 desc 'Run unit tests' 88 107 Rake::TestTask.new('test_unit') do |t| trunk/examples/README_EXAMPLES
r146 r152 3 3 4 4 svn co http://svn.devjavu.com/merb/mrblog/trunk 5 6 To generate your own new merb app first install the gem and then: 7 8 $ merb -g appname 9 or 10 $ merb --generate-app appname trunk/lib/merb/generators/merb_app/merb_app.rb
r147 r152 1 1 require 'fileutils' 2 2 require 'find' 3 4 begin 5 require 'archive/tar/minitar' 6 rescue LoadError 7 puts "You must gem install archive-tar-minitar to use the merb app generator" 8 exit! 9 end 10 3 11 module Merb 4 12 5 13 class AppGenerator 6 GEN_ROOT = File.dirname(__FILE__)14 SKELETON = File.expand_path File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'examples/skeleton.tar') 7 15 8 16 def self.run(path) … … 15 23 16 24 puts "Copying skeleton app to '#@path'" 17 FileUtils.cp_r("#{GEN_ROOT}/skeleton/.", @path) 18 19 #Find.find(@path) do |f| 20 # FileUtils.rm_rf(f) && puts( "deleting #{f}") if /\.svn$/ =~ f 21 #end 22 25 # Unpacks 'test.tar' to 'x', creating 'x' if necessary. 26 Archive::Tar::Minitar.unpack(SKELETON, @path) 23 27 puts 'Done' 24 28 end … … 27 31 28 32 end 33 trunk/lib/merb/merb_handler.rb
r125 r152 132 132 def handle(request) 133 133 path = request.params[Mongrel::Const::PATH_INFO].sub(/\/+/, '/') 134 path = path[0..-2] if (path[-1] == ?/) 134 path = path[0..-2] if (path[-1] == ?/) && path.size > 1 135 135 route = Merb::RouteMatcher.new.route_request(path) 136 136 [ instantiate_controller(route[:controller], request.body, request.params, route), trunk/lib/merb/mixins/basic_authentication_mixin.rb
r125 r152 17 17 end 18 18 19 def authenticate19 def basic_authentication 20 20 if !authenticated? 21 21 throw :halt, :access_denied
