Changeset 152

Show
Ignore:
Timestamp:
01/15/07 17:03:42 (2 years ago)
Author:
e.@brainspl.at
Message:

merb app generator now works. You must have archive-tar-minitar gem installed to use generator.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Rakefile

    r135 r152  
    77require 'code_statistics'  
    88require 'fileutils' 
    9 require File.dirname(__FILE__)+'/tools/rakehelp' 
     9def __DIR__ 
     10  File.dirname(__FILE__) 
     11end 
     12 
     13require __DIR__+'/tools/rakehelp' 
    1014include FileUtils 
     15 
    1116 
    1217NAME = "merb" 
     
    8590end 
    8691 
     92 
     93desc "Pack skeleton app as a tar.gz file" 
     94task :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 
     104end   
     105 
    87106desc 'Run unit tests' 
    88107Rake::TestTask.new('test_unit') do |t| 
  • trunk/examples/README_EXAMPLES

    r146 r152  
    33 
    44svn co http://svn.devjavu.com/merb/mrblog/trunk 
     5 
     6To generate your own new merb app first install the gem and then: 
     7 
     8$ merb -g appname 
     9or 
     10$ merb --generate-app appname 
  • trunk/lib/merb/generators/merb_app/merb_app.rb

    r147 r152  
    11require 'fileutils' 
    22require 'find' 
     3 
     4begin 
     5  require 'archive/tar/minitar' 
     6rescue LoadError 
     7  puts "You must gem install archive-tar-minitar to use the merb app generator" 
     8  exit! 
     9end 
     10 
    311module Merb 
    412   
    513  class AppGenerator     
    6     GEN_ROOT = File.dirname(__FILE__
     14    SKELETON = File.expand_path File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'examples/skeleton.tar'
    715     
    816    def self.run(path) 
     
    1523 
    1624      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) 
    2327      puts 'Done'  
    2428    end   
     
    2731         
    2832end   
     33 
  • trunk/lib/merb/merb_handler.rb

    r125 r152  
    132132  def handle(request) 
    133133    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 
    135135    route = Merb::RouteMatcher.new.route_request(path) 
    136136    [ instantiate_controller(route[:controller], request.body, request.params, route),  
  • trunk/lib/merb/mixins/basic_authentication_mixin.rb

    r125 r152  
    1717    end 
    1818     
    19     def authenticate 
     19    def basic_authentication 
    2020      if !authenticated? 
    2121        throw :halt, :access_denied