You are viewing a plain text version of this content. The canonical link for it is here.
Posted to alois-commits@incubator.apache.org by fl...@apache.org on 2010/11/04 18:27:42 UTC

svn commit: r1031127 [21/22] - in /incubator/alois/trunk: ./ bin/ debian/ doc/ etc/ etc/alois/ etc/alois/apache2/ etc/alois/environments/ etc/alois/prisma/ etc/cron.d/ etc/default/ etc/logrotate.d/ prisma/ prisma/bin/ prisma/conf/ prisma/conf/prisma/ p...

Added: incubator/alois/trunk/rails/test/unit/mail_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/mail_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/mail_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/mail_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,64 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ChartTest < ActiveSupport::TestCase
+
+  def test_testing_mode
+    assert 0, BaseMailer.not_delivered_mails_count
+
+    err = assert_raise RuntimeError do
+      BaseMailer.send_email(:text,"testing@logintas.ch","Test Email","none")
+    end
+    assert err.message =~ /No email expected..*/
+
+    BaseMailer.expecting_mail
+    assert 1, BaseMailer.not_delivered_mails_count
+    BaseMailer.send_email(:text,"testing@logintas.ch","Test Email","none")
+    assert 0, BaseMailer.not_delivered_mails_count
+
+    err = assert_raise RuntimeError do
+      BaseMailer.send_email(:text,"testing@logintas.ch","Test Email","none")
+    end
+    assert err.message =~ /No email expected..*/
+    
+    assert 1,BaseMailer.deliveries.length
+  end
+
+  def test_exception_mail
+    BaseMailer.expecting_mail
+    begin
+      raise "Testingexception"
+    rescue
+      BaseMailer.send_exception($!)
+    end
+    assert_equal 0, BaseMailer.not_delivered_mails_count
+    assert_equal "#{$installation_name} - Exception Alert", BaseMailer.latest_mail.subject
+    assert BaseMailer.latest_mail.to_s =~ /mail_test.rb/
+    assert BaseMailer.latest_mail.to_s =~ /Testingexception/
+
+    BaseMailer.expecting_mail
+    begin
+      throw "Testingexception"
+    rescue
+      BaseMailer.send_exception($!)
+    end
+    assert_equal 0, BaseMailer.not_delivered_mails_count
+    assert_equal "#{$installation_name} - Exception Alert", BaseMailer.latest_mail.subject
+    assert BaseMailer.latest_mail.to_s =~ /mail_test.rb/
+    assert BaseMailer.latest_mail.to_s =~ /Testingexception/
+  end
+
+end

Added: incubator/alois/trunk/rails/test/unit/mysql_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/mysql_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/mysql_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/mysql_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,39 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class MysqlTest < ActiveSupport::TestCase
+
+  def test_kill_queries
+    # not yet working
+    return
+    long_query = "SELECT * FROM alarms"
+    5.times {|i| 
+          long_query += " CROSS JOIN alarms AS a#{i}"
+    }
+    # prevent caching
+    long_query = " WHERE alarms.id != NOW()"
+    timeout_reached = false
+    begin
+      Timeout::timeout(1) {
+	ActiveRecord::Base.connection.execute(long_query)
+      }
+    rescue Timeout::Error
+      timeout_reached = true
+    end
+    assert timeout_reached, "Timeout not reached"
+  end
+
+end

Added: incubator/alois/trunk/rails/test/unit/report_mailer_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/report_mailer_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/report_mailer_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/report_mailer_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,62 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+require 'report_mailer'
+
+class ReportMailerTest < ActionMailer::TestCase
+  # because some create view statements will appear
+  self.use_transactional_fixtures = false
+
+  fixtures :reports,:report_templates,
+    :charts_report_templates, :report_templates_tables, :tables, :charts
+  # using howto on:
+  # http://manuals.rubyonrails.com/read/chapter/64
+
+  def test_simple
+    @report = Report.find(1)
+    
+    # do not add csv cause the chart data is not available
+    # testing these functions in functional/report_test
+    response = ReportMailer.create_simple(["test@logintas.com","test2@logintas.com"],@report, {:add_csv => false})
+    check_links_in_email(response)
+    save_email(response,"report_simple")
+    assert_match /Report Report One$/, response.subject
+    
+    body = email_body(response)
+    # plaintextlink
+    assert_match /Link: https:\/\/localhost:3001\/alois\/reports\/show\/1/, body
+    assert_match /<a href=\"https:\/\/localhost:3001\/alois\/reports\/show\/\d+\" style=\"[^\"]*\">Report \#\d+<\/a>/, body
+  end
+  
+  def test_normal
+    #    @report = Report.find(1)
+    @report = Report.generate(ReportTemplate.find(1),"test",:datasource => View.find(1))
+    response = ReportMailer.create_normal(["test@logintas.com","test2@logintas.com"],@report)
+    check_links_in_email(response)
+    save_email(response,"report_normal")
+
+    assert_match /Report DateTest for For always generating records$/, response.subject
+
+    body = email_body(response)
+
+    # plaintextlink
+
+    assert_match /Link: https:\/\/localhost:3001\/alois\/reports\/show\/\d+/, body
+    # htmllink
+    assert_match /<a href=\"https:\/\/localhost:3001\/alois\/reports\/show\/\d+\" style=\"[^\"]*\">Report \#\d+<\/a>/, body
+
+  end
+
+end

Added: incubator/alois/trunk/rails/test/unit/report_template_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/report_template_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/report_template_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/report_template_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,24 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ReportTemplateTest < ActiveSupport::TestCase
+  fixtures :report_templates, :reports, :views, :filters
+
+  # Replace this with your real tests.
+  def test_reptort_template_valid
+    assert ReportTemplate.find(1).valid?
+  end
+end

Added: incubator/alois/trunk/rails/test/unit/report_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/report_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/report_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/report_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,24 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ReportTest < ActiveSupport::TestCase
+  fixtures :reports
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end

Added: incubator/alois/trunk/rails/test/unit/sentinels_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/sentinels_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/sentinels_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/sentinels_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,50 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class SentinelsTest < ActiveSupport::TestCase
+  fixtures :sentinels, :application_logs, :filters
+
+  # Replace this with your real tests.
+  def test_count
+    s = Sentinel.find(2)
+    # default is yesterday
+    assert_equal 0, s.count
+    s.time_range = "2010-09-01"
+    assert_equal 0, s.count
+    s.time_range = nil
+    assert_equal 9, s.count
+    s.time_range = "2010-10-01"
+    assert_equal 2, s.count
+
+    s.filters = "2"
+    assert_equal 0, s.count
+
+    # filter with datum 2007-05-01
+    s.filters = "3"
+    assert_equal 0, s.count
+
+    s.filters = "2,3"
+    assert_equal 0, s.count
+
+    s.filters = ""
+    assert_equal 2, s.count
+
+    s.filters = nil
+    assert_equal 2, s.count
+    
+  end
+
+end

Added: incubator/alois/trunk/rails/test/unit/squid_meta_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/squid_meta_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/squid_meta_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/squid_meta_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,22 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class SquidMetaTest < ActiveSupport::TestCase
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end

Added: incubator/alois/trunk/rails/test/unit/table_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/table_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/table_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/table_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,24 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TableTest < ActiveSupport::TestCase
+  fixtures :tables
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end

Added: incubator/alois/trunk/rails/test/unit/view_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/test/unit/view_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails/test/unit/view_test.rb (added)
+++ incubator/alois/trunk/rails/test/unit/view_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,85 @@
+# Copyright 2010 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ViewTest < ActiveSupport::TestCase
+  
+  def test_insert_condition
+    condition = "abc = 'xyz'"
+    tests = {
+      "SELECT * FROM xyz WHERE id = 1" => "SELECT * FROM xyz WHERE #{condition} AND id = 1",
+      "SELECT * FROM xyz WHERE id = 1 HAVING id = 1" => "SELECT * FROM xyz WHERE #{condition} AND id = 1 HAVING id = 1",
+      "SELECT * FROM xyz WHERE id = 1 GROUP BY a" => "SELECT * FROM xyz WHERE #{condition} AND id = 1 GROUP BY a",
+      "SELECT * FROM xyz WHERE id = 1 ORDER BY a" => "SELECT * FROM xyz WHERE #{condition} AND id = 1 ORDER BY a",
+      "SELECT * FROM xyz WHERE id = 1 LIMIT 1" => "SELECT * FROM xyz WHERE #{condition} AND id = 1 LIMIT 1",
+      "SElECT * FRoM xyz WHErE id = 1 GROuP BY a HAViNG id = 1 ORDeR BY z LIMiT 100" => "SElECT * FRoM xyz WHErE #{condition} AND id = 1 GROuP BY a HAViNG id = 1 ORDeR BY z LIMiT 100",
+      "SELECT * FROM xyz WHERE id = 1 GROUP BY a HAVING id = 1 ORDER BY z LIMIT 100" => "SELECT * FROM xyz WHERE #{condition} AND id = 1 GROUP BY a HAVING id = 1 ORDER BY z LIMIT 100",
+      "SELECT * FROM xyz" => "SELECT * FROM xyz WHERE #{condition}",
+      "SELECT * FROM xyz HAVING id = 1" => "SELECT * FROM xyz WHERE #{condition} HAVING id = 1",
+      "SELECT * FROM xyz GROUP BY a" => "SELECT * FROM xyz WHERE #{condition} GROUP BY a",
+      "SELECT * FROM xyz ORDER BY a" => "SELECT * FROM xyz WHERE #{condition} ORDER BY a",
+      "SELECT * FROM xyz LIMIT 1" => "SELECT * FROM xyz WHERE #{condition} LIMIT 1",
+      "SELECT * FROM xyz GROUP BY a HAVING id = 1 ORDER BY z LIMIT 100" => "SELECT * FROM xyz WHERE #{condition} GROUP BY a HAVING id = 1 ORDER BY z LIMIT 100"    }
+    
+    tests.each {|test, expected|
+      assert_equal expected, View.insert_condition(test,condition)
+    }
+    tests.each {|test, expected|
+      assert_equal test, View.insert_condition(test,nil)
+    }
+    tests.each {|test, expected|
+      assert_equal test, View.insert_condition(test,"")
+    }
+  end
+
+  def test_insert_limit_offset
+    assert_equal "SELECT * FROM x LIMIT 44, 55", View.insert_limit_offset("SELECT * FROM x", 55, 44)
+    assert_equal "SELECT * FROM x LIMIT 55", View.insert_limit_offset("SELECT * FROM x", 55)
+    assert_equal "SELECT * FROM x LIMIT 44, 55", View.insert_limit_offset("SELECT * FROM x LIMIT 324,234", 55, 44)
+    assert_equal "SELECT * FROM x LIMIT 44, 55 ", View.insert_limit_offset("SELECT * FROM x LIMIT 324, 234 ", 55, 44)
+    assert_equal "SELECT * FROM x LIMIT 55", View.insert_limit_offset("SELECT * FROM x LIMIT 3", 55)
+    assert_equal "SELECT * FROM x LIMIT 55", View.insert_limit_offset("SELECT * FROM x LIMIT 3  OFFSET  3223", 55)
+  end
+
+  def test_insert_order
+    order = "sum(xx), test"
+    assert_equal "SELECT * FROM x ORDER BY #{order}", View.insert_order("SELECT * FROM x",order)
+    assert_equal "SELECT * FROM x WHERE a = b ORDER BY #{order}", View.insert_order("SELECT * FROM x WHERE a = b",order)
+    assert_equal "SELECT * FROM x ORDER BY #{order} LIMIT 324,234", View.insert_order("SELECT * FROM x LIMIT 324,234",order)
+    assert_equal "SELECT * FROM x ORDER BY #{order} LIMIT 324, 234 ", View.insert_order("SELECT * FROM x ORDER BY sum(xxx) , ss ASC LIMIT 324, 234 ", order)
+    assert_equal "SELECT * FROM x ORDER BY #{order}", View.insert_order("SELECT * FROM x ORDER BY sum(xxx) , ss ASC", order)
+  end
+  
+  def test_update_query
+    condition = "abc = 'xyz'"
+    order = "abc, count(dd)"
+    limit = 3
+    offset = 4
+    tests = { "SELECT * FROM xyz WHERE id = 1 GROUP BY a HAVING id = 1 ORDER BY z LIMIT 100" =>
+      "SELECT * FROM xyz WHERE #{condition} AND id = 1 GROUP BY a HAVING id = 1 ORDER BY #{order} LIMIT #{offset}, #{limit} "}
+
+    tests.each {|test, result|
+      u_test = test + " UNION " + test + " UNION ALL " + test + " UNION DISTINCT " + test + " UniON DISTINCT " + test
+      u_result = "(" + result + ") UNION (" + result + ") UNION ALL (" + result + ") UNION DISTINCT (" + result + ") UNION DISTINCT (" + result + ")"
+      assert_equal u_result, View.update_query(u_test,:conditions => condition, :order => order, :limit => limit, :offset => 4)
+
+      u_test = "(" + test + ") UNION (" + test + ") UNION ALL (" + test + ") UNION DISTINCT (" + test + ") UniON DISTINCT (" + test + ")"
+      u_result = "(" + result + ") UNION (" + result + ") UNION ALL (" + result + ") UNION DISTINCT (" + result + ") UNION DISTINCT (" + result + ")"
+      assert_equal u_result, View.update_query(u_test,:conditions => condition, :order => order, :limit => limit, :offset => 4)
+    }
+
+  end
+  
+end

Added: incubator/alois/trunk/rails_plugins/auto_complete/README
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/README?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/README (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/README Thu Nov  4 18:27:22 2010
@@ -0,0 +1,23 @@
+Example:
+
+  # Controller
+  class BlogController < ApplicationController
+    auto_complete_for :post, :title
+  end
+
+  # View
+  <%= text_field_with_auto_complete :post, title %>
+
+By default, auto_complete_for limits the results to 10 entries,
+and sorts by the given field.
+
+auto_complete_for takes a third parameter, an options hash to
+the find method used to search for the records:
+
+  auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
+
+For more examples, see script.aculo.us:
+* http://script.aculo.us/demos/ajax/autocompleter
+* http://script.aculo.us/demos/ajax/autocompleter_customized
+
+Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license   

Added: incubator/alois/trunk/rails_plugins/auto_complete/Rakefile
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/Rakefile?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/Rakefile (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/Rakefile Thu Nov  4 18:27:22 2010
@@ -0,0 +1,22 @@
+require 'rake' 
+require 'rake/testtask' 
+require 'rake/rdoctask' 
+ 
+desc 'Default: run unit tests.' 
+task :default => :test 
+ 
+desc 'Test auto_complete plugin.' 
+Rake::TestTask.new(:test) do |t| 
+  t.libs << 'lib' 
+  t.pattern = 'test/**/*_test.rb' 
+  t.verbose = true 
+end 
+ 
+desc 'Generate documentation for auto_complete plugin.' 
+Rake::RDocTask.new(:rdoc) do |rdoc| 
+  rdoc.rdoc_dir = 'rdoc' 
+  rdoc.title    = 'Auto Complete' 
+  rdoc.options << '--line-numbers' << '--inline-source' 
+  rdoc.rdoc_files.include('README') 
+  rdoc.rdoc_files.include('lib/**/*.rb') 
+end

Added: incubator/alois/trunk/rails_plugins/auto_complete/init.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/init.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/init.rb (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/init.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,2 @@
+ActionController::Base.send :include, AutoComplete
+ActionController::Base.helper AutoCompleteMacrosHelper
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete.rb (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,47 @@
+module AutoComplete      
+  
+  def self.included(base)
+    base.extend(ClassMethods)
+  end
+
+  #
+  # Example:
+  #
+  #   # Controller
+  #   class BlogController < ApplicationController
+  #     auto_complete_for :post, :title
+  #   end
+  #
+  #   # View
+  #   <%= text_field_with_auto_complete :post, title %>
+  #
+  # By default, auto_complete_for limits the results to 10 entries,
+  # and sorts by the given field.
+  # 
+  # auto_complete_for takes a third parameter, an options hash to
+  # the find method used to search for the records:
+  #
+  #   auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
+  #
+  # For help on defining text input fields with autocompletion, 
+  # see ActionView::Helpers::JavaScriptHelper.
+  #
+  # For more examples, see script.aculo.us:
+  # * http://script.aculo.us/demos/ajax/autocompleter
+  # * http://script.aculo.us/demos/ajax/autocompleter_customized
+  module ClassMethods
+    def auto_complete_for(object, method, options = {})
+      define_method("auto_complete_for_#{object}_#{method}") do
+        find_options = { 
+          :conditions => [ "LOWER(#{method}) LIKE ?", '%' + params[object][method].downcase + '%' ], 
+          :order => "#{method} ASC",
+          :limit => 10 }.merge!(options)
+        
+        @items = object.to_s.camelize.constantize.find(:all, find_options)
+
+        render :inline => "<%= auto_complete_result @items, '#{method}' %>"
+      end
+    end
+  end
+  
+end
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete_macros_helper.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete_macros_helper.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete_macros_helper.rb (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/lib/auto_complete_macros_helper.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,143 @@
+module AutoCompleteMacrosHelper      
+  # Adds AJAX autocomplete functionality to the text input field with the 
+  # DOM ID specified by +field_id+.
+  #
+  # This function expects that the called action returns an HTML <ul> list,
+  # or nothing if no entries should be displayed for autocompletion.
+  #
+  # You'll probably want to turn the browser's built-in autocompletion off,
+  # so be sure to include an <tt>autocomplete="off"</tt> attribute with your text
+  # input field.
+  #
+  # The autocompleter object is assigned to a Javascript variable named <tt>field_id</tt>_auto_completer.
+  # This object is useful if you for example want to trigger the auto-complete suggestions through
+  # other means than user input (for that specific case, call the <tt>activate</tt> method on that object). 
+  # 
+  # Required +options+ are:
+  # <tt>:url</tt>::                  URL to call for autocompletion results
+  #                                  in url_for format.
+  # 
+  # Addtional +options+ are:
+  # <tt>:update</tt>::               Specifies the DOM ID of the element whose 
+  #                                  innerHTML should be updated with the autocomplete
+  #                                  entries returned by the AJAX request. 
+  #                                  Defaults to <tt>field_id</tt> + '_auto_complete'
+  # <tt>:with</tt>::                 A JavaScript expression specifying the
+  #                                  parameters for the XMLHttpRequest. This defaults
+  #                                  to 'fieldname=value'.
+  # <tt>:frequency</tt>::            Determines the time to wait after the last keystroke
+  #                                  for the AJAX request to be initiated.
+  # <tt>:indicator</tt>::            Specifies the DOM ID of an element which will be
+  #                                  displayed while autocomplete is running.
+  # <tt>:tokens</tt>::               A string or an array of strings containing
+  #                                  separator tokens for tokenized incremental 
+  #                                  autocompletion. Example: <tt>:tokens => ','</tt> would
+  #                                  allow multiple autocompletion entries, separated
+  #                                  by commas.
+  # <tt>:min_chars</tt>::            The minimum number of characters that should be
+  #                                  in the input field before an Ajax call is made
+  #                                  to the server.
+  # <tt>:on_hide</tt>::              A Javascript expression that is called when the
+  #                                  autocompletion div is hidden. The expression
+  #                                  should take two variables: element and update.
+  #                                  Element is a DOM element for the field, update
+  #                                  is a DOM element for the div from which the
+  #                                  innerHTML is replaced.
+  # <tt>:on_show</tt>::              Like on_hide, only now the expression is called
+  #                                  then the div is shown.
+  # <tt>:after_update_element</tt>:: A Javascript expression that is called when the
+  #                                  user has selected one of the proposed values. 
+  #                                  The expression should take two variables: element and value.
+  #                                  Element is a DOM element for the field, value
+  #                                  is the value selected by the user.
+  # <tt>:select</tt>::               Pick the class of the element from which the value for 
+  #                                  insertion should be extracted. If this is not specified,
+  #                                  the entire element is used.
+  # <tt>:method</tt>::               Specifies the HTTP verb to use when the autocompletion
+  #                                  request is made. Defaults to POST.
+  def auto_complete_field(field_id, options = {})
+    function =  "var #{field_id}_auto_completer = new Ajax.Autocompleter("
+    function << "'#{field_id}', "
+    function << "'" + (options[:update] || "#{field_id}_auto_complete") + "', "
+    function << "'#{url_for(options[:url])}'"
+    
+    js_options = {}
+    js_options[:tokens] = array_or_string_for_javascript(options[:tokens]) if options[:tokens]
+    js_options[:callback]   = "function(element, value) { return #{options[:with]} }" if options[:with]
+    js_options[:indicator]  = "'#{options[:indicator]}'" if options[:indicator]
+    js_options[:select]     = "'#{options[:select]}'" if options[:select]
+    js_options[:paramName]  = "'#{options[:param_name]}'" if options[:param_name]
+    js_options[:frequency]  = "#{options[:frequency]}" if options[:frequency]
+    js_options[:method]     = "'#{options[:method].to_s}'" if options[:method]
+
+    { :after_update_element => :afterUpdateElement, 
+      :on_show => :onShow, :on_hide => :onHide, :min_chars => :minChars }.each do |k,v|
+      js_options[v] = options[k] if options[k]
+    end
+
+    function << (', ' + options_for_javascript(js_options) + ')')
+
+    javascript_tag(function)
+  end
+  
+  # Use this method in your view to generate a return for the AJAX autocomplete requests.
+  #
+  # Example action:
+  #
+  #   def auto_complete_for_item_title
+  #     @items = Item.find(:all, 
+  #       :conditions => [ 'LOWER(description) LIKE ?', 
+  #       '%' + request.raw_post.downcase + '%' ])
+  #     render :inline => "<%= auto_complete_result(@items, 'description') %>"
+  #   end
+  #
+  # The auto_complete_result can of course also be called from a view belonging to the 
+  # auto_complete action if you need to decorate it further.
+  def auto_complete_result(entries, field, phrase = nil)
+    return unless entries
+    items = entries.map { |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field])) }
+    content_tag("ul", items.uniq)
+  end
+  
+  # Wrapper for text_field with added AJAX autocompletion functionality.
+  #
+  # In your controller, you'll need to define an action called
+  # auto_complete_for to respond the AJAX calls,
+  # 
+  def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {})
+    (completion_options[:skip_style] ? "" : auto_complete_stylesheet) +
+    text_field(object, method, tag_options) +
+    content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") +
+    auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options))
+  end
+
+  private
+    def auto_complete_stylesheet
+      content_tag('style', <<-EOT, :type => Mime::CSS)
+        div.auto_complete {
+          width: 350px;
+          background: #fff;
+        }
+        div.auto_complete ul {
+          border:1px solid #888;
+          margin:0;
+          padding:0;
+          width:100%;
+          list-style-type:none;
+        }
+        div.auto_complete ul li {
+          margin:0;
+          padding:3px;
+        }
+        div.auto_complete ul li.selected {
+          background-color: #ffb;
+        }
+        div.auto_complete ul strong.highlight {
+          color: #800; 
+          margin:0;
+          padding:0;
+        }
+      EOT
+    end
+
+end   

Added: incubator/alois/trunk/rails_plugins/auto_complete/test/auto_complete_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/auto_complete/test/auto_complete_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/auto_complete/test/auto_complete_test.rb (added)
+++ incubator/alois/trunk/rails_plugins/auto_complete/test/auto_complete_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,67 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '../../../../test/test_helper')) 
+
+class AutoCompleteTest < Test::Unit::TestCase
+  include AutoComplete
+  include AutoCompleteMacrosHelper
+  
+  include ActionView::Helpers::UrlHelper
+  include ActionView::Helpers::TagHelper
+  include ActionView::Helpers::TextHelper
+  include ActionView::Helpers::FormHelper
+  include ActionView::Helpers::CaptureHelper
+  
+  def setup
+    @controller = Class.new do
+      def url_for(options)
+        url =  "http://www.example.com/"
+        url << options[:action].to_s if options and options[:action]
+        url
+      end
+    end
+    @controller = @controller.new
+  end
+
+
+  def test_auto_complete_field
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" });
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);  
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {minChars:3})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){alert('me');}})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){alert('me');}");
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {frequency:2})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :frequency => 2);
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {afterUpdateElement:function(element,value){alert('You have chosen: '+value)}})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, 
+        :after_update_element => "function(element,value){alert('You have chosen: '+value)}");
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {paramName:'huidriwusch'})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch');
+    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {method:'get'})\n//]]>\n</script>),
+      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get);
+  end
+  
+  def test_auto_complete_result
+    result = [ { :title => 'test1'  }, { :title => 'test2'  } ]
+    assert_equal %(<ul><li>test1</li><li>test2</li></ul>), 
+      auto_complete_result(result, :title)
+    assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li><li>t<strong class=\"highlight\">est</strong>2</li></ul>), 
+      auto_complete_result(result, :title, "est")
+    
+    resultuniq = [ { :title => 'test1'  }, { :title => 'test1'  } ]
+    assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li></ul>), 
+      auto_complete_result(resultuniq, :title, "est")
+  end
+  
+  def test_text_field_with_auto_complete
+    assert_match %(<style type="text/css">),
+      text_field_with_auto_complete(:message, :recipient)
+
+    assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">\n//<![CDATA[\nvar message_recipient_auto_completer = new Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})\n//]]>\n</script>),
+      text_field_with_auto_complete(:message, :recipient, {}, :skip_style => true)
+  end
+  
+end

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/HEAD
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/HEAD?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/HEAD (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/HEAD Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+ref: refs/heads/master

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/config
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/config?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/config (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/config Thu Nov  4 18:27:22 2010
@@ -0,0 +1,11 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+[remote "origin"]
+	url = http://github.com/imedo/awesome_email.git
+	fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "master"]
+	remote = origin
+	merge = refs/heads/master

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/description
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/description?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/description (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/description Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+Unnamed repository; edit this file to name it for gitweb.

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/applypatch-msg
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/applypatch-msg?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/applypatch-msg (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/applypatch-msg Thu Nov  4 18:27:22 2010
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.  The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, make this file executable.
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/commit-msg" &&
+	exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/commit-msg
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/commit-msg?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/commit-msg (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/commit-msg Thu Nov  4 18:27:22 2010
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by git-commit with one argument, the name of the file
+# that has the commit message.  The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit.  The hook is allowed to edit the commit message file.
+#
+# To enable this hook, make this file executable.
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
+	echo >&2 Duplicate Signed-off-by lines.
+	exit 1
+}

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-commit
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-commit?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-commit (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-commit Thu Nov  4 18:27:22 2010
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script that is called after a successful
+# commit is made.
+#
+# To enable this hook, make this file executable.
+
+: Nothing

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-receive
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-receive?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-receive (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-receive Thu Nov  4 18:27:22 2010
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# An example hook script for the post-receive event
+#
+# This script is run after receive-pack has accepted a pack and the
+# repository has been updated.  It is passed arguments in through stdin
+# in the form
+#  <oldrev> <newrev> <refname>
+# For example:
+#  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
+#
+# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
+#
+
+
+#. /usr/share/doc/git-core/contrib/hooks/post-receive-email

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-update
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-update?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-update (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/post-update Thu Nov  4 18:27:22 2010
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, make this file executable by "chmod +x post-update".
+
+exec git-update-server-info

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-applypatch
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-applypatch?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-applypatch (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-applypatch Thu Nov  4 18:27:22 2010
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, make this file executable.
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/pre-commit" &&
+	exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
+:

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-commit
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-commit?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-commit (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-commit Thu Nov  4 18:27:22 2010
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by git-commit with no arguments.  The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, make this file executable.
+
+# This is slightly modified from Andrew Morton's Perfect Patch.
+# Lines you introduce should not have trailing whitespace.
+# Also check for an indentation that has SP before a TAB.
+
+if git-rev-parse --verify HEAD 2>/dev/null
+then
+	git-diff-index -p -M --cached HEAD --
+else
+	# NEEDSWORK: we should produce a diff with an empty tree here
+	# if we want to do the same verification for the initial import.
+	:
+fi |
+perl -e '
+    my $found_bad = 0;
+    my $filename;
+    my $reported_filename = "";
+    my $lineno;
+    sub bad_line {
+	my ($why, $line) = @_;
+	if (!$found_bad) {
+	    print STDERR "*\n";
+	    print STDERR "* You have some suspicious patch lines:\n";
+	    print STDERR "*\n";
+	    $found_bad = 1;
+	}
+	if ($reported_filename ne $filename) {
+	    print STDERR "* In $filename\n";
+	    $reported_filename = $filename;
+	}
+	print STDERR "* $why (line $lineno)\n";
+	print STDERR "$filename:$lineno:$line\n";
+    }
+    while (<>) {
+	if (m|^diff --git a/(.*) b/\1$|) {
+	    $filename = $1;
+	    next;
+	}
+	if (/^@@ -\S+ \+(\d+)/) {
+	    $lineno = $1 - 1;
+	    next;
+	}
+	if (/^ /) {
+	    $lineno++;
+	    next;
+	}
+	if (s/^\+//) {
+	    $lineno++;
+	    chomp;
+	    if (/\s$/) {
+		bad_line("trailing whitespace", $_);
+	    }
+	    if (/^\s* \t/) {
+		bad_line("indent SP followed by a TAB", $_);
+	    }
+	    if (/^([<>])\1{6} |^={7}$/) {
+		bad_line("unresolved merge conflict", $_);
+	    }
+	}
+    }
+    exit($found_bad);
+'

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-rebase
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-rebase?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-rebase (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/pre-rebase Thu Nov  4 18:27:22 2010
@@ -0,0 +1,150 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Junio C Hamano
+#
+
+publish=next
+basebranch="$1"
+if test "$#" = 2
+then
+	topic="refs/heads/$2"
+else
+	topic=`git symbolic-ref HEAD`
+fi
+
+case "$basebranch,$topic" in
+master,refs/heads/??/*)
+	;;
+*)
+	exit 0 ;# we do not interrupt others.
+	;;
+esac
+
+# Now we are dealing with a topic branch being rebased
+# on top of master.  Is it OK to rebase it?
+
+# Is topic fully merged to master?
+not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
+if test -z "$not_in_master"
+then
+	echo >&2 "$topic is fully merged to master; better remove it."
+	exit 1 ;# we could allow it, but there is no point.
+fi
+
+# Is topic ever merged to next?  If so you should not be rebasing it.
+only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git-rev-list ^master           ${publish} | sort`
+if test "$only_next_1" = "$only_next_2"
+then
+	not_in_topic=`git-rev-list "^$topic" master`
+	if test -z "$not_in_topic"
+	then
+		echo >&2 "$topic is already up-to-date with master"
+		exit 1 ;# we could allow it, but there is no point.
+	else
+		exit 0
+	fi
+else
+	not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
+	perl -e '
+		my $topic = $ARGV[0];
+		my $msg = "* $topic has commits already merged to public branch:\n";
+		my (%not_in_next) = map {
+			/^([0-9a-f]+) /;
+			($1 => 1);
+		} split(/\n/, $ARGV[1]);
+		for my $elem (map {
+				/^([0-9a-f]+) (.*)$/;
+				[$1 => $2];
+			} split(/\n/, $ARGV[2])) {
+			if (!exists $not_in_next{$elem->[0]}) {
+				if ($msg) {
+					print STDERR $msg;
+					undef $msg;
+				}
+				print STDERR " $elem->[1]\n";
+			}
+		}
+	' "$topic" "$not_in_next" "$not_in_master"
+	exit 1
+fi
+
+exit 0
+
+################################################################
+
+This sample hook safeguards topic branches that have been
+published from being rewound.
+
+The workflow assumed here is:
+
+ * Once a topic branch forks from "master", "master" is never
+   merged into it again (either directly or indirectly).
+
+ * Once a topic branch is fully cooked and merged into "master",
+   it is deleted.  If you need to build on top of it to correct
+   earlier mistakes, a new topic branch is created by forking at
+   the tip of the "master".  This is not strictly necessary, but
+   it makes it easier to keep your history simple.
+
+ * Whenever you need to test or publish your changes to topic
+   branches, merge them into "next" branch.
+
+The script, being an example, hardcodes the publish branch name
+to be "next", but it is trivial to make it configurable via
+$GIT_DIR/config mechanism.
+
+With this workflow, you would want to know:
+
+(1) ... if a topic branch has ever been merged to "next".  Young
+    topic branches can have stupid mistakes you would rather
+    clean up before publishing, and things that have not been
+    merged into other branches can be easily rebased without
+    affecting other people.  But once it is published, you would
+    not want to rewind it.
+
+(2) ... if a topic branch has been fully merged to "master".
+    Then you can delete it.  More importantly, you should not
+    build on top of it -- other people may already want to
+    change things related to the topic as patches against your
+    "master", so if you need further changes, it is better to
+    fork the topic (perhaps with the same name) afresh from the
+    tip of "master".
+
+Let's look at this example:
+
+		   o---o---o---o---o---o---o---o---o---o "next"
+		  /       /           /           /
+		 /   a---a---b A     /           /
+		/   /               /           /
+	       /   /   c---c---c---c B         /
+	      /   /   /             \         /
+	     /   /   /   b---b C     \       /
+	    /   /   /   /             \     /
+    ---o---o---o---o---o---o---o---o---o---o---o "master"
+
+
+A, B and C are topic branches.
+
+ * A has one fix since it was merged up to "next".
+
+ * B has finished.  It has been fully merged up to "master" and "next",
+   and is ready to be deleted.
+
+ * C has not merged to "next" at all.
+
+We would want to allow C to be rebased, refuse A, and encourage
+B to be deleted.
+
+To compute (1):
+
+	git-rev-list ^master ^topic next
+	git-rev-list ^master        next
+
+	if these match, topic has not merged in next at all.
+
+To compute (2):
+
+	git-rev-list master..topic
+
+	if this is empty, it is fully merged to "master".

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/update
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/update?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/update (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/hooks/update Thu Nov  4 18:27:22 2010
@@ -0,0 +1,107 @@
+#!/bin/sh
+#
+# An example hook script to blocks unannotated tags from entering.
+# Called by git-receive-pack with arguments: refname sha1-old sha1-new
+#
+# To enable this hook, make this file executable by "chmod +x update".
+#
+# Config
+# ------
+# hooks.allowunannotated
+#   This boolean sets whether unannotated tags will be allowed into the
+#   repository.  By default they won't be.
+# hooks.allowdeletetag
+#   This boolean sets whether deleting tags will be allowed in the
+#   repository.  By default they won't be.
+# hooks.allowdeletebranch
+#   This boolean sets whether deleting branches will be allowed in the
+#   repository.  By default they won't be.
+#
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+	echo "Don't run this script from the command line." >&2
+	echo " (if you want, you could supply GIT_DIR then run" >&2
+	echo "  $0 <ref> <oldrev> <newrev>)" >&2
+	exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+	exit 1
+fi
+
+# --- Config
+allowunannotated=$(git config --bool hooks.allowunannotated)
+allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
+allowdeletetag=$(git config --bool hooks.allowdeletetag)
+
+# check for no description
+projectdesc=$(sed -e '1q' "$GIT_DIR/description")
+if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb." ]; then
+	echo "*** Project description file hasn't been set" >&2
+	exit 1
+fi
+
+# --- Check types
+# if $newrev is 0000...0000, it's a commit to delete a ref.
+if [ "$newrev" = "0000000000000000000000000000000000000000" ]; then
+	newrev_type=delete
+else
+	newrev_type=$(git-cat-file -t $newrev)
+fi
+
+case "$refname","$newrev_type" in
+	refs/tags/*,commit)
+		# un-annotated tag
+		short_refname=${refname##refs/tags/}
+		if [ "$allowunannotated" != "true" ]; then
+			echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+			echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,delete)
+		# delete tag
+		if [ "$allowdeletetag" != "true" ]; then
+			echo "*** Deleting a tag is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,tag)
+		# annotated tag
+		;;
+	refs/heads/*,commit)
+		# branch
+		;;
+	refs/heads/*,delete)
+		# delete branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/remotes/*,commit)
+		# tracking branch
+		;;
+	refs/remotes/*,delete)
+		# delete tracking branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a tracking branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	*)
+		# Anything else (is there anything else?)
+		echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+		exit 1
+		;;
+esac
+
+# --- Finished
+exit 0

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/index
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/index?rev=1031127&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/alois/trunk/rails_plugins/awesome_email/.git/index
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/info/exclude
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/info/exclude?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/info/exclude (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/info/exclude Thu Nov  4 18:27:22 2010
@@ -0,0 +1,6 @@
+# git-ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/HEAD
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/HEAD?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/HEAD (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/HEAD Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 5b65809df941ae2e04f63796d803752d4a5f080f Flavio Pellanda <fl...@logintas.ch> 1222208200 +0200

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/heads/master
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/heads/master?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/heads/master (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/heads/master Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 5b65809df941ae2e04f63796d803752d4a5f080f Flavio Pellanda <fl...@logintas.ch> 1222208200 +0200

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/remotes/origin/master
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/remotes/origin/master?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/remotes/origin/master (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/logs/refs/remotes/origin/master Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 5b65809df941ae2e04f63796d803752d4a5f080f Flavio Pellanda <fl...@logintas.ch> 1222208200 +0200	fetch from http://github.com/imedo/awesome_email.git/

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.idx
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.idx?rev=1031127&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.idx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.pack
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.pack?rev=1031127&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/alois/trunk/rails_plugins/awesome_email/.git/objects/pack/pack-40984aba442406ae9867a2d2b11f436b76a87e02.pack
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/heads/master
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/heads/master?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/heads/master (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/heads/master Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+5b65809df941ae2e04f63796d803752d4a5f080f

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/HEAD
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/HEAD?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/HEAD (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/HEAD Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+ref: refs/remotes/origin/master

Added: incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/master
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/master?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/master (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/.git/refs/remotes/origin/master Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+5b65809df941ae2e04f63796d803752d4a5f080f

Added: incubator/alois/trunk/rails_plugins/awesome_email/MIT-LICENSE
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/MIT-LICENSE?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/MIT-LICENSE (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/MIT-LICENSE Thu Nov  4 18:27:22 2010
@@ -0,0 +1,20 @@
+Copyright (c) 2008 imedo GmbH
+
+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.

Added: incubator/alois/trunk/rails_plugins/awesome_email/README.textile
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/README.textile?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/README.textile (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/README.textile Thu Nov  4 18:27:22 2010
@@ -0,0 +1,80 @@
+h2. For the impatient
+
+Check out the demo application: 
+*<code>http://opensource.imedo.de/htmlmail</code>*
+
+Install the plugin: 
+*<code>script/plugin install git://github.com/imedo/awesome_email.git</code>*
+
+Learn how to use it below.
+
+h2. Introduction
+
+Have you ever tried sending HTML emails to your users? If you did, you know for sure that it sucks big time: none of the usual ActionView helpers want to work, URL routing is disabled, layouts don't work, and last but not least, the CSS you wrote for your email "simply won't work in any e-mail client":http://www.sitepoint.com/blogs/2007/01/10/microsoft-breaks-html-email-rendering-in-outlook except maybe Apple Mail. To solve all of the above problems, the <code>awesome_email</code> plugin comes to the rescue. Just install it into your <code>vendor/plugins</code> folder, and the rest comes by itself.
+If you are interested in what works in which Email client check this link: "A guide to css support in Email":http://www.campaignmonitor.com/css/
+
+h2. What does it do?
+
+There are a few interesting components in <code>awesome_email</code>:
+
+* awesome_email adds layout support to emails. That means that you can use templates for e-mails just like you would with normal Rails Views.
+* The HTML Mail's CSS is automatcally inlined. That means that your designer and/or CSS guy can design the email in a web browser without worrying about how it might look like in excotic email clients. Yes, it works in Outlook, too, and no, it "doesn't work in Outlook 2007 without tweaking":http://www.sitepoint.com/blogs/2007/01/10/microsoft-breaks-html-email-rendering-in-outlook. The reason is a "stupid decision from Microsoft about Outlook 2007", but we're working on that one.
+* ConvertEntities replaces Umlauts and other crazy symbols like &auml;, &Ouml; etc. with their HTML Entitiy counterparts e.g. <code>&amp;auml;</code> and so on.
+* HelperMethods allow you to dump the content of the CSS file right into a style tag inside the header of your HTML mail.
+
+h2. How to use it
+
+In your Mailer.delivery_xxx methods you can use
+
+<macro:code lang="ruby">
+layout    "template_filename"
+css       "css_filename"
+</macro:code>
+
+to define which layout should be used and which css file should be used to create inline styles
+
+h3. CSS inlining
+
+The cummulated style of each DOM element will be set as an style attribute when using css inlining.
+
+Example:
+
+  your css file:
+  <macro:code lang="css">
+#some-id { font-size:2em; }
+.some-class { color:red; }
+  </macro:code>
+  
+  your template:
+  <macro:code lang="html">
+<p id="some-id" class="some-class">Hello World!</p>
+  </macro:code>
+  
+  will result in the following code:
+  <macro:code lang="html">
+<p id="some-id" class="some-class" style="color:red; font-size:2em;">Hello World!</p>
+  </macro:code>
+  
+h2. Important!
+
+Be sure to follow these simple conventions or otherwise awesome_emails's magic will fail:
+
+* The layout must be located inside <code>app/views/layouts/{mailer_name}</code>
+* If you send mutlipart mails, check out the conventions on how to name your files: "http://rails.rubyonrails.com/classes/ActionMailer/Base.html":http://rails.rubyonrails.com/classes/ActionMailer/Base.html
+** So if you have these files inside of /app/views/{mailer_name}: *signup_notification.text.plain.erb*, *signup_notification.text.html.erb* ActionMailer will send a multipart mail with two parts: *text/plain* and *text/html*
+* Your CSS file must be inside of <code>/public/stylesheets</code>
+
+h2. Dependencies
+
+gems: rails 2.0.2, hpricot, csspool
+
+h2. Getting it, License and Patches
+
+Get the complete source code through "http://github.com/imedo/awesome_email":http://github.com/imedo/awesome_email. License is MIT. That means that you can do whatever you want with the software, as long as the copyright statement stays intact. Please be a kind open source citizen, and give back your patches and extensions. Just fork the code on Github, and after you're done, send us a pull request. Thanks for your help!
+
+h2. ToDo
+
+* More test coverage (as usual)
+* make it more flexible with view paths
+* rails 2.1 compatibility
+Copyright (c) 2008 imedo GmbH, released under the MIT license
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/Rakefile
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/Rakefile?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/Rakefile (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/Rakefile Thu Nov  4 18:27:22 2010
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the awesome_email plugin.'
+Rake::TestTask.new(:test) do |t|
+  t.libs << 'lib'
+  t.pattern = 'test/**/*_test.rb'
+  t.verbose = true
+end
+
+desc 'Generate documentation for the awesome_email plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+  rdoc.rdoc_dir = 'rdoc'
+  rdoc.title    = 'AwesomeEmail'
+  rdoc.options << '--line-numbers' << '--inline-source'
+  rdoc.rdoc_files.include('README')
+  rdoc.rdoc_files.include('lib/**/*.rb')
+end

Added: incubator/alois/trunk/rails_plugins/awesome_email/init.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/init.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/init.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/init.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+require File.join(File.dirname(__FILE__), 'lib/awesome_email.rb')
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/install.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/install.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/install.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/install.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+# Install hook code here

Added: incubator/alois/trunk/rails_plugins/awesome_email/lib/awesome_email.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/lib/awesome_email.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/lib/awesome_email.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/lib/awesome_email.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,4 @@
+require File.join(File.dirname(__FILE__), 'layouts.rb')
+require File.join(File.dirname(__FILE__), 'inline_styles.rb')
+require File.join(File.dirname(__FILE__), 'convert_entities.rb')
+require File.join(File.dirname(__FILE__), 'helpers.rb')
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/lib/convert_entities.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/lib/convert_entities.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/lib/convert_entities.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/lib/convert_entities.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,42 @@
+$KCODE = 'u'
+
+module ActionMailer
+  module ConvertEntities
+    # Add more if replacements you need
+    UMLAUTS = { 'ä' => '&auml;', 'ö' => '&ouml;', 'ü' => '&uuml;', 'Ä' => '&Auml;', 'Ö' => '&Ouml;', 'Ü' => '&Uuml;', 'ß' => '&szlig;' }
+    
+    module ClassMethods
+      # none
+    end
+    
+    module InstanceMethods
+      # Replace all umlauts
+      # Add more if replacements you need them
+      def convert_to_entities(text)
+        text.gsub(/[#{UMLAUTS.keys.join}]/u) { |match| UMLAUTS[match] }
+      end
+      
+      # Convert entities only when rendering html
+      def render_message_with_converted_entities(method_name, body)
+        message = render_message_without_converted_entities(method_name, body)
+        html_part?(method_name) ? convert_to_entities(message) : message
+      end
+      
+      # Check if the part we are rendering is html
+      def html_part?(method_name)
+        method_name.gsub(".", "/") =~ /#{Mime::EXTENSION_LOOKUP['html']}/ 
+      end
+    end
+    
+    def self.included(receiver)
+      receiver.extend ClassMethods
+      receiver.send :include, InstanceMethods
+      
+      receiver.class_eval do
+        alias_method_chain :render_message, :converted_entities
+      end
+    end
+  end
+end
+
+ActionMailer::Base.send :include, ActionMailer::ConvertEntities
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/lib/helpers.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/lib/helpers.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/lib/helpers.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/lib/helpers.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,39 @@
+module AwesomeEmail
+  module Helpers
+    
+    # helper methods for ActionView::Base
+    module Views
+      # prints the contents of a file to the page
+      # default file_name is 'html-mail.css'
+      def render_css_file(file_name = 'html-mail.css')
+        file_name = "#{file_name}.css" unless file_name.end_with?('.css')
+        relative_path = File.join('public', 'stylesheets', 'mails', file_name)
+        files = Dir.glob(File.join(RAILS_ROOT, '**', relative_path))
+        full_path = files.blank? ? File.join(RAILS_ROOT, relative_path) : files[0]
+        File.read(full_path) rescue ''
+      end
+      
+      # outputs style sheet information into the header of a webpage
+      # to link the stylesheet absolute, we have to pass in the server_url like: "http://localhost" or "https://localhost:3001"
+      def mail_header_styles(server_url, file_name)
+        return '' if file_name.blank?
+        %Q{<link rel="stylesheet" href="#{File.join(server_url, file_name)}" />\n<style type="text/css"><!-- #{render_css_file(file_name)} --></style>}
+      end
+    end
+    
+    # helper methods für ActionMailer::Base
+    module Mailer
+      protected 
+      # sets a few variables that ensure good delivery of the mail
+      def setup_multipart_mail
+        headers       'Content-transfer-encoding' => '8bit'
+        sent_on       Time.now
+        content_type  'text/html'
+      end
+    end
+
+  end
+end
+
+ActionView::Base.send(:include, AwesomeEmail::Helpers::Views)
+ActionMailer::Base.send(:include, AwesomeEmail::Helpers::Mailer)
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/lib/inline_styles.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/lib/inline_styles.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/lib/inline_styles.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/lib/inline_styles.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,84 @@
+require 'hpricot'
+require 'csspool'
+
+CSS::SAC::GeneratedParser.send :include, CSS::SAC::Conditions
+
+module ActionMailer
+  module InlineStyles
+    module ClassMethods
+      # none
+    end
+    
+    module InstanceMethods
+      
+      def inline(html)
+        css_doc = parse_css_doc(build_css_file_name_from_css_setting)
+        html_doc = parse_html_doc(html)
+        render_inline(css_doc, html_doc)
+      end
+      
+      def render_message_with_inline_styles(method_name, body)
+        message = render_message_without_inline_styles(method_name, body)
+        return message if @css.blank?
+        inline(message)
+      end
+      
+      protected
+      
+      def render_inline(css_doc, html_doc)
+        css_doc.find_all_rules_matching(html_doc).each do |rule|
+          inline_css = css_for_rule(rule)
+          (html_doc/rule.selector.to_css).each{|e| e['style'] = inline_css + (e['style']||'') }
+        end
+        html_doc.to_s
+      end
+      
+      def css_for_rule(rule)
+        rule.properties.map do |key, value, important|
+          build_css(key, value, important)
+        end.join
+      end
+      
+      def build_css(key, value, important)
+        delimiter = (key == 'font-family') ? ', ' : ' '
+        values = [value].flatten.join(delimiter)
+        "#{key}:#{values}#{important ? ' !important' : ''};"
+      end
+      
+      def parse_html_doc(html)
+        Hpricot.parse(html)
+      end
+      
+      def parse_css_doc(file_name)
+        sac = CSS::SAC::Parser.new
+        sac.parse(parse_css_from_file(file_name))
+      end
+      
+      def parse_css_from_file(file_name)
+        files = Dir.glob(File.join(RAILS_ROOT, '**', file_name))
+        files.blank? ? '' : File.read(files[0])
+      end
+      
+      def build_css_file_name_from_css_setting
+        @css.blank? ? '' : build_css_file_name(@css)
+      end
+      
+      def build_css_file_name(css_name)
+        file_name = "#{css_name}.css"
+        Dir.glob(File.join(RAILS_ROOT, '**', file_name))[0] || File.join(RAILS_ROOT, 'public', 'stylesheets', 'mails', file_name)
+      end
+    end
+    
+    def self.included(receiver)
+      receiver.extend         ClassMethods
+      receiver.send :include, InstanceMethods
+      
+      receiver.class_eval do
+        adv_attr_accessor :css
+        alias_method_chain :render_message, :inline_styles
+      end
+    end
+  end
+end
+
+ActionMailer::Base.send :include, ActionMailer::InlineStyles
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/lib/layouts.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/lib/layouts.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/lib/layouts.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/lib/layouts.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,74 @@
+module ActionMailer
+  module Layouts
+    module ClassMethods
+      # none
+    end
+    
+    module InstanceMethods
+      
+      # render with layout, if it is set through the "layout" accessor method and a corresponding file is found 
+      def render_message_with_layouts(method_name, body)
+        return render_message_without_layouts(method_name, body) if @layout.blank?
+        # template was set, now render with layout
+        template = initialize_template_class body
+        template = render_content method_name, template
+        render_layout_template template, method_name
+      end
+      
+    protected
+      # tries to find a matching template and renders the inner content back to the template
+      def render_content(method_name, template)
+        template.instance_variable_set(:@content_for_layout, render_content_for_layout(method_name, template))
+        template
+      end
+      
+      # builds the filename from the method_name, then renders the inner content
+      def render_content_for_layout(method_name, template)
+        file_name = extend_with_mailer_name(method_name)
+        template.render(:file => file_name)
+      end
+    
+      # finds the layout file and renders it, if the file is not found an exception is raised
+      # default path for all mailer layouts is layouts/mailers below app/views/
+      # you can pass in another layout path as 3rd arguments
+      def render_layout_template(template, method_name, layout_path = File.join('layouts', 'mailers'))
+        extension_parts = method_name.split('.')[1..-1]
+        while !extension_parts.blank?
+          file_name = File.join(layout_path, ([@layout.to_s] + extension_parts).join('.'))
+          return render_layout(file_name, template) if template_exists?(file_name)
+          extension_parts.shift
+        end
+        # nothing found, complain
+        raise "Layout '#{@layout}' not found"
+      end
+      
+      def render_layout(file_name, template)
+        template.render(file_name)
+      end
+      
+      # check if a the given view exists within the app/views folder
+      def template_exists?(file_name)
+        full_path = File.join(RAILS_ROOT, '**', 'views', file_name)
+        files = Dir.glob(full_path)
+        !files.blank?
+      end
+      
+      def extend_with_mailer_name(template_name)
+        template_name =~ /\// ? template_name : File.join(mailer_name, template_name)
+      end
+    end
+    
+    # create "layout" method to define the layout name
+    def self.included(receiver)
+      receiver.extend ClassMethods
+      receiver.send :include, InstanceMethods
+    
+      receiver.class_eval do
+        adv_attr_accessor :layout
+        alias_method_chain :render_message, :layouts
+      end
+    end
+  end
+end
+
+ActionMailer::Base.send :include, ActionMailer::Layouts
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/tasks/awesome_email_tasks.rake
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/tasks/awesome_email_tasks.rake?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/tasks/awesome_email_tasks.rake (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/tasks/awesome_email_tasks.rake Thu Nov  4 18:27:22 2010
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :awesome_email do
+#   # Task goes here
+# end

Added: incubator/alois/trunk/rails_plugins/awesome_email/test/awesome_email_test.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/test/awesome_email_test.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/test/awesome_email_test.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/test/awesome_email_test.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,182 @@
+# enable UTF-8 encoding
+$KCODE = 'u'
+
+require 'test/unit'
+require 'rubygems'
+gem 'actionmailer', '2.0.2'
+gem 'actionpack', '2.0.2'
+require 'action_mailer'
+require 'action_view'
+require 'awesome_email'
+
+require 'test_helper'
+
+ActionMailer::Base.delivery_method = :test
+
+RAILS_ROOT = '/some/dir'
+
+
+#################################################################
+
+# Do some mocking, use Mocha here?
+class SimpleMailer < ActionMailer::Base
+  
+  def test
+    setup_multipart_mail
+    layout 'test'
+  end
+  
+  protected 
+
+  def setup_multipart_mail
+    headers       'Content-transfer-encoding' => '8bit'
+    sent_on       Time.now
+    content_type  'text/html'
+  end
+
+  def html_part?(method_name)
+    true
+  end
+
+  def render_content_for_layout(method_name, template)
+    'test inner content'
+  end
+  
+  # mock rendering
+  def render_layout_template(template, method_name, layout_path = File.join('layouts', 'mailers'))
+    return template.render(:inline => "<html><body><h1>Fäncy</h1><p><%= yield %></p></body></html>")
+  end
+  
+end
+
+###############################################################
+
+# test mailer
+class MyMailer
+  def render_message(method_name, body)
+  end
+
+  def parse_css_from_file(file_name)
+    "h1 {font-size:140%}"
+  end
+
+  def mailer_name
+    "my_mailer"
+  end
+  
+  # include neccessary mixins
+  include ActionMailer::AdvAttrAccessor
+  include ActionMailer::ConvertEntities
+  include ActionMailer::InlineStyles
+  include ActionMailer::Layouts
+end
+
+MyMailer.send(:public, *MyMailer.protected_instance_methods)  
+MyMailer.send(:public, *MyMailer.private_instance_methods)
+
+
+###############################################################
+
+# not so great actually, please do help improve this
+class AwesomeEmailTest < Test::Unit::TestCase
+  
+  def setup
+    ActionMailer::Base.delivery_method = :test
+    ActionMailer::Base.perform_deliveries = true
+    ActionMailer::Base.deliveries = []
+    @css = "h1 {font-size:140%}"
+    @mailer = MyMailer.new
+  end
+  
+  
+  #######################
+  # inline styles tests #
+  #######################
+  
+  def test_should_build_correct_find_css_file_name
+    assert_equal "/some/dir/public/stylesheets/mails/test.css", @mailer.build_css_file_name("test")
+  end
+  
+  def test_should_build_correct_file_name_from_set_css
+    @mailer.css 'test'
+    assert_equal '/some/dir/public/stylesheets/mails/test.css', @mailer.build_css_file_name_from_css_setting
+  end
+  
+  def test_should_build_no_file_name_if_css_not_set
+    assert_equal '', @mailer.build_css_file_name_from_css_setting
+  end
+  
+  def test_should_not_change_html_if_no_styles_were_found
+    html = build_html('', '')
+    result = render_inline(html)
+    assert_not_nil result
+    assert_equal html, result
+  end
+  
+  def test_should_add_style_information_found_in_css_file
+    html = build_html('<h1>bla</h1>')
+    result = render_inline(html)
+    assert_not_nil result
+    assert_not_equal html, result
+    assert result =~ /<h1 style="font-size:/ 
+  end
+  
+  def test_should_find_matching_rules
+    rules = find_rules(build_html('', '<h1>bla</h1>'))
+    assert rules.size > 0
+  end
+  
+  def test_should_create_css_for_h1
+    rules = find_rules(build_html('<h1>bla</h1>'))
+    css = @mailer.css_for_rule(rules.first)
+    assert_not_nil css
+    assert_equal 'font-size:140%;', css
+  end
+  
+  def test_should_cummulate_style_information
+    html = build_html(%Q{<h1 id="oh-hai" class="green-thing" style="border-bottom:1px solid black">u haz a flavor</h1>})
+    inlined = render_inline(html)
+    assert inlined =~ /border-bottom/
+  end
+  
+  ##########################
+  # convert entities tests #
+  ##########################
+
+  def test_should_replace_entities
+    expected = '&auml; &Auml;'
+    result = @mailer.convert_to_entities('ä Ä')
+    assert_equal expected, result
+  end
+
+  ################
+  # layout tests #
+  ################
+
+  def test_should_extend_with_mailer_name
+    template_name = 'some_mail'
+    result = @mailer.extend_with_mailer_name(template_name)
+    assert_equal "my_mailer/#{template_name}", result
+  end
+  
+  # make sure the accessors are available
+  def test_should_have_awesome_email_accessor_methods
+    assert ActionMailer::Base.instance_methods.include?('css')
+    assert ActionMailer::Base.instance_methods.include?('css=')
+    assert ActionMailer::Base.instance_methods.include?('layout')
+    assert ActionMailer::Base.instance_methods.include?('layout=')
+  end
+  
+  # check for delivery errors
+  def test_should_deliver
+    SimpleMailer.deliver_test
+    assert SimpleMailer.deliveries.size > 0
+  end
+  
+  # test all of the awesomeness
+  def test_should_render_layout_convert_entities_and_apply_css
+    SimpleMailer.deliver_test
+    assert SimpleMailer.deliveries.last.body =~ /<h1>F&auml;ncy<\/h1><p>test inner content<\/p>/
+  end
+
+end
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/test/test_helper.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/test/test_helper.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/test/test_helper.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/test/test_helper.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1,19 @@
+class Test::Unit::TestCase
+  protected
+  
+  def find_rules(html)
+    css_doc = @mailer.parse_css_doc(@css)
+    html_doc = @mailer.parse_html_doc(html)
+    css_doc.find_all_rules_matching(html_doc)
+  end
+
+  def render_inline(html)
+    css_doc = @mailer.parse_css_doc(@css)
+    html_doc = @mailer.parse_html_doc(html)
+    @mailer.render_inline(css_doc, html_doc)
+  end
+
+  def build_html(content = '', head = '')
+    "<html><head>#{head}</head><body>#{content}</body></html>"
+  end
+end
\ No newline at end of file

Added: incubator/alois/trunk/rails_plugins/awesome_email/uninstall.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails_plugins/awesome_email/uninstall.rb?rev=1031127&view=auto
==============================================================================
--- incubator/alois/trunk/rails_plugins/awesome_email/uninstall.rb (added)
+++ incubator/alois/trunk/rails_plugins/awesome_email/uninstall.rb Thu Nov  4 18:27:22 2010
@@ -0,0 +1 @@
+# Uninstall hook code here