incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quellho...@apache.org
Subject svn commit: r449142 [21/31] - in /incubator/heraldry: idp/ idp/pip/ idp/pip/branches/ idp/pip/tags/ idp/pip/trunk/ idp/pip/trunk/app/ idp/pip/trunk/app/controllers/ idp/pip/trunk/app/helpers/ idp/pip/trunk/app/models/ idp/pip/trunk/app/views/ idp/pip/t...
Date Sat, 23 Sep 2006 01:37:43 GMT
Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,96 @@
+class AuthenticatedGenerator < Rails::Generator::NamedBase
+  attr_reader   :controller_name,
+                :controller_class_path,
+                :controller_file_path,
+                :controller_class_nesting,
+                :controller_class_nesting_depth,
+                :controller_class_name,
+                :controller_singular_name,
+                :controller_plural_name
+  alias_method  :controller_file_name,  :controller_singular_name
+  alias_method  :controller_table_name, :controller_plural_name
+
+  def initialize(runtime_args, runtime_options = {})
+    super
+
+    # Take controller name from the next argument.  Default to the pluralized model name.
+    @controller_name = args.shift
+    @controller_name ||= ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name
+
+    base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
+    @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
+
+    if @controller_class_nesting.empty?
+      @controller_class_name = @controller_class_name_without_nesting
+    else
+      @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
+    end
+  end
+
+  def manifest
+    record do |m|
+      # Check for class naming collisions.
+      m.class_collisions controller_class_path, "#{controller_class_name}Controller", 
+                                                #"#{controller_class_name}ControllerTest", 
+                                                "#{controller_class_name}Helper"
+      m.class_collisions class_path,            "#{class_name}"
+                                                #"#{class_name}Test"
+      m.class_collisions [], 'AuthenticatedSystem', 'AuthenticatedTestHelper'
+
+      # Controller, helper, views, and test directories.
+      m.directory File.join('app/models', class_path)
+      m.directory File.join('app/controllers', controller_class_path)
+      m.directory File.join('app/helpers', controller_class_path)
+      m.directory File.join('app/views', controller_class_path, controller_file_name)
+      m.directory File.join('test/functional', controller_class_path)
+      m.directory File.join('test/unit', class_path)
+
+      m.template 'model.rb',
+                  File.join('app/models',
+                            class_path,
+                            "#{file_name}.rb")
+
+      m.template 'controller.rb',
+                  File.join('app/controllers',
+                            controller_class_path,
+                            "#{controller_file_name}_controller.rb")
+
+      m.template 'authenticated_system.rb',
+                  File.join('lib', 'authenticated_system.rb')
+
+      m.template 'authenticated_test_helper.rb',
+                  File.join('lib', 'authenticated_test_helper.rb')
+
+      m.template 'functional_test.rb',
+                  File.join('test/functional',
+                            controller_class_path,
+                            "#{controller_file_name}_controller_test.rb")
+
+      m.template 'helper.rb',
+                  File.join('app/helpers',
+                            controller_class_path,
+                            "#{controller_file_name}_helper.rb")
+
+      m.template 'unit_test.rb',
+                  File.join('test/unit',
+                            class_path,
+                            "#{file_name}_test.rb")
+
+      m.template 'fixtures.yml',
+                  File.join('test/fixtures',
+                            "#{table_name}.yml")
+
+      # Controller templates
+      %w( index login signup ).each do |action|
+        m.template "#{action}.rhtml",
+                   File.join('app/views', controller_class_path, controller_file_name, "#{action}.rhtml")
+      end
+    end
+  end
+
+  protected
+    # Override with your own usage banner.
+    def banner
+      "Usage: #{$0} authenticated ModelName [ControllerName]"
+    end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,121 @@
+module AuthenticatedSystem
+  protected
+  def logged_in?
+    # Example of integration with account_location plugin
+    # session[account_subdomain] == :authenticated && current_<%= file_name %>
+    current_<%= file_name %>
+  end
+
+  # accesses the current <%= file_name %> from the session.
+  # overwrite this to set how the current <%= file_name %> is retrieved from the session.
+  # To store just the whole <%= file_name %> model in the session:
+  #
+  #   def current_<%= file_name %>
+  #     session[:<%= file_name %>]
+  #   end
+  # 
+  def current_<%= file_name %>
+    @current_<%= file_name %> ||= session[:<%= file_name %>] ? <%= class_name %>.find_by_id(session[:<%= file_name %>]) : nil
+  end
+
+  # store the given <%= file_name %> in the session.  overwrite this to set how
+  # <%= table_name %> are stored in the session.  To store the whole <%= file_name %> model, do:
+  #
+  #   def current_<%= file_name %>=(new_<%= file_name %>)
+  #     session[:<%= file_name %>] = new_<%= file_name %>
+  #   end
+  # 
+  def current_<%= file_name %>=(new_<%= file_name %>)
+    # Example of integration with account_location plugin
+    # session[account_subdomain] = new_<%= file_name %>.nil? ? nil : :authenticated
+    session[:<%= file_name %>] = new_<%= file_name %>.nil? ? nil : new_<%= file_name %>.id
+    @current_<%= file_name %> = new_<%= file_name %>
+  end
+
+  # overwrite this if you want to restrict access to only a few actions
+  # or if you want to check if the <%= file_name %> has the correct rights  
+  # example:
+  #
+  #  # only allow nonbobs
+  #  def authorize?(<%= file_name %>)
+  #    <%= file_name %>.login != "bob"
+  #  end
+  def authorized?(<%= file_name %>)
+     true
+  end
+
+  # overwrite this method if you only want to protect certain actions of the controller
+  # example:
+  # 
+  #  # don't protect the login and the about method
+  #  def protect?(action)
+  #    if ['action', 'about'].include?(action)
+  #       return false
+  #    else
+  #       return true
+  #    end
+  #  end
+  def protect?(action)
+    true
+  end
+
+  # Example of integration with account_location plugin
+  # def account?
+  #   @account ||= Account.find_by_username(account_subdomain)
+  # end
+  # 
+  # def account_required
+  #   return true if account?
+  #   redirect_to(:controller => '/<%= controller_file_name %>', :action => 'index') and return false
+  # end
+
+  # To require logins, use:
+  #
+  #   before_filter :login_required                            # restrict all actions
+  #   before_filter :login_required, :only => [:edit, :update] # only restrict these actions
+  # 
+  # To skip this in a subclassed controller:
+  #
+  #   skip_before_filter :login_required
+  # 
+  def login_required
+    # skip login check if action is not protected
+    return true unless protect?(action_name)
+
+    # check if <%= file_name %> is logged in and authorized
+    return true if logged_in? and authorized?(current_<%= file_name %>)
+
+    # store current location so that we can 
+    # come back after the <%= file_name %> logged in
+    store_location
+
+    # call overwriteable reaction to unauthorized access
+    access_denied and return false
+  end
+
+  # overwrite if you want to have special behavior in case the <%= file_name %> is not authorized
+  # to access the current operation. 
+  # the default action is to redirect to the login screen
+  # example use :
+  # a popup window might just close itself for instance
+  def access_denied
+    redirect_to :controller => '/<%= controller_file_name %>', :action => 'login'
+  end  
+
+  # store current uri in  the session.
+  # we can return to this location by calling return_location
+  def store_location
+    session[:return_to] = request.request_uri
+  end
+
+  # move to the last store_location call or to the passed default one
+  def redirect_back_or_default(default)
+    session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)
+    session[:return_to] = nil
+  end
+
+  # adds ActionView helper methods
+  def self.included(base)
+    base.send :helper_method, :current_<%= file_name %>, :logged_in?
+  end
+end
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,49 @@
+module AuthenticatedTestHelper
+  # Sets the current <%= file_name %> in the session from the <%= file_name %> fixtures.
+  def login_as(<%= file_name %>)
+    @request.session[:<%= file_name %>] = <%= table_name %>(<%= file_name %>).id
+  end
+
+  # Assert the block redirects to the login
+  # 
+  #   assert_requires_login(:bob) { get :edit, :id => 1 }
+  #
+  def assert_requires_login(<%= file_name %> = nil, &block)
+    login_as(<%= file_name %>) if <%= file_name %>
+    block.call
+    assert_redirected_to :controller => '<%= controller_file_name %>', :action => 'login'
+  end
+
+  # Assert the block accepts the login
+  # 
+  #   assert_accepts_login(:bob) { get :edit, :id => 1 }
+  #
+  # Accepts anonymous logins:
+  #
+  #   assert_accepts_login { get :list }
+  #
+  def assert_accepts_login(<%= file_name %> = nil, &block)
+    login_as(<%= file_name %>) if <%= file_name %>
+    block.call
+    assert_response :success
+  end
+
+  # http://project.ioni.st/post/217#post-217
+  #
+  #  def test_new_publication
+  #    assert_difference(Publication, :count) do
+  #      post :create, :publication => {...}
+  #      # ...
+  #    end
+  #  end
+  # 
+  def assert_difference(object, method = nil, difference = 1)
+    initial_value = object.send(method)
+    yield
+    assert_equal initial_value + difference, object.send(method), "#{object}##{method}"
+  end
+
+  def assert_no_difference(object, method, &block)
+    assert_difference object, method, 0, &block
+  end
+end
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,58 @@
+class <%= controller_class_name %>Controller < ApplicationController
+  include AuthenticatedSystem
+  # Be sure to include AuthenticationSystem in Application Controller instead
+  # To require logins, use:
+  #
+  #   before_filter :login_required                            # restrict all actions
+  #   before_filter :login_required, :only => [:edit, :update] # only restrict these actions
+  # 
+  # To skip this in a subclassed controller:
+  #
+  #   skip_before_filter :login_required
+
+  # say something nice, you goof!  something sweet.
+  def index
+    redirect_to(:action => 'signup') unless logged_in? or <%= class_name %>.count > 0
+  end
+
+  # If you want persistent logins, uncomment the second line of #login and add this to your login.rhtml view:
+  #
+  #   <p><label for="remember_me">Remember Me?</label>
+  #   <%%= check_box_tag 'remember_me', 1, true %></p>
+  #
+  # Keep in mind that this will cause your session to stick around for 4 weeks.  If this is undesirable, use a plain old cookie.
+  def login
+    return unless request.post?
+    #::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 4.weeks.from_now) if params[:remember_me]
+    self.current_<%= file_name %> = <%= class_name %>.authenticate(params[:login], params[:password])
+    if current_<%= file_name %>
+      redirect_back_or_default(:controller => '/<%= controller_file_name %>', :action => 'index')
+      flash[:notice] = "Logged in successfully"
+    end
+  end
+
+  def signup
+    @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
+    return unless request.post?
+    if @<%= file_name %>.save
+      redirect_back_or_default(:controller => '/<%= controller_file_name %>', :action => 'index')
+      flash[:notice] = "Thanks for signing up!"
+    end
+  end
+  
+  # Sample method for activating the current user
+  #def activate
+  #  @<%= file_name %> = <%= class_name %>.find_by_activation_code(params[:id])
+  #  if @<%= file_name %> and @<%= file_name %>.activate
+  #    self.current_<%= file_name %> = @<%= file_name %>
+  #    redirect_back_or_default(:controller => '/<%= controller_file_name %>', :action => 'index')
+  #    flash[:notice] = "Your account has been activated."
+  #  end
+  #end
+
+  def logout
+    self.current_<%= file_name %> = nil
+    flash[:notice] = "You have been logged out."
+    redirect_back_or_default(:controller => '/<%= controller_file_name %>', :action => 'index')
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/fixtures.yml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/fixtures.yml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/fixtures.yml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/fixtures.yml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,17 @@
+quentin:
+  id: 1
+  login: quentin
+  email: quentin@example.com
+  salt: 62a636a58d0648eadf7410aa2e4444866174c96e
+  crypted_password: be61f3ff72492591afe5081857a8ff17a85b21f9 # quentin
+  #crypted_password: "ce2/iFrNtQ8=\n" # quentin, use only if you're using 2-way encryption
+  created_at: <%%= 5.days.ago.to_s :db %>
+  # activated_at: <%%= 5.days.ago.to_s :db %> # only if you're activating new signups
+arthur:
+  id: 2
+  login: arthur
+  email: arthur@example.com
+  salt: 55bc51360864c82dcd7ff4bcfec56a8d8e79e751
+  crypted_password: 37ba966058c6f39162e5b537adb516af91cd1fe6 # arthur
+  # activation_code: arthurscode # only if you're activating new signups
+  created_at: <%%= 1.days.ago.to_s :db %>
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,110 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require '<%= controller_file_name %>_controller'
+
+# Re-raise errors caught by the controller.
+class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
+
+class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
+  # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead
+  include AuthenticatedTestHelper
+
+  fixtures :<%= table_name %>
+
+  def setup
+    @controller = <%= controller_class_name %>Controller.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+    
+    # for testing action mailer
+    # @emails = ActionMailer::Base.deliveries 
+    # @emails.clear
+  end
+
+  def test_should_login_and_redirect
+    post :login, :login => 'quentin', :password => 'quentin'
+    assert session[:<%= file_name %>]
+    assert_response :redirect
+  end
+
+  def test_should_fail_login_and_not_redirect
+    post :login, :login => 'quentin', :password => 'bad password'
+    assert_nil session[:<%= file_name %>]
+    assert_response :success
+  end
+
+  def test_should_allow_signup
+    assert_difference <%= class_name %>, :count do
+      create_<%= file_name %>
+      assert_response :redirect
+    end
+  end
+
+  def test_should_require_login_on_signup
+    assert_no_difference <%= class_name %>, :count do
+      create_<%= file_name %>(:login => nil)
+      assert assigns(:<%= file_name %>).errors.on(:login)
+      assert_response :success
+    end
+  end
+
+  def test_should_require_password_on_signup
+    assert_no_difference <%= class_name %>, :count do
+      create_<%= file_name %>(:password => nil)
+      assert assigns(:<%= file_name %>).errors.on(:password)
+      assert_response :success
+    end
+  end
+
+  def test_should_require_password_confirmation_on_signup
+    assert_no_difference <%= class_name %>, :count do
+      create_<%= file_name %>(:password_confirmation => nil)
+      assert assigns(:<%= file_name %>).errors.on(:password_confirmation)
+      assert_response :success
+    end
+  end
+
+  def test_should_require_email_on_signup
+    assert_no_difference <%= class_name %>, :count do
+      create_<%= file_name %>(:email => nil)
+      assert assigns(:<%= file_name %>).errors.on(:email)
+      assert_response :success
+    end
+  end
+
+  def test_should_logout
+    login_as :quentin
+    get :logout
+    assert_nil session[:<%= file_name %>]
+    assert_response :redirect
+  end
+
+  # Uncomment if you're activating new user accounts
+  # 
+  # def test_should_activate_user
+  #   assert_nil User.authenticate('arthur', 'arthur')
+  #   get :activate, :id => users(:arthur).activation_code
+  #   assert_equal <%= table_name %>(:arthur), <%= class_name %>.authenticate('arthur', 'arthur')
+  # end
+  # 
+  # def test_should_activate_user_and_send_activation_email
+  #   get :activate, :id => <%= table_name %>(:arthur).activation_code
+  #   assert_equal 1, @emails.length
+  #   assert(@emails.first.subject =~ /Your account has been activated/)
+  #   assert(@emails.first.body    =~ /#{assigns(:<%= file_name %>).login}, your account has been activated/)
+  # end
+  # 
+  # def test_should_send_activation_email_after_signup
+  #   create_<%= file_name %>
+  #   assert_equal 1, @emails.length
+  #   assert(@emails.first.subject =~ /Please activate your new account/)
+  #   assert(@emails.first.body    =~ /Username: quire/)
+  #   assert(@emails.first.body    =~ /Password: quire/)
+  #   assert(@emails.first.body    =~ /account\/activate\/#{assigns(:<%= file_name %>).activation_code}/)
+  # end
+
+  protected
+  def create_<%= file_name %>(options = {})
+    post :signup, :<%= file_name %> => { :login => 'quire', :email => 'quire@example.com', 
+                             :password => 'quire', :password_confirmation => 'quire' }.merge(options)
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/helper.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/helper.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/helper.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/helper.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,2 @@
+module <%= controller_class_name %>Helper
+end
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,56 @@
+<h1>In the Caboose.</h1>
+
+<%% content_for 'poem' do -%>
+"Train delayed? and what's to say?" 
+"Blocked by last night's snow they say." 
+Seven hours or so to wait; 
+Well, that's pleasant! but there's the freight. 
+Depot loafing no one fancies, 
+We'll try the caboose and take our chances. 
+  
+Cool this morning in Watertown, 
+Somewhat frosty___mercury down; 
+Enter caboose___roaring fire, 
+With never an air-hole; heat so dire 
+That we shrivel and pant; we are roasted through- 
+Outside, thermometer thirty-two. 
+  
+We start with a jerk and suddenly stop. 
+"What's broke?" says one; another "What's up?", 
+"Oh, nothing," they answer, "That's our way: 
+You must stand the jerking, sorry to say." 
+We "stand it" with oft this painful thought: 
+Are our heads on yet, or are they not? 
+  
+Comrades in misery___let me see; 
+Girl like a statue opposite me; 
+Back and forth the others jostle___ 
+She never winks, nor moves a muscle; 
+See her, as she sits there now; 
+She's "well balanced," anyhow. 
+  
+Woman in trouble, tearful eyes, 
+Sits by the window, softly cries, 
+Pity___for griefs we may not know, 
+For breasts that ache, for tears that flow, 
+Though we know not why. Her eyelids red 
+Tell a sorrowful tale___some hope is dead. 
+  
+Man who follows the Golden Rule, 
+And lends his papers___a pocket full, 
+Has a blank book___once in a minute 
+Has an idea, and writes it in it. 
+Guess him? Yes, of course I can, 
+He's a___well___a newspaper man. 
+  
+Blue-eyed fairy, wrapped in fur; 
+Sweet young mother tending her. 
+Fairy thinks it's "awful far," 
+Wants to get off this "naughty car." 
+So do we, young golden-hair; 
+All this crowd are with you there!
+<%% end -%>
+
+<%%= simple_format @content_for_poem %>
+
+<p><a href="http://skyways.lib.ks.us/poetry/walls/caboose.html">-- Ellen P. Allerton.</a></p>
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/login.rhtml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/login.rhtml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/login.rhtml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/login.rhtml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,9 @@
+<%%= start_form_tag %>
+<p><label for="login">Login</label><br/>
+<%%= text_field_tag 'login' %></p>
+
+<p><label for="password">Password</label><br/>
+<%%= password_field_tag 'password' %></p>
+
+<p><%%= submit_tag 'Log in' %></p>
+<%%= end_form_tag %>
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,121 @@
+# Sample schema:
+#   create_table "<%= table_name %>", :force => true do |t|
+#     t.column "login",            :string, :limit => 40
+#     t.column "email",            :string, :limit => 100
+#     t.column "crypted_password", :string, :limit => 40
+#     t.column "salt",             :string, :limit => 40
+#     t.column "activation_code",  :string, :limit => 40 # only if you want
+#     t.column "activated_at",     :datetime             # user activation
+#     t.column "created_at",       :datetime
+#     t.column "updated_at",       :datetime
+#   end
+#
+# If you wish to have a mailer, run:
+#
+#   ./script/generate authenticated_mailer user
+# 
+# Be sure to add the observer to the form login controller:
+#
+#   class AccountController < ActionController::Base
+#     observer :user_observer
+#   end
+#
+# For extra credit: keep these two requires for 2-way reversible encryption
+# require 'openssl'
+# require 'base64'
+#
+require 'digest/sha1'
+class <%= class_name %> < ActiveRecord::Base
+  # Virtual attribute for the unencrypted password
+  attr_accessor :password
+
+  validates_presence_of     :login, :email
+  validates_presence_of     :password,                   :if => :password_required?
+  validates_presence_of     :password_confirmation,      :if => :password_required?
+  validates_length_of       :password, :within => 5..40, :if => :password_required?
+  validates_confirmation_of :password,                   :if => :password_required?
+  validates_length_of       :login,    :within => 3..40
+  validates_length_of       :email,    :within => 3..100
+  validates_uniqueness_of   :login, :email, :salt
+  before_save :encrypt_password
+  # Uncomment this to use activation
+  # before_create :make_activation_code
+
+  # Authenticates a user by their login name and unencrypted password.  Returns the user or nil.
+  def self.authenticate(login, password)
+    # use this instead if you want user activation
+    # u = find :first, :select => 'id, salt', :conditions => ['login = ? and activated_at IS NOT NULL', login]
+    u = find_by_login(login) # need to get the salt
+    u && u.authenticated?(password) ? u : nil
+  end
+
+  # Encrypts some data with the salt.
+  def self.encrypt(password, salt)
+    Digest::SHA1.hexdigest("--#{salt}--#{password}--")
+  end
+
+  # Encrypts the password with the user salt
+  def encrypt(password)
+    self.class.encrypt(password, salt)
+  end
+
+  def authenticated?(password)
+    crypted_password == encrypt(password)
+  end
+
+  # More extra credit for adding 2-way encryption.  Feel free to remove self.encrypt above if you use this
+  #
+  # # Encrypts some data with the salt.
+  # def self.encrypt(password, salt)
+  #   enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')
+  #   enc.encrypt(salt)
+  #   data = enc.update(password)
+  #   Base64.encode64(data << enc.final)
+  # end
+  # 
+  # # getter method to decrypt password
+  # def password
+  #   unless @password
+  #     enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')
+  #     enc.decrypt(salt)
+  #     text = enc.update(Base64.decode64(crypted_password))
+  #     @password = (text << enc.final)
+  #   end
+  #   @password
+  # rescue
+  #   nil
+  # end
+
+  # Uncomment these methods for user activation  These also help let the mailer know precisely when the user is activated.
+  # There's also a commented-out before hook above and a protected method below.
+  #
+  # The controller has a commented-out 'activate' action too.
+  #
+  # # Activates the user in the database.
+  # def activate
+  #   @activated = true
+  #   update_attributes(:activated_at => Time.now.utc, :activation_code => nil)
+  # end
+  # 
+  # # Returns true if the user has just been activated.
+  # def recently_activated?
+  #   @activated
+  # end
+  
+  protected
+  # before filter 
+  def encrypt_password
+    return if password.blank?
+    self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
+    self.crypted_password = encrypt(password)
+  end
+
+  def password_required?
+    crypted_password.blank? or not password.blank?
+  end
+
+  # If you're going to use activation, uncomment this too
+  #def make_activation_code
+  #  self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split('//').sort_by {rand}.join )
+  #end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/signup.rhtml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/signup.rhtml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/signup.rhtml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/signup.rhtml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,15 @@
+<%% form_for :<%= file_name %>, @<%= file_name %> do |f| -%>
+<p><label for="login">Login</label><br/>
+<%%= f.text_field :login %></p>
+
+<p><label for="email">Email</label><br/>
+<%%= f.text_field :email %></p>
+
+<p><label for="password">Password</label><br/>
+<%%= f.password_field :password %></p>
+
+<p><label for="password_confirmation">Confirm Password</label><br/>
+<%%= f.password_field :password_confirmation %></p>
+
+<p><%%= submit_tag 'Sign up' %></p>
+<%% end -%>

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/unit_test.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/unit_test.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/unit_test.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/unit_test.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,58 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class <%= class_name %>Test < Test::Unit::TestCase
+  fixtures :<%= table_name %>
+
+  def test_should_create_<%= file_name %>
+    assert_difference <%= class_name %>, :count do
+      assert create_<%= file_name %>.valid?
+    end
+  end
+
+  def test_should_require_login
+    assert_no_difference <%= class_name %>, :count do
+      u = create_<%= file_name %>(:login => nil)
+      assert u.errors.on(:login)
+    end
+  end
+
+  def test_should_require_password
+    assert_no_difference <%= class_name %>, :count do
+      u = create_<%= file_name %>(:password => nil)
+      assert u.errors.on(:password)
+    end
+  end
+
+  def test_should_require_password_confirmation
+    assert_no_difference <%= class_name %>, :count do
+      u = create_<%= file_name %>(:password_confirmation => nil)
+      assert u.errors.on(:password_confirmation)
+    end
+  end
+
+  def test_should_require_email
+    assert_no_difference <%= class_name %>, :count do
+      u = create_<%= file_name %>(:email => nil)
+      assert u.errors.on(:email)
+    end
+  end
+
+  def test_should_reset_password
+    <%= table_name %>(:quentin).update_attributes(:password => 'new password', :password_confirmation => 'new password')
+    assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin', 'new password')
+  end
+
+  def test_should_not_rehash_password
+    <%= table_name %>(:quentin).update_attributes(:login => 'quentin2')
+    assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin2', 'quentin')
+  end
+
+  def test_should_authenticate_<%= file_name %>
+    assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin', 'quentin')
+  end
+
+  protected
+  def create_<%= file_name %>(options = {})
+    <%= class_name %>.create({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options))
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/USAGE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/USAGE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/USAGE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/USAGE Fri Sep 22 18:37:26 2006
@@ -0,0 +1 @@
+./script/generate authenticated_mailer USERMODEL
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,27 @@
+class AuthenticatedMailerGenerator < Rails::Generator::NamedBase
+  def manifest
+    record do |m|
+      # Check for class naming collisions.
+      m.class_collisions class_path, "#{class_name}Notifier", "#{class_name}NotifierTest", "#{class_name}Observer"
+
+      # Controller, helper, views, and test directories.
+      m.directory File.join('app/models', class_path)
+      m.directory File.join('app/views', class_path, "#{file_name}_notifier")
+      m.directory File.join('test/unit', class_path)
+
+      %w( notifier observer ).each do |model_type|
+        m.template "#{model_type}.rb", File.join('app/models',
+                                             class_path,
+                                             "#{file_name}_#{model_type}.rb")
+      end
+      
+      m.template 'notifier_test.rb', File.join('test/unit', class_path, "#{file_name}_notifier_test.rb")
+
+      # Mailer templates
+      %w( activation signup_notification ).each do |action|
+        m.template "#{action}.rhtml",
+                   File.join('app/views', "#{file_name}_notifier", "#{action}.rhtml")
+      end
+    end
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/activation.rhtml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/activation.rhtml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/activation.rhtml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/activation.rhtml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,3 @@
+<%%= @<%= file_name %>.login %>, your account has been activated.  You may now start adding your plugins:
+
+  <%%= @url %>
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,22 @@
+class <%= class_name %>Notifier < ActionMailer::Base
+  def signup_notification(<%= file_name %>)
+    setup_email(<%= file_name %>)
+    @subject    += 'Please activate your new account'
+    @body[:url]  = "http://YOURSITE/account/activate/#{<%= file_name %>.activation_code}"
+  end
+  
+  def activation(<%= file_name %>)
+    setup_email(<%= file_name %>)
+    @subject    += 'Your account has been activated!'
+    @body[:url]  = "http://YOURSITE/"
+  end
+  
+  protected
+  def setup_email(<%= file_name %>)
+    @recipients  = "#{<%= file_name %>.email}"
+    @from        = "ADMINEMAIL"
+    @subject     = "[YOURSITE] "
+    @sent_on     = Time.now
+    @body[:<%= file_name %>] = <%= file_name %>
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier_test.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier_test.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier_test.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier_test.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require '<%= file_name %>_notifier'
+
+class <%= class_name %>NotifierTest < Test::Unit::TestCase
+  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
+  CHARSET = "utf-8"
+
+  include ActionMailer::Quoting
+
+  def setup
+    ActionMailer::Base.delivery_method = :test
+    ActionMailer::Base.perform_deliveries = true
+    ActionMailer::Base.deliveries = []
+
+    @expected = TMail::Mail.new
+    @expected.set_content_type "text", "plain", { "charset" => CHARSET }
+  end
+
+  private
+    def read_fixture(action)
+      IO.readlines("#{FIXTURES_PATH}/<%= file_name %>_notifier/#{action}")
+    end
+
+    def encode(subject)
+      quoted_printable(subject, CHARSET)
+    end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/observer.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/observer.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/observer.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/observer.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,9 @@
+class <%= class_name %>Observer < ActiveRecord::Observer
+  def after_create(<%= file_name %>)
+    <%= class_name %>Notifier.deliver_signup_notification(<%= file_name %>)
+  end
+
+  def after_save(<%= file_name %>)
+    <%= class_name %>Notifier.deliver_activation(<%= file_name %>) if <%= file_name %>.recently_activated?
+  end
+end
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/signup_notification.rhtml
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/signup_notification.rhtml?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/signup_notification.rhtml (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/signup_notification.rhtml Fri Sep 22 18:37:26 2006
@@ -0,0 +1,8 @@
+Your account has been created.
+
+  Username: <%%= @<%= file_name %>.login %>
+  Password: <%%= @<%= file_name %>.password %>
+
+Visit this url to activate your account:
+
+  <%%= @url %>
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/USAGE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/USAGE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/USAGE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/USAGE Fri Sep 22 18:37:26 2006
@@ -0,0 +1,14 @@
+Description:
+    The authenticated migration generator creates a migration for your authenticated user model.
+
+    The generator takes a migration name as its argument.  The migration name may be
+    given in CamelCase or under_score.  'add_authenticated_table' is the default.
+
+    The generator creates a migration class in db/migrate prefixed by its number
+    in the queue.
+
+Example:
+    ./script/generate authenticated_migration add_authenticated_table
+
+    With 4 existing migrations, this will create an AddAuthenticatedTable migration in the
+    file db/migrate/5_add_authenticated_table.rb
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/authenticated_migration_generator.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/authenticated_migration_generator.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/authenticated_migration_generator.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/authenticated_migration_generator.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,14 @@
+class AuthenticatedMigrationGenerator < Rails::Generator::NamedBase
+  attr_reader :user_table_name
+  def initialize(runtime_args, runtime_options = {})
+    @user_table_name = (runtime_args.length < 2 ? 'users' : runtime_args[1]).tableize
+    runtime_args << 'add_authenticated_table' if runtime_args.empty?
+    super
+  end
+
+  def manifest
+    record do |m|
+      m.migration_template 'migration.rb', 'db/migrate'
+    end
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/templates/migration.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/templates/migration.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/templates/migration.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/generators/authenticated_migration/templates/migration.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,18 @@
+class <%= class_name %> < ActiveRecord::Migration
+  def self.up
+    create_table "<%= user_table_name %>", :force => true do |t|
+      t.column "login",            :string, :limit => 40
+      t.column "email",            :string, :limit => 100
+      t.column "crypted_password", :string, :limit => 40
+      t.column "salt",             :string, :limit => 40
+      t.column "activation_code",  :string, :limit => 40 # only if you want
+      t.column "activated_at",     :datetime             # user activation
+      t.column "created_at",       :datetime
+      t.column "updated_at",       :datetime
+    end
+  end
+
+  def self.down
+    drop_table "<%= user_table_name %>"
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/init.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/init.rb?view=auto&rev=449142
==============================================================================
    (empty)

Propchange: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/init.rb
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/install.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/install.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/install.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/acts_as_authenticated/install.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1 @@
+puts IO.read(File.join(File.dirname(__FILE__), 'README'))
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/CHANGELOG?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/CHANGELOG (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/CHANGELOG Fri Sep 22 18:37:26 2006
@@ -0,0 +1,5 @@
+
+== Jan 12 2005
+
+* Added code to handle single table inheritance. May need to be modified for non-standard use of STI.
+

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/MIT-LICENSE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/MIT-LICENSE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/MIT-LICENSE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/MIT-LICENSE Fri Sep 22 18:37:26 2006
@@ -0,0 +1,20 @@
+Copyright (c) 2005 Geoffrey Grosenbach
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/README
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/README?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/README (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/README Fri Sep 22 18:37:26 2006
@@ -0,0 +1,17 @@
+= ar_fixtures
+
+This library makes it easy to save ActiveRecord objects to reloadable files or fixtures.  ActiveRecord is required.
+
+== Resources
+
+Subversion
+
+* http://topfunky.net/svn/plugins/ar_fixtures
+
+Blog
+
+* http://nubyonrails.com
+
+Author
+
+* Geoffrey Grosenbach boss [at] topfunky [dot] com

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/init.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/init.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/init.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/init.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1 @@
+require 'ar_fixtures'
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,68 @@
+# Extension to make it easy to read and write data to a file.
+class ActiveRecord::Base
+  
+  # Delete existing data and load fresh from file 
+  def self.load_from_file(path=nil)
+    path ||= "db/#{table_name}.yml"
+
+    self.find_all.each { |old_record| old_record.destroy }
+
+    if connection.respond_to?(:reset_pk_sequence!)
+     connection.reset_pk_sequence!(table_name)
+    end
+
+    records = YAML::load( File.open( File.expand_path(path, RAILS_ROOT) ) )
+    records.each do |record|
+      record_copy = self.new(record.attributes)
+      record_copy.id = record.id
+
+      # For Single Table Inheritance
+      klass_col = record.class.inheritance_column.to_sym
+      if record[klass_col]
+         record_copy.type = record[klass_col]
+      end
+      
+      record_copy.save
+    end
+ 
+    if connection.respond_to?(:reset_pk_sequence!)
+     connection.reset_pk_sequence!(table_name)
+    end
+  end
+
+  # Writes to db/table_name.yml, or the specified file
+  def self.dump_to_file(path=nil)
+    path ||= "db/#{table_name}.yml"
+    write_file(File.expand_path(path, RAILS_ROOT), self.find(:all).to_yaml)
+  end
+
+  # Write a file that can be loaded with fixture :some_table in tests.
+  def self.to_fixture
+    write_file(File.expand_path("test/fixtures/#{table_name}.yml", RAILS_ROOT), 
+        self.find(:all).inject({}) { |hsh, record| 
+            hsh.merge("#{table_name.singularize}_#{record.id}" => record.attributes) 
+          }.to_yaml)
+    habtm_to_fixture
+  end
+
+  # Write the habtm association table
+  def self.habtm_to_fixture
+    joins = self.reflect_on_all_associations.select { |j|
+      j.macro == :has_and_belongs_to_many
+    }
+    joins.each do |join|
+      hsh = {}
+      connection.select_all("SELECT * FROM #{join.options[:join_table]}").each_with_index { |record, i|
+        hsh["join_#{i}"] = record
+      }
+      write_file(File.expand_path("test/fixtures/#{join.options[:join_table]}.yml", RAILS_ROOT), hsh.to_yaml)
+    end
+  end
+
+  def self.write_file(path, content)
+    f = File.new(path, "w+")
+    f.puts content
+    f.close
+  end
+
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake Fri Sep 22 18:37:26 2006
@@ -0,0 +1,9 @@
+
+desc "Dump current data to file. Use TABLE=ModelName"
+task :dump_table_to_file => :environment do
+  if ENV['TABLE'].blank?
+    raise "No TABLE value given. Set TABLE=ModelName"
+  else
+    eval "#{ENV['TABLE']}.dump_to_file"
+  end
+end

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/init.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/init.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/init.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/init.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1 @@
+require 'auto_escape.rb'
\ No newline at end of file

Propchange: incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/init.rb
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/lib/auto_escape.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/lib/auto_escape.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/lib/auto_escape.rb (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/lib/auto_escape.rb Fri Sep 22 18:37:26 2006
@@ -0,0 +1,77 @@
+require 'cgi'
+require 'set'
+
+#
+# This module extends ActiveRecord to support automatic escaping of text columns from
+# the database.
+#
+# Note: to use this correctly, you will probably want to remove all the 'h' method calls from your
+# ERb templates, or you will end up escaping text twice.  
+# You can leave them there if you are the 'belt AND suspenders' type, it won't hurt anything but performance.
+#
+# some things may start to behave differently when this is installed.  In particular, form fields will be populated with
+# the escaped text by default.  This may not be desired behavior.  If this is the case, you can modify your
+# action to assign the 'attribute_raw' to the appropriate instance variable and it will work as expected.
+# The side benefit of this is that it will be obvious from your code that that particular value contains raw text.
+#
+# If you define a database column called 'attribute_raw', it will be ignored and not processed any further.
+# As a rule, the automatically defined '_raw' attributes will not be saved in the database, nor will it's contents
+# affect the escaped attribute unless it is deliberately saved over to the attribute column.
+module ActiveRecord
+	class Base
+		# class variable to save which attributes to filter
+    @@attribute_filters= Set.new
+    # class variable to save which attributes are ignored
+		@@exclude_filters = Set.new
+		
+    # This method allows specific attributes to be excluded from the automatic escaping process
+    # use this if you know that a particular column will never need to be escaped.
+    #
+    # class model < ActiveRecord::Base
+    #   acts_as_raw :column1, :column2
+    # end
+    #
+		def self.acts_as_raw(*user_options)
+			if user_options.kind_of? Array
+        user_options.map! {|key| "#{self.object_id}_#{key.to_s}"}
+				@@exclude_filters = @@exclude_filters + Set.new(user_options)
+      else
+				raise "Incorrect Parameters.  Use an array of symbols"
+			end
+		end
+
+    # The auto_escape plugin works by defining an 'after_find' callback from ActiveRecord
+    # this callback fires once whenever a record is 'found' and loaded from the database
+    # The after_find callback cycles through the internal list of model attributes looking for 
+    # any whose database column is a 'text' type, and which has not been excluded by ActiveRecord::Base#acts_as_raw.
+    # Once it finds one, it escapes the text (using CGI#escapeHTML) , and saves the unescaped attribute as 
+    # '#{attribute}_raw'
+    # 
+    # Note: defining an after_filter in your model without calling 'super' will bypass this feature entirely
+    #
+    # Performance for this method could be improved by caching the attributes to be filtered.  Right now it 
+    # reconstructs the list for each object, every time it is called
+		def after_find
+      # find all model attributes
+			@@attribute_filters = Set.new(attributes.keys)
+      # delete those that don't belong to a 'text' column
+			@@attribute_filters = @@attribute_filters.delete_if {|item| column_for_attribute(item) ? !column_for_attribute(item).text? : true}
+      # delete if column name contains '_raw'
+      @@attribute_filters.reject! {|item| item =~ /_raw/ }
+      # give each remaining attribute a unique id so that the exclusion applies only to the correct class and not all subclasses of AR::Base 
+			@@attribute_filters.map! {|key| "#{self.class.object_id}_#{key}"}
+			@@attribute_filters = @@attribute_filters - @@exclude_filters
+			# process the remaining attributes
+      @@attribute_filters.each do |key| 
+        key =~ /\w+_(\w+)/
+				atr = $1
+				#define a new attribute with the unescaped version
+				self["#{atr}_raw"]=self[atr]
+        #escape the text
+				self[atr]=CGI.escapeHTML(self[atr]) 
+			end
+		end 
+		 
+	end
+end
+

Propchange: incubator/heraldry/idp/pip/trunk/vendor/plugins/auto_escape_html/lib/auto_escape.rb
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/CHANGELOG?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/CHANGELOG (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/CHANGELOG Fri Sep 22 18:37:26 2006
@@ -0,0 +1,137 @@
+*SVN*
+
+
+-----
+1.1.4
+
+Fixed creation of multipart emails (Ticket #190)
+Added a temporary fix to the code-mixing issue. In your engine's test/test_helper.rb, please add the following lines:
+
+  # Ensure that the code mixing and view loading from the application is disabled
+  Engines.disable_app_views_loading = true
+  Engines.disable_app_code_mixing = true
+
+is will prevent code mixing for controllers and helpers, and loading views from the application. One thing to remember is to load any controllers/helpers using 'require_or_load' in your tests, to ensure that the engine behaviour is respected (Ticket #135)
+Added tasks to easily test engines individually (Ticket #120)
+Fixture extensions will now fail with an exception if the corresponding class cannot be loaded (Ticket #138)
+Patch for new routing/controller loading in Rails 1.1.6. The routing code is now replaced with the contents of config.controller_paths, along with controller paths from any started engines (Ticket #196)
+Rails' Configuration instance is now stored, and available from all engines and plugins.
+
+
+-----
+1.1.3
+
+Fixed README to show 'models' rather than 'model' class (Ticket #167)
+Fixed dependency loading to work with Rails 1.1.4 (Ticket #180)
+
+
+-----
+1.1.2
+
+Added better fix to version checking (Ticket #130, jdell@gbdev.com).
+Fixed generated init_engine.rb so that VERSION module doesn't cause probems (Ticket #131, japgolly@gmail.com)
+Fixed error with Rails 1.0 when trying to ignore the engine_schema_info table (Ticket #132, snowblink@gmail.com)
+Re-added old style rake tasks (Ticket #133)
+No longer adding all subdirectories of <engine>/app or <engine>/lib, as this can cause issues when files are grouped in modules (Ticket #149, kasatani@gmail.com)
+Fixed engine precidence ordering for Rails 1.1 (Ticket #146)
+Added new Engines.each method to assist in processing the engines in the desired order (Ticket #146)
+Fixed annoying error message at appears when starting the console in development mode (Ticket #134)
+Engines is now super-careful about loading the correct version of Rails from vendor (Ticket #154)
+
+
+-----
+1.1.1
+
+Fixed migration rake task failing when given a specific version (Ticket #115)
+Added new rake task "test:engines" which will test engines (and other plugins) but ensure that the test database is cloned from development beforehand (Ticket #125)
+Fixed issue where 'engine_schema_info' table was included in schema dumps (Ticket #87)
+Fixed multi-part emails (Ticket #121)
+Added an 'install.rb' file to new engines created by the bundled generator, which installs the engines plugin automatically if it doesn't already exist (Ticket #122)
+Added a default VERSION module to generated engines (Ticket #123)
+Refactored copying of engine's public files to a method of an Engine instance. You can now call Engines.get(:engine_name).copy_public_files (Ticket #108)
+Changed engine generator templates from .rb files to .erb files (Ticket #106)
+Fixed the test_helper.erb file to use the correct testing extensions and not load any schema - the schema will be cloned automatically via rake test:engines
+Fixed problem when running with Rails 1.1.1 where version wasn't determined correctly (Ticket #129)
+Fixed bug preventing engines from loading when both Rails 1.1.0 and 1.1.1 gems are installed and in use.
+Updated version (d'oh!)
+
+
+-----
+1.1.0
+
+Improved regexp matching for Rails 1.0 engines with peculiar paths
+Engine instance objects can be accessed via Engines[:name], an alias for Engines.get(:name) (Ticket #99)
+init_engine.rb is now processed as the final step in the Engine.start process, so it can access files within the lib directory, which is now in the $LOAD_PATH at that point. (Ticket #99)
+Clarified MIT license (Ticket #98)
+Updated Rake tasks to integrate smoothly with Rails 1.1 namespaces
+Changed the version to "1.1.0 (svn)"
+Added more information about using the plugin with Edge Rails to the README
+moved extensions into lib/engines/ directory to enable use of Engines module in extension code.
+Added conditional require_or_load method which attempts to detect the current Rails version. To use the Edge Rails version of the loading mechanism, add the line:
+  Engines.config :edge, true
+to your environment.rb file.
+Merged changes from /branches/edge and /branches/rb_1.0 into /trunk
+engine_schema_info now respects the prefix/suffixes set for ActiveRecord::Base (Ticket #67)
+added ActiveRecord::Base.wrapped_table_name(name) method to assist in determining the correct table name
+
+
+-----
+1.0.6
+
+Added ability to determine version information for engines: rake engine_info
+Added a custom logger for the Engines module, to stop pollution of the Rails logs.
+Added some more tests (in particular, see rails_engines/applications/engines_test).
+Another attempt at solving Ticket #53 - controllers and helpers should now be loadable from modules, and if a full path (including RAILS_ROOT/ENGINES_ROOT) is given, it should be safely stripped from the require filename such that corresponding files can be located in any active engines. In other words, controller/helper overloading should now completely work, even if the controllers/helpers are in modules.
+Added (finally) patch from Ticket #22 - ActionMailer helpers should now load
+Removed support for Engines.start :engine, :engine_name => 'whatever'. It was pointless.
+Fixed engine name referencing; engine_stylesheet/engine_javascript can now happily use shorthand engine names (i.e. :test == :test_engine) (Ticket #45)
+Fixed minor documentation error ('Engine.start' ==> 'Engines.start') (Ticket #57)
+Fixed double inclusion of RAILS_ROOT in engine_migrate rake task (Ticket #61)
+Added ability to force config values even if given as a hash (Ticket #62)
+
+
+-----
+1.0.5
+
+Fixed bug stopping fixtures from loading with PostgreSQL
+
+
+-----
+1.0.4
+
+Another attempt at loading controllers within modules (Ticket #56)
+
+
+-----
+1.0.3
+
+Fixed serious dependency bug stopping controllers being loaded (Ticket #56)
+
+
+-----
+1.0.2
+
+Fixed bug with overloading controllers in modules from /app directory
+Fixed exception thrown when public files couldn't be created; exception is now logged (Ticket #52)
+Fixed problem with generated test_helper.rb file via File.expand_path (Ticket #50)
+
+
+-----
+1.0.1
+
+Added engine generator for creation of new engines
+Fixed 'Engine' typo in README
+Fixed bug in fixtures extensions
+Fixed /lib path management bug
+Added method to determine public directory location from Engine object
+Fixed bug in the error message in get_engine_dir()
+Added proper component loading
+Added preliminary tests for the config() methods module
+
+
+-----
+pre-v170
+
+Fixed copyright notices to point to DHH, rather than me.
+Moved extension require statements into lib/engines.rb, so the will be loaded if another module/file calls require 'engines
+Added a CHANGELOG file (this file)

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/MIT-LICENSE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/MIT-LICENSE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/MIT-LICENSE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/MIT-LICENSE Fri Sep 22 18:37:26 2006
@@ -0,0 +1,21 @@
+Copyright (c) 2006 James Adam
+
+The MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/README
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/README?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/README (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/README Fri Sep 22 18:37:26 2006
@@ -0,0 +1,414 @@
+= Welcome
+
+This document gives an overview of how the Engines mechanism works within a Rails environment. In most cases the code below is just an example. For more information or documentation, please go to http://rails-engines.org.
+
+== Background
+
+Rails Engines are a way of dropping in whole chunks of functionality into your
+existing application without affecting *any* of your existing code. The could also be described as mini-applications, or vertical application slices - top-to-bottom units which provide full MVC coverage for a certain, specific application function.
+
+As an example, the Login Engine provides a full user login subsystem, including: 
+* controllers to manage user accounts; 
+* helpers for you to interact with account information from other 
+  parts of your application; 
+* the model objects and schemas to create the required tables; 
+* stylesheets and javascript files to enhance the views; 
+* and any other library files required.
+
+Once the Rails Core team decides on a suitable method for packaging plugins, Engines can be distributed using the same mechanisms. If you are developing engines yourself for use across multiple projects, linking them as svn externals allows seamless updating of bugfixes across multiple applications.
+
+
+
+
+
+= Edge Engines
+
+If you are using Edge Rails (an SVN copy of Rails, rather than an 'official' release), there are several MASSIVELY IMPORTANT issues that you need to bear in mind.
+
+Firstly, you are using an unstable version of Rails, so it is possible that things will break. We work hard to keep the Engines plugin up to speed with the changes in Rails at the bleeding edge, but sometimes significant parts of Rails change it WILL cause problems. This is the price of using the bleeding edge. Since edge is synonymous for unstable, the version of the Engines plugin which is compatible with Edge Rails is kept separate from the official release. Please ensure that you have used SVN to get your engines plugin from
+
+  http://svn.rails-engines.org/engines/trunk
+  
+The normal 'script/plugin install engines' will NOT get you this version.
+
+Secondly, you NEED to tell the engines plugin if you expect it to perform with Edge behaviour. This is done by adding the following lines at the *very top* of environment.rb (yes, the VERY TOP)
+
+  module Engines
+    CONFIG = {:edge => true}
+  end
+
+This will set the plugin to work with Edge Rails, rather than expecting an official release.
+
+If you are having problems, please try and contribute a bug report if you can so we can improve the plugin and keep up to speed with Rails' bleeding edge. Your input is *absolutely crucial* to this. If you're not comfortable with tracking down bugs in Rails' and Engines' internal code, there is a test application available at
+
+  http://svn.rails-engines.org/applications/engines_test
+  
+which contains an array of tests that might help you (and us) pinpoint where the issue is. Please download this application and consult the README for more information.
+
+Finally, please don't forget about our website and mailing lists. More information here:
+
+  http://rails-engines.org
+
+
+
+
+
+
+
+= Using the Engines plugin itself
+
+There are a number of features of the Engines plugin itself which may be useful to know:
+
+
+=== Engines.log
+The Engines plugin comes with its own logger, which is invaluable when debugging. To use it,
+simply call
+
+  Engines.create_logger
+  
+Two optional arguments may be passed to this method:
+
+  Engines.create_logger(<io>)
+  
+Would set the outputter to the logger to the given IO object <io>. For example, this could be STDERR or STDOUT (the default). The second argument is the logger level:
+
+  Engines.create_logger(STDOUT, Logger::INFO)
+  
+The logger can be accessed using either of the following:
+
+  Engines.log.[debug|info|whatever] "message"
+  Engines.logger.[debug|info|whatever] "message"
+  
+... essentially it's a Logger object. It's worth noting that if you *don't* create a logger, calls to Engines.log will just be swallowed without a sound, making it very very easy to completely silence Engine logging.
+
+
+=== Engines.config(:root)
+
+By default, the Engines plugin expects to be starting Engines from within RAILS_ROOT/vendor/plugins. However, if you'd like to store your engines in a different directory, add the following line *before* any call to Engines.start
+
+  Engines.config(:root, "/path/to/your/directory", :force)
+  
+  
+=== Rake Tasks
+
+The engines plugin comes with a number of handy rake tasks:
+
+  # display version information about the engines subsystem
+  rake engines:info 
+  
+  # migrate engines' database schemas in a controlled way
+  rake db:migrate:engines
+  
+  # generates full documentation for all engines
+  rake doc:engines      
+  
+There are more, but you'll have to discover them yourself...  
+
+
+== More information
+
+For more information about what you can do with the Engines plugin, you'll need to generate the documentation (rake plugindoc), or go to http://rails-engines.org. Good luck!  
+
+
+
+
+
+
+
+
+= Quickstart
+
+=== Gentlemen, Start your Engines!
+
+
+Here's an *example* of how you might go about using Rails Engines. Please bear in mind that actual Engines may differ from this, but these are the steps you will *typically* have to take. Refer to individual Engine documentation for specific installation instructions. Anyway, on with the show:
+
+1. Install the Rails Engines plugin into your plugins directory. You'll probably need to accept the SSL certificate here for the OpenSVN servers. For example:
+
+    $ script/plugin install engines
+
+ or
+
+    $ svn co http://svn.rails-engines.org/plugins/engines <MY_RAILS_APP>/vendor/plugins/engines
+
+2. Install your engine into the plugins directory in a similar way.
+
+3. Create the RDoc for the engines plugin and for your engines so you know what's going on:
+
+     $ rake doc:plugins
+     $ rake doc:engines
+
+4. Initialize any database schema provided. The Engine may provide Rake tasks to do this for you. Beware that accepting an Engine schema might affect any existing database tables you have installed! You are STRONGLY recommended to inspect the <tt>db/schema.rb</tt> file to see exactly what running it might change.
+
+5. Add configuration to <tt>environment.rb</tt>:
+   e.g.
+
+      # Add your application configuration here
+      module MyEngine
+        config :top_speed, "MegaTurboFast"
+      end
+ 
+      Engines.start :my_engine
+
+6. Run your server!
+
+      $ script/server
+
+
+
+
+= Building an Engine
+
+Here's a sample rails application with a detailed listing of an example engines as a concrete example:
+
+  RAILS_ROOT
+    |- app
+    |- lib
+    |- config
+    |- <... other directories ...>
+    |- vendor
+        |-plugins
+            |- engines               <-- the engines plugin
+            |- some_other_plugin 
+            |- my_engine             <-- our example engine
+                  |- init_engine.rb
+                  |- app
+                  |     |- controllers
+                  |     |- models
+                  |     |- helpers
+                  |     |- views
+                  |- db
+                  |- tasks
+                  |- lib
+                  |- public
+                  |     |- javascripts
+                  |     |- stylesheets
+                  |- test
+
+
+The internal structure of an engine mirrors the familiar core of a Rails application, with most of the engine within the <tt>app</tt> subdirectory. Within <tt>app</tt>, the controllers, views and model objects behave just as you might expect if there in the top-level <tt>app</tt> directory.
+
+When you call <tt>Engines.start :my_engine</tt> in <tt>environment.rb</tt> a few important bits of black magic voodoo happen:
+* the engine's controllers, views and models are mixed in to your running Rails application; 
+* files in the <tt>lib</tt> directory of your engine (and subdirectories) are made available 
+  to the rest of your system
+* any directory structure in the folder <tt>public/</tt> within your engine is made available to the webserver
+* the file <tt>init_engine.rb</tt> is loaded from within the engine - just like a plugin. The reason why engines need an init_engine.rb rather than an init.rb is because Rails' default plugin system might try and load an engine before the Engines plugin has been loaded, resulting in all manner of badness. Instead, Rails' skips over any engine plugins, and the Engines plugin handles initializing your Engines plugins when you 'start' each engine.
+
+From within <tt>init_engine.rb</tt> you should load any libraries from your <tt>lib</tt> directory that your engine might need to function. You can also perform any configuration required.
+
+=== Loading all Engines
+
+Calling either Engines.start (with no arguments) or Engines.start_all will load all engines available. Please note that your plugin can only be *automatically* detected as an engine by the presence of an 'init_engine.rb' file, or if the engine is in a directory named <something>_engine, or <something>_bundle. If neither of these conditions hold, then your engine will not be loaded by Engines.start() (with no arguments) or Engines.start_all().
+
+
+
+
+
+
+
+= Configuring Engines
+
+Often your engine will require a number of configuration parameters set, some of which should be alterable by the user to reflect their particular needs. For example, a Login System might need a unique Salt value set to encrypt user passwords. This value should be unique to each application.
+
+Engines provides a simple mechanism to handle this, and it's already been hinted at above. Within any module, a new method is now available: <tt>config</tt>. This method creates a special <tt>CONFIG</tt> Hash object within the Module it is called, and can be used to store your parameters. For a user to set these parameters, they should reopen the module (before the corresponding Engines.start call), as follows:
+
+  module MyModule
+    config :some_option, "really_important_value"
+  end
+  Engines.start :my_engine
+
+Because this config value has been set before the Engine is started, subsequent attempts to set this config value will be ignored and the user-specified value used instead. Of course, there are situations where you *really* want to set the config value, even if it already exists. In such cases the config call can be changed to:
+
+  config :some_option, "no_THIS_really_important_value", :force
+
+The additional parameter will force the new value to be used. For more information, see Module#config.
+
+
+
+
+= Tweaking Engines
+
+One of the best things about Engines is that if you don't like the default behaviour of any component, you can override it without needing to overhaul the whole engine. This makes adding your customisations to engines almost painless, and allows for upgrading/updating engine code without affecting the specialisations you need for your particular application.
+
+
+=== View Tweaks
+These are the simplest - just drop your customised view (or partial) into you <tt>/app/views</tt> directory in the corresponding location for the engine, and your view will be used in preference to the engine view. For example, if we have a ItemController with an action 'show', it will (normally) expect to find its view as <tt>report/show.rhtml</tt> in the <tt>views</tt> directory. The view is found in the engine at <tt>/vendor/engines/my_engine/app/views/report/show.rhtml</tt>. However, if you create the file <tt>/app/views/report/show.rhtml</tt>, that file will be used instead! The same goes for partials.
+
+
+=== Controller Tweaks
+You can override controller behaviour by replacing individual controller methods with your custom behaviour. Lets say that our ItemController's 'show' method isn't up to scratch, but the rest of it behaves just fine. To override the single method, create <tt>/app/controllers/item_controller.rb</tt>, just as if it were going to be a new controller in a regular Rails application. then, implement your show method as you would like it to happen.
+
+... and that's it. Your custom code will be mixed in to the engine controller, replacing its old method with your custom code.
+
+
+=== Model/Lib Tweaks
+Alas, tweaking model objects isn't quite so easy (yet). If you need to change the behaviour of model objects, you'll need to copy the model file from the engine into <tt>/app/models</tt> and edit the methods yourself. Library code can be overridden in a similar way.
+
+
+
+
+
+
+
+
+
+= Public Files
+
+If the Engine includes a <tt>public</tt> directory, its contents will be mirrored into <tt>RAILS_ROOT/public/engine_files/&lt;engine_name&gt;/</tt> so that these files can be served by your webserver to browsers and users over the internet.
+
+Engines also provides two convenience methods for loading stylesheets and javascript files in your layouts: <tt>engine_stylesheet</tt> and <tt>engine_javascript</tt>.
+
+=== Engine Stylesheets
+
+  <%= engine_stylesheet "my_engine" %>
+
+will include <tt>RAILS_ROOT/public/&lt;engine_files&gt;/my_engine/stylesheets/my_engine.css</tt> in your layout. If you have more than one stylesheet, you can include them in the same call:
+
+  <%= engine_stylesheet "my_engine", "stylesheet_2", "another_one" %>
+
+will give you:
+
+    <link href="/engine_files/my_engine/stylesheets/my_engine.css" media="screen" rel="Stylesheet" type="text/css" />
+    <link href="/engine_files/my_engine/stylesheets/stylesheet_2.css" media="screen" rel="Stylesheet" type="text/css" />
+    <link href="/engine_files/my_engine/stylesheets/another_one.css" media="screen" rel="Stylesheet" type="text/css" />
+
+in your rendered layout.
+
+=== Engine Javascripts
+
+The <tt>engine_javascript</tt> command works in exactly the same way as above.
+
+
+
+
+
+
+
+
+
+= Databases and Engines
+
+Engine schema information can be handled using similar mechanisms to your normal application schemas.
+
+== CAVEAT EMPTOR!
+
+I.E. Big Huge Warning In Flashing Lights.
+
+PLEASE, PLEASE, PLEASE bear in mind that if you are letting someone
+ELSE have a say in what tables you are using, you're basically opening
+your application schema open to potential HAVOC. I cannot stress how
+serious this is. It is YOUR responsibility to ensure that you trust
+the schema and migration information, and that it's not going to drop
+your whole database. You need to inspect these things. YOU do. If you
+run these voodoo commands and your database essplodes because you
+didn't double double double check what was going on, your embarassment
+will be infinite. And your project will be skroo'd if the migration
+is irreversible.
+
+That said, if you are working in a team and you all trust each other,
+which is hopefully true, this can be quite useful.
+
+
+== Migrating Engines
+
+To migrate all engines to the latest version:
+
+ rake db:migrate:engines
+
+To migrate a single engine, for example the login engine:
+
+ rake db:migrate:engines ENGINE=login  (or login_engine)
+
+To migrate a single engine to a specific revision:
+
+ rake db:migrate:engines ENGINE=login VERSION=4
+
+This:
+
+ rake db:migrate:engines VERSION=1
+
+... will not work, because we felt it was too dangerous to allow ALL
+engines to be migrated to a specific version, since such versions
+might be incompatible.
+
+
+
+
+
+
+
+= Testing Engines
+
+The Engines plugin comes with mechanisms to help test Engines within a developer's own application. The testing extensions enable developers to load fixtures into specific
+tables irrespective of the name of the fixtures file. This work is heavily based on
+patches made by Duane Johnson (canadaduane), viewable at
+http://dev.rubyonrails.org/ticket/1911
+
+Engine developers should supply fixture files in the <engine>/test/fixtures directory
+as normal. Within their tests, they should load the fixtures using the 'fixture' command
+(rather than the normal 'fixtures' command). For example:
+
+  class UserTest < Test::Unit::TestCase
+    fixture :users, :table_name => LoginEngine.config(:user_table), :class_name => "User"
+ 
+    ...
+
+This will ensure that the fixtures/users.yml file will get loaded into the correct
+table, and will use the correct model object class.
+
+Your engine should provide a test_helper.rb file in <engine>/test, the contents of which should include the following:
+
+  # Load the default rails test helper - this will load the environment.
+	require File.dirname(__FILE__) + '/../../../../test/test_helper'
+
+	# ensure that the Engines testing enhancements are loaded and will override Rails own
+	# code where needed. This line is very important!
+	require File.join(Engines.config(:root), "engines", "lib", "testing_extensions")
+
+	# Load the schema - if migrations have been performed, this will be up to date.
+	load(File.dirname(__FILE__) + "/../db/schema.rb")
+
+	# set up the fixtures location to use your engine's fixtures
+	Test::Unit::TestCase.fixture_path = File.dirname(__FILE__)  + "/fixtures/"
+	$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
+
+== Loading Fixtures
+
+An additional helpful task for loading fixture data is also provided (thanks to Joe Van Dyk):
+
+  rake db:fixtures:engines:load
+  rake db:fixtures:engines:load PLUGIN=login_engine
+  
+will load the engine fixture data into your development database.
+
+=== Important Caveat
+Unlike the new 'fixture' directive described above, this task currently relies on you ensuring that the table name to load fixtures into is the same as the name of the fixtures file you are trying to load. If you are using defaults, this should be fine. If you have changed table names, you will need to rename your fixtures files (and possibly update your tests to reflect this too).
+
+You should also note that fixtures typically tend to depend on test configuration information (such as test salt values), so not all data will be usable in fixture form.
+
+
+
+= LICENCE
+
+Copyright (c) 2006, James Adam
+
+The MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/generators/engine/USAGE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/generators/engine/USAGE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/generators/engine/USAGE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/engines/generators/engine/USAGE Fri Sep 22 18:37:26 2006
@@ -0,0 +1,26 @@
+Description:
+  The Engine Generator creates the directories and files you need
+  to create your own engine.
+
+Example:
+  ./script/generate engine MyEngine
+
+  This will generate:
+  RAILS_ROOT
+    |- vendor
+        |-plugins
+            |- my_engine             <-- our example engine
+                  |- init_engine.rb
+                  |- app
+                  |     |- controllers
+                  |     |- model
+                  |     |- helpers
+                  |     |- views
+                  |- db
+                  |- tasks
+                  |- lib
+                  |- public
+                  |     |- javascripts
+                  |     |- stylesheets
+                  |- test
+



Mime
View raw message