Changes in / [20:30]

Show
Ignore:
Files:
4974 added
1 removed
42 modified

Legend:

Unmodified
Added
Removed
  • /limeberry/trunk/test/unit/user_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class UserTest < DavTestCase 
     25class UserTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/principal_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class PrincipalTest < DavTestCase 
     25class PrincipalTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/liveprops_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class LivePropsTest < DavTestCase 
     25class LivePropsTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/property_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class PropertyTest < DavTestCase 
     25class PropertyTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/version_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class VersionTest < DavTestCase 
     25class VersionTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/resource_test_old.rb

    r14 r25  
    2727require File.dirname(__FILE__) + '/../../lib/if_header' 
    2828 
    29 class ResourceTest < DavTestCase 
     29class ResourceTest < DavUnitTestCase 
    3030 
    3131  # TODO: move to functional tests 
  • /limeberry/trunk/test/unit/privilege_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class PrivilegeTest < DavTestCase 
     25class PrivilegeTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/resource_test.rb

    r14 r25  
    2828require File.dirname(__FILE__) + '/../../lib/if_header' 
    2929 
    30 class ResourceTest < DavTestCase 
     30class ResourceTest < DavUnitTestCase 
    3131 
    3232  def setup 
  • /limeberry/trunk/test/unit/ace_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class AceTest < DavTestCase 
     25class AceTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/lock_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class LockTest < DavTestCase 
     25class LockTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/lock_null_resource_test.rb

    r14 r25  
    2525require  File.dirname(__FILE__) + '/../../lib/errors' 
    2626 
    27 class LockNullResourceTest < DavTestCase 
     27class LockNullResourceTest < DavUnitTestCase 
    2828 
    2929  def setup 
  • /limeberry/trunk/test/unit/vcr_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class VcrTest < DavTestCase 
     25class VcrTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/collection_test.rb

    r14 r25  
    2525require  File.dirname(__FILE__) + '/../../lib/errors' 
    2626 
    27 class CollectionTest < DavTestCase 
     27class CollectionTest < DavUnitTestCase 
    2828 
    2929  def setup 
  • /limeberry/trunk/test/unit/file_store_test.rb

    r14 r25  
    2525require File.dirname(__FILE__) + '/../../lib/errors' 
    2626 
    27 class FileStoreTest < DavTestCase 
     27class FileStoreTest < DavUnitTestCase 
    2828 
    2929  # tests that a put on the filestore actually creates a file on the disk 
  • /limeberry/trunk/test/unit/namespace_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class NamespaceTest < DavTestCase 
     25class NamespaceTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/path_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class PathTest < DavTestCase 
     25class PathTest < DavUnitTestCase 
    2626 
    2727  def test_create 
  • /limeberry/trunk/test/unit/group_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class GroupTest < DavTestCase 
     25class GroupTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/body_test.rb

    r14 r25  
    2424require 'fileutils' 
    2525 
    26 class BodyTest < DavTestCase 
     26class BodyTest < DavUnitTestCase 
    2727 
    2828  def setup 
  • /limeberry/trunk/test/unit/vhr_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class VhrTest < DavTestCase 
     25class VhrTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/unit/redirect_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class RedirectTest < DavTestCase 
     25class RedirectTest < DavUnitTestCase 
    2626 
    2727  #   #make redirect. 
  • /limeberry/trunk/test/unit/if_header_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class IfHeaderParserTest < DavTestCase 
     25class IfHeaderParserTest < DavUnitTestCase 
    2626 
    2727  def test_cond_new 
  • /limeberry/trunk/test/unit/bind_test.rb

    r14 r25  
    2323require 'test/test_helper' 
    2424 
    25 class BindTest < DavTestCase 
     25class BindTest < DavUnitTestCase 
    2626 
    2727  def setup 
  • /limeberry/trunk/test/test_helper.rb

    r14 r25  
    2121# SOFTWARE. 
    2222 
     23require 'config/request_methods' 
     24require 'test/http_method_maker' 
     25 
    2326raise 'require\'d test/test_helper twice!, you broke it!' if 
    2427  ENV['RAILS_ENV'] == 'test' 
     
    3235$: << 'test' unless $:.include? 'test' 
    3336 
    34 # Test helpers, via http://wiseheartdesign.com/articles/2006/01/28/test-helpers-for-rails 
    35 TEST_ROOT = File.expand_path(File.dirname(__FILE__)) unless defined? TEST_ROOT 
    36  
    37 # Auto require test helpers 
    38 Dir[TEST_ROOT + '/helpers/**/*_helper.rb'].each do |helper| 
    39   require helper 
    40 end 
    41  
    4237class Test::Unit::TestCase 
    4338  def deny(x, m=nil); assert ! x, m; end 
     
    4540  self.use_transactional_fixtures = true 
    4641  self.use_instantiated_fixtures  = false 
    47  
    48   # Class method for test helpers 
    49   def self.test_helper(*names) 
    50     names.each do |name| 
    51       constant = Inflector.constantize(Inflector.classify("#{name}_test_helper")) 
    52       self.class_eval { include constant } 
    53     end 
    54   end 
    55 end 
    56  
    57 class DavTestCase < Test::Unit::TestCase 
     42end 
     43 
     44module DavTest 
    5845 
    5946  def self.register_profiler 
     
    9380  end 
    9481 
    95   def expanded_file(path) DavTestCase.expanded_file(path) end 
     82  def expanded_file(path) DavTest.expanded_file(path) end 
    9683 
    9784  FILESTORE_TEST_BACKUP = expanded_file "filestore/test-backup" 
     
    179166  end 
    180167 
    181   class HttpTestRequest < ActionController::TestRequest 
    182     attr_reader :cgi 
    183  
    184     def initialize 
    185       super 
    186       self.body = "" 
    187     end 
    188      
    189     def body=(body) 
    190       @cgi ||= FakeCgi.new 
    191       @cgi.stdinput = StringIO.new(body) 
    192     end 
    193  
    194     def rewind_body 
    195       @cgi.stdinput.rewind 
    196     end 
    197  
    198     class FakeCgi 
    199       attr_accessor :stdinput 
    200     end 
    201  
    202     def clear_http_headers 
    203       env.delete_if { |k, v| k =~ /^HTTP_/ } 
    204     end 
    205      
    206   end 
    207 p 
    208    
    209 end 
    210  
     168  def assert_content_equals(expected, path, clear_headers = false) 
     169    @request.clear_http_headers if clear_headers 
     170    get path, 'limeberry' 
     171    assert_response 200 
     172    assert_equal expected, @response.binary_content 
     173  end 
     174   
     175end 
     176 
     177class DavUnitTestCase < Test::Unit::TestCase 
     178  include DavTest 
     179end 
     180 
     181class DavFunctionalTestCase < Test::Unit::TestCase 
     182  include DavTest 
     183 
     184  def self.inherited sub 
     185    super 
     186    sub_name = sub.name.demodulize.underscore 
     187    if sub_name.sub! /^([^_]*)_controller_test$/, '\1' 
     188      request_class = sub_name.to_sym 
     189 
     190      if Limeberry::REQUEST_METHODS.include? request_class 
     191        Limeberry::REQUEST_METHODS[request_class].each do |m| 
     192          sub.class_eval(HttpMethodMaker::Functional.http_method_body(m), __FILE__, __LINE__) 
     193        end 
     194      end 
     195    end 
     196  end 
     197   
     198end 
     199 
     200class DavIntegrationTestCase < ActionController::IntegrationTest 
     201  include DavTest 
     202end 
     203 
     204class HttpTestRequest < ActionController::TestRequest 
     205  attr_reader :cgi 
     206 
     207  def initialize 
     208    super 
     209    self.body = "" 
     210  end 
     211   
     212  def body=(body) 
     213    @cgi ||= FakeCgi.new 
     214    @cgi.stdinput = StringIO.new(body) 
     215  end 
     216 
     217  def rewind_body 
     218    @cgi.stdinput.rewind 
     219  end 
     220 
     221  class FakeCgi 
     222    attr_accessor :stdinput 
     223  end 
     224 
     225  def clear_http_headers 
     226    env.delete_if { |k, v| k =~ /^HTTP_/ } 
     227  end 
     228   
     229end 
     230 
  • /limeberry/trunk/test/functional/bind_controller_test.rb

    r14 r25  
    3131end 
    3232 
    33 class BindControllerTest < DavTestCase 
    34   test_helper :bind 
     33class BindControllerTest < DavFunctionalTestCase 
    3534 
    3635  def setup 
  • /limeberry/trunk/test/functional/acl_controller_test.rb

    r14 r25  
    2727class AclController; def rescue_action(e) raise e end; end 
    2828 
    29 class AclControllerTest < DavTestCase 
    30   test_helper :acl 
     29class AclControllerTest < DavFunctionalTestCase 
    3130   
    3231  def setup 
  • /limeberry/trunk/test/functional/deltav_controller_test.rb

    r14 r25  
    2727class DeltavController; def rescue_action(e) raise e end; end 
    2828 
    29 class DeltavControllerTest < DavTestCase 
     29class DeltavControllerTest < DavFunctionalTestCase 
    3030  def setup 
    3131    super 
  • /limeberry/trunk/test/functional/http_controller_test.rb

    r14 r25  
    2727class HttpController; def rescue_action(e) raise e end; end 
    2828 
    29 class HttpControllerTest < DavTestCase 
    30   test_helper :http 
     29class HttpControllerTest < DavFunctionalTestCase 
    3130 
    3231  def setup 
  • /limeberry/trunk/test/functional/principal_controller_test.rb

    r14 r25  
    2727class PrincipalController; def rescue_action(e) raise e end; end 
    2828 
    29 class PrincipalControllerTest < DavTestCase 
     29class PrincipalControllerTest < DavFunctionalTestCase 
    3030  def setup 
    3131    super 
  • /limeberry/trunk/test/functional/application_controller_test.rb

    r14 r25  
    2424require 'application' 
    2525 
    26 class ApplicationControllerTest < DavTestCase 
     26class ApplicationControllerTest < DavFunctionalTestCase 
    2727 
    2828  def setup 
  • /limeberry/trunk/test/functional/lock_controller_test.rb

    r14 r25  
    2727class LockController; def rescue_action(e) raise e end; end 
    2828 
    29 class LockControllerTest < DavTestCase 
    30   test_helper :lock 
    31  
     29class LockControllerTest < DavFunctionalTestCase 
    3230   
    3331  def setup 
  • /limeberry/trunk/test/functional/webdav_controller_test.rb

    r14 r25  
    2828class WebdavController; def rescue_action(e) raise e end; end 
    2929 
    30 class WebdavControllerTest < DavTestCase 
    31   test_helper :webdav 
     30class WebdavControllerTest < DavFunctionalTestCase 
    3231   
    3332  def setup 
  • /limeberry/trunk/test/fixtures

    • Property svn:ignore set to
      *
  • /limeberry/trunk/app/models/resource.rb

    r14 r22  
    2828require 'rexml/document' 
    2929require 'set' 
    30 require 'uuidtools/lib/uuidtools' 
     30require 'uuidtools' 
    3131require 'web_dav_response' 
    3232 
  • /limeberry/trunk/app/models/lock.rb

    r14 r22  
    2424# $Id$ 
    2525 
    26 require 'uuidtools/lib/uuidtools' 
     26require 'uuidtools' 
    2727 
    2828class Lock < ActiveRecord::Base 
  • /limeberry/trunk/log

    • Property svn:ignore set to
      *.log
  • /limeberry/trunk/db

    • Property svn:ignore set to
      schema.rb
  • /limeberry/trunk/filestore

    • Property svn:ignore set to
      *
  • /limeberry/trunk/README

    r14 r24  
    1 == Welcome to Rails 
     1LimeBerry is a prototype of an advanced WebDAV server written in Ruby 
     2on Rails. 
    23 
    3 Rails is a web-application and persistence framework that includes everything 
    4 needed to create database-backed web-applications according to the 
    5 Model-View-Control pattern of separation. This pattern splits the view (also 
    6 called the presentation) into "dumb" templates that are primarily responsible 
    7 for inserting pre-built data in between HTML tags. The model contains the 
    8 "smart" domain objects (such as Account, Product, Person, Post) that holds all 
    9 the business logic and knows how to persist themselves to a database. The 
    10 controller handles the incoming requests (such as Save New Account, Update 
    11 Product, Show Post) by manipulating the model and directing data to the view. 
     4General Software Requirements: xdelta, mysql server & client 
    125 
    13 In Rails, the model is handled by what's called an object-relational mapping 
    14 layer entitled Active Record. This layer allows you to present the data from 
    15 database rows as objects and embellish these data objects with business logic 
    16 methods. You can read more about Active Record in  
    17 link:files/vendor/rails/activerecord/README.html. 
     6Gem Requirements: httpauth, mysql, rake, shared-mime-info, uuidtools 
    187 
    19 The controller and view are handled by the Action Pack, which handles both 
    20 layers by its two parts: Action View and Action Controller. These two layers 
    21 are bundled in a single package due to their heavy interdependence. This is 
    22 unlike the relationship between the Active Record and Action Pack that is much 
    23 more separate. Each of these packages can be used independently outside of 
    24 Rails.  You can read more about Action Pack in  
    25 link:files/vendor/rails/actionpack/README.html. 
    26  
    27  
    28 == Getting started 
    29  
    30 1. Run the WEBrick servlet: <tt>ruby script/server</tt> (run with --help for options) 
    31    ...or if you have lighttpd installed: <tt>ruby script/lighttpd</tt> (it's faster) 
    32 2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!" 
    33 3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen 
    34  
    35  
    36 == Example for Apache conf 
    37  
    38   <VirtualHost *:80> 
    39     ServerName rails 
    40     DocumentRoot /path/application/public/ 
    41     ErrorLog /path/application/log/server.log 
    42    
    43     <Directory /path/application/public/> 
    44       Options ExecCGI FollowSymLinks 
    45       AllowOverride all 
    46       Allow from all 
    47       Order allow,deny 
    48     </Directory> 
    49   </VirtualHost> 
    50  
    51 NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI 
    52 should be on and ".cgi" should respond. All requests from 127.0.0.1 go 
    53 through CGI, so no Apache restart is necessary for changes. All other requests 
    54 go through FCGI (or mod_ruby), which requires a restart to show changes. 
    55  
    56  
    57 == Debugging Rails 
    58  
    59 Have "tail -f" commands running on both the server.log, production.log, and 
    60 test.log files. Rails will automatically display debugging and runtime 
    61 information to these files. Debugging info will also be shown in the browser 
    62 on requests from 127.0.0.1. 
    63  
    64  
    65 == Breakpoints 
    66  
    67 Breakpoint support is available through the script/breakpointer client. This 
    68 means that you can break out of execution at any point in the code, investigate 
    69 and change the model, AND then resume execution! Example: 
    70  
    71   class WeblogController < ActionController::Base 
    72     def index 
    73       @posts = Post.find_all 
    74       breakpoint "Breaking out from the list" 
    75     end 
    76   end 
    77    
    78 So the controller will accept the action, run the first line, then present you 
    79 with a IRB prompt in the breakpointer window. Here you can do things like: 
    80  
    81 Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' 
    82  
    83   >> @posts.inspect 
    84   => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,  
    85        #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" 
    86   >> @posts.first.title = "hello from a breakpoint" 
    87   => "hello from a breakpoint" 
    88  
    89 ...and even better is that you can examine how your runtime objects actually work: 
    90  
    91   >> f = @posts.first  
    92   => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> 
    93   >> f. 
    94   Display all 152 possibilities? (y or n) 
    95  
    96 Finally, when you're ready to resume execution, you press CTRL-D 
    97  
    98  
    99 == Console 
    100  
    101 You can interact with the domain model by starting the console through script/console.  
    102 Here you'll have all parts of the application configured, just like it is when the 
    103 application is running. You can inspect domain models, change values, and save to the 
    104 database. Starting the script without arguments will launch it in the development environment. 
    105 Passing an argument will specify a different environment, like <tt>console production</tt>. 
    106  
    107  
    108 == Description of contents 
    109  
    110 app 
    111   Holds all the code that's specific to this particular application. 
    112  
    113 app/controllers 
    114   Holds controllers that should be named like weblog_controller.rb for 
    115   automated URL mapping. All controllers should descend from 
    116   ActionController::Base. 
    117  
    118 app/models 
    119   Holds models that should be named like post.rb. 
    120   Most models will descend from ActiveRecord::Base. 
    121    
    122 app/views 
    123   Holds the template files for the view that should be named like 
    124   weblog/index.rhtml for the WeblogController#index action. All views use eRuby 
    125   syntax. This directory can also be used to keep stylesheets, images, and so on 
    126   that can be symlinked to public. 
    127    
    128 app/helpers 
    129   Holds view helpers that should be named like weblog_helper.rb. 
    130  
    131 config 
    132   Configuration files for the Rails environment, the routing map, the database, and other dependencies. 
    133  
    134 components 
    135   Self-contained mini-applications that can bundle together controllers, models, and views. 
    136  
    137 lib 
    138   Application specific libraries. Basically, any kind of custom code that doesn't 
    139   belong under controllers, models, or helpers. This directory is in the load path. 
    140      
    141 public 
    142   The directory available for the web server. Contains subdirectories for images, stylesheets, 
    143   and javascripts. Also contains the dispatchers and the default HTML files. 
    144  
    145 script 
    146   Helper scripts for automation and generation. 
    147  
    148 test 
    149   Unit and functional tests along with fixtures. 
    150  
    151 vendor 
    152   External libraries that the application depends on. Also includes the plugins subdirectory. 
    153   This directory is in the load path. 
  • /limeberry/trunk/tmp

    • Property svn:ignore set to
      *
  • /limeberry/trunk/tmp/test

    • Property svn:ignore set to
      *
  • /limeberry/trunk/config/routes.rb

    r14 r25  
    2121# SOFTWARE. 
    2222 
     23require "config/request_methods" 
     24 
    2325ActionController::Routing::Routes.draw do |map| 
    2426  # Add your own custom routes here. 
     
    4244              :action => "put_group", :conditions => {:method => :put}) 
    4345 
    44   { 
    45     "http"   => %w( head get put options delete ), 
    46     "webdav" => %w( propfind proppatch mkcol copy move ), 
    47     "lock"  => %w( lock unlock ), 
    48     "bind"   => %w( bind unbind rebind ), 
    49     "deltav" => %w( version-control checkin checkout ), 
    50     "acl"    => %w( acl ) 
    51   }.each do |controller, methods| 
     46  Limeberry::REQUEST_METHODS.each do |controller, methods| 
    5247    methods.each do |method| 
    5348      action = method.gsub(/-/, '_') 
    5449      map.connect("#{BASE_WEBDAV_PATH}/*path", 
    55                   :controller => controller, 
     50                  :controller => controller.to_s, 
    5651                  :action => action, 
    5752                  :conditions => { :method => method }) 
  • /vendor/rails/README

    r5 r26  
    11This vendor branch is taken from the Rails svn tags directory at 
    22http://svn.rubyonrails.org/rails/tags/ 
     3 
     4or svn trunk at 
     5http://svn.rubyonrails.org/rails/trunk/