diff --git a/app/controllers/admin/components_controller.rb b/app/controllers/admin/components_controller.rb deleted file mode 100644 index 07abc711..00000000 --- a/app/controllers/admin/components_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Admin::ComponentsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :find_parent_item - - def show - #TODO - end - - def new - @component = Component.new - @component.is_published = true - @component.parent_name = @parent_item.name - - @component.engine_name = 'Announcement' # only support Announcement now - end - - def edit - @component = Component.find(params[:id]) - end - - def create - @component = Component.new(params[:component]) - - if @component.save - flash[:notice] = 'Component was successfully created.' - redirect_to admin_items_url( :parent_name => @component.parent_name ) - else - render :action => "new" - end - end - - def update - @component = Component.find(params[:id]) - - if @component.update_attributes(params[:component]) - flash[:notice] = 'Component was successfully updated.' - redirect_to admin_items_url( :parent_name => @component.parent_name ) - else - render :action => "edit" - end - end - - def destroy - @component = Component.find(params[:id]) - @component.destroy - - #TODO: destroy engine data - - redirect_to admin_items_url( :parent_name => @component.parent_name ) - end - -end diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb deleted file mode 100644 index 2ba3ad56..00000000 --- a/app/controllers/announcements_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -class AnnouncementsController < ApplicationController - - def index - @announcements = Announcement.all( :conditions => { :entry_name => params[:entry_name] }) - - respond_to do |format| - format.html { - @page = Page.find_by_name( 'announcement_index') - @page_options = { "announcements" => @announcements.map{ |a| a.to_liquid } } - render_liquid_page - } - format.xml { render :xml => @announcements } - end - end - - def show - @announcement = Announcement.find(params[:id]) - - respond_to do |format| - format.html{ - @page = Page.find_by_name( 'announcement_show') - @page_options = { 'announcement' => @announcement.to_liquid } - render_liquid_page - } - format.xml { render :xml => @announcement } - end - end - -end diff --git a/app/controllers/panel/announcements_controller.rb b/app/controllers/panel/announcements_controller.rb deleted file mode 100644 index 9bbcc051..00000000 --- a/app/controllers/panel/announcements_controller.rb +++ /dev/null @@ -1,49 +0,0 @@ -class Panel::AnnouncementsController < ApplicationController - - before_filter :require_entry_name, :only => [:index, :new] - - layout "admin" - - def index - @announcements = Announcement.all( :conditions => { :entry_name => params[:entry_name] }) - end - - def new - @announcement = Announcement.new - @announcement.entry_name = params[:entry_name] - end - - def edit - @announcement = Announcement.find(params[:id]) - end - - def create - @announcement = Announcement.new(params[:announcement]) - - if @announcement.save - flash[:notice] = 'Announcement was successfully created.' - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - else - render :action => "new" - end - end - - def update - @announcement = Announcement.find(params[:id]) - - if @announcement.update_attributes(params[:announcement]) - flash[:notice] = 'Announcement was successfully updated.' - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - else - render :action => "edit" - end - end - - def destroy - @announcement = Announcement.find(params[:id]) - @announcement.destroy - - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - end - -end diff --git a/app/helpers/admin/user_attributes_helper.rb b/app/helpers/admin/user_attributes_helper.rb deleted file mode 100644 index c60beabb..00000000 --- a/app/helpers/admin/user_attributes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Admin::UserAttributesHelper -end diff --git a/app/helpers/announcements_helper.rb b/app/helpers/announcements_helper.rb deleted file mode 100644 index beb2d039..00000000 --- a/app/helpers/announcements_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module AnnouncementsHelper -end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb deleted file mode 100644 index 2c057fd0..00000000 --- a/app/helpers/pages_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PagesHelper -end diff --git a/app/models/announcement.rb b/app/models/announcement.rb deleted file mode 100644 index e708ce98..00000000 --- a/app/models/announcement.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Announcement - - include MongoMapper::Document - - key :component_name, String, :required => true, :index => true - key_i18n :title, String - key_i18n :content, String - - def to_liquid - { "component_name" => self.entry_name, "id" => self.id.to_s, "title" => self.title, "content" => self.content } - end - -end \ No newline at end of file diff --git a/app/models/assets/asset_image.rb b/app/models/assets/asset_image.rb deleted file mode 100644 index 1dba508e..00000000 --- a/app/models/assets/asset_image.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetImage < Asset - -end \ No newline at end of file diff --git a/app/models/assets/asset_javascript.rb b/app/models/assets/asset_javascript.rb deleted file mode 100644 index 5d14b9f3..00000000 --- a/app/models/assets/asset_javascript.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetJavascript < Asset - -end \ No newline at end of file diff --git a/app/models/assets/asset_pdf.rb b/app/models/assets/asset_pdf.rb deleted file mode 100644 index 457f438d..00000000 --- a/app/models/assets/asset_pdf.rb +++ /dev/null @@ -1,2 +0,0 @@ -class AssetPdf < Asset -end \ No newline at end of file diff --git a/app/models/assets/asset_stylesheet.rb b/app/models/assets/asset_stylesheet.rb deleted file mode 100644 index f04f37ca..00000000 --- a/app/models/assets/asset_stylesheet.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetStylesheet < Asset - -end \ No newline at end of file diff --git a/app/models/component.rb b/app/models/component.rb deleted file mode 100644 index c74ea4c0..00000000 --- a/app/models/component.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Component < Item - - include LayoutSupport - - key :engine_name, String - key :layout_name, String, :required => true - key :layout_id, ObjectId, :required => true - - belongs_to :layout - - protected - - def setup_default_value - super - - if self.layout_name - self.layout_id = Layout.find_by_name( self.layout_name ).id - end - - end - -end \ No newline at end of file diff --git a/app/views/admin/components/_form.html.erb b/app/views/admin/components/_form.html.erb deleted file mode 100644 index ef8a4d56..00000000 --- a/app/views/admin/components/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= f.error_messages %> -<%= f.hidden_field :parent_name %> - -
-<%= f.label :name, "Name" %> -<%= f.text_field :name, :class => 'text' %> -
- --<%= f.label :title, "Title en" %> -<%= f.text_field :title_en, :class => 'text' %> -
- --<%= f.label :layout_name, "Layout Name" %> -<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %> -
- --<%= f.label :title, "Title zh_tw" %> -<%= f.text_field :title_zh_tw, :class => 'text' %> -
- --<%= f.label :is_published, "Is Published" %> -<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No -
- --<%= f.label :engine_name, "Choose Engine" %> -<%= f.text_field :engine_name %> -
\ No newline at end of file diff --git a/app/views/admin/components/edit.html.erb b/app/views/admin/components/edit.html.erb deleted file mode 100644 index 6d1e73b1..00000000 --- a/app/views/admin/components/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -- <%= f.submit 'Update' %> -
-<% end %> \ No newline at end of file diff --git a/app/views/admin/components/new.html.erb b/app/views/admin/components/new.html.erb deleted file mode 100644 index 237d22fc..00000000 --- a/app/views/admin/components/new.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -- <%= f.submit 'Create' %> -
- -<% end %> \ No newline at end of file diff --git a/app/views/panel/announcements/_form.html.erb b/app/views/panel/announcements/_form.html.erb deleted file mode 100644 index ace3e853..00000000 --- a/app/views/panel/announcements/_form.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<%= f.hidden_field :entry_name %> - --<%= f.label "title_zh_tw", "Title (zh_tw)" %> -<%= f.text_field "title_zh_tw" %> -
- - - --<%= f.label "title_en", "Title (en)" %> -<%= f.text_field "title_en" %> -
- -<% content_for :page_specific_javascript do %> - -<% end -%> - - --<%= f.label "content_zh_tw", "Content (zh_tw)" %> -<%= f.text_area "content_zh_tw", :size => '100x30' %> -
- - - --<%= f.label "content_en", "Content (en)" %> -<%= f.text_area "content_en", :size => '100x30' %> -
- -<% content_for :page_specific_javascript do %> - -<% end -%> \ No newline at end of file diff --git a/app/views/panel/announcements/edit.html.erb b/app/views/panel/announcements/edit.html.erb deleted file mode 100644 index 00ce99be..00000000 --- a/app/views/panel/announcements/edit.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -- <%= f.submit 'Update' %> -
-<% end %> - -<%= link_to 'Show', @announcement %> | -<%= link_to 'Back', panel_announcements_path %> \ No newline at end of file diff --git a/app/views/panel/announcements/index.html.erb b/app/views/panel/announcements/index.html.erb deleted file mode 100644 index 2d1d1c20..00000000 --- a/app/views/panel/announcements/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -Title | -Actions | -
---|---|
<%=h announcement.title %> | -<%= link_to 'Show', announcement_path(announcement) %> | - <%= link_to 'Edit', edit_panel_announcement_path(announcement) %> | - <%= link_to 'Destroy', panel_announcement_path(announcement), :confirm => 'Are you sure?', :method => :delete %> | -
- <%= f.submit 'Create' %> -
-<% end %> - -<%= link_to 'Back', panel_announcements_path %> \ No newline at end of file diff --git a/config/initializers/mongo.rb b/config/initializers/mongo.rb deleted file mode 100644 index 78b4c26f..00000000 --- a/config/initializers/mongo.rb +++ /dev/null @@ -1,28 +0,0 @@ -MongoMapper.connection = Mongo::Connection.new('localhost', 27017) -MongoMapper.database = "r4-#{Rails.env}" - -if defined?(PhusionPassenger) - PhusionPassenger.on_event(:starting_worker_process) do |forked| - MongoMapper.connection.connect_to_master if forked - end -end - -module MongoMapper::Document::ClassMethods - - def key_i18n(key, *options) - VALID_LOCALES.each do |locale| - key "#{key.to_s}_#{locale}".to_sym, *options - end - - define_method(key) do - self.send("#{key.to_s}_#{I18n.locale}") - end - - define_method("#{key}=") do |value| - VALID_LOCALES.each do |locale| - self.send("#{key.to_s}_#{locale}=", value) - end - end - end - -end \ No newline at end of file diff --git a/lib/reroute_middleware.rb b/lib/reroute_middleware.rb deleted file mode 100644 index 1f7f79e0..00000000 --- a/lib/reroute_middleware.rb +++ /dev/null @@ -1,29 +0,0 @@ -class RerouteMiddleware - - def initialize(app) - @app = app - end - - def call(env) - - #Rails.logger.debug env.to_yaml - return @app.call(env) if env['REQUEST_URI'] =~ /^\/admin/ - - env['REQUEST_URI'] =~ /^\/([0-9a-zA-Z\-_\/]*)/ - parsed_entry_name = $1 - - entry = Item.first(:conditions => {:full_name => parsed_entry_name} ) - if entry - case entry.type.to_s - when 'Component' - env['REQUEST_URI'] = env['REQUEST_URI'].sub!(parsed_entry_name, entry.engine_name) - env['QUERY_STRING'] = (env['QUERY_STRING'].blank?)? "entry_name=#{parsed_entry_name}" : "entry_name=#{parsed_entry_name}{env['QUERY_STRING']}" - when 'Link' - return [301, {'Location' => entry.url }, ['See Ya!']] - end - end - - @app.call(env) - end - -end diff --git a/lib/template/about.page.en b/lib/template/about.page.en deleted file mode 100644 index 2b081c45..00000000 --- a/lib/template/about.page.en +++ /dev/null @@ -1 +0,0 @@ -Footer
\ No newline at end of file diff --git a/lib/template/footer.snippet.zh_tw b/lib/template/footer.snippet.zh_tw deleted file mode 100644 index d8b078c7..00000000 --- a/lib/template/footer.snippet.zh_tw +++ /dev/null @@ -1 +0,0 @@ -頁尾
\ No newline at end of file diff --git a/lib/template/locale.snippet.en b/lib/template/locale.snippet.en deleted file mode 100644 index 490dd3a5..00000000 --- a/lib/template/locale.snippet.en +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/lib/template/locale.snippet.zh_tw b/lib/template/locale.snippet.zh_tw deleted file mode 100644 index 490dd3a5..00000000 --- a/lib/template/locale.snippet.zh_tw +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/lib/template/nav.snippet.en b/lib/template/nav.snippet.en deleted file mode 100644 index 94d35a67..00000000 --- a/lib/template/nav.snippet.en +++ /dev/null @@ -1,4 +0,0 @@ -This is homepage
\ No newline at end of file diff --git a/lib/template/root.page.zh_tw b/lib/template/root.page.zh_tw deleted file mode 100644 index 5225d019..00000000 --- a/lib/template/root.page.zh_tw +++ /dev/null @@ -1 +0,0 @@ -homepage這是首頁
\ No newline at end of file diff --git a/vendor/plugins/liquid/CHANGELOG b/vendor/plugins/liquid/CHANGELOG deleted file mode 100644 index 02920abc..00000000 --- a/vendor/plugins/liquid/CHANGELOG +++ /dev/null @@ -1,44 +0,0 @@ -* Ruby 1.9.1 bugfixes - -* Fix LiquidView for Rails 2.2. Fix local assigns for all versions of Rails - -* Fixed gem install rake task -* Improve Error encapsulation in liquid by maintaining a own set of exceptions instead of relying on ruby build ins - -* Added If with or / and expressions - -* Implemented .to_liquid for all objects which can be passed to liquid like Strings Arrays Hashes Numerics and Booleans. To export new objects to liquid just implement .to_liquid on them and return objects which themselves have .to_liquid methods. - -* Added more tags to standard library - -* Added include tag ( like partials in rails ) - -* [...] Gazillion of detail improvements - -* Added strainers as filter hosts for better security [Tobias Luetke] - -* Fixed that rails integration would call filter with the wrong "self" [Michael Geary] - -* Fixed bad error reporting when a filter called a method which doesn't exist. Liquid told you that it couldn't find the filter which was obviously misleading [Tobias Luetke] - -* Removed count helper from standard lib. use size [Tobias Luetke] - -* Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond] - -* Improved filter parameters. Filter parameters are now context sensitive; Types are resolved according to the rules of the context. Multiple parameters are now separated by the Liquid::ArgumentSeparator: , by default [Paul Hammond] - - {{ 'Typo' | link_to: 'http://typo.leetsoft.com', 'Typo - a modern weblog engine' }} - - -* Added Liquid::Drop. A base class which you can use for exporting proxy objects to liquid which can acquire more data when used in liquid. [Tobias Luetke] - - class ProductDrop < Liquid::Drop - def top_sales - Shop.current.products.find(:all, :order => 'sales', :limit => 10 ) - end - end - t = Liquid::Template.parse( ' {% for product in product.top_sales %} {{ product.name }} {% endfor %} ' ) - t.render('product' => ProductDrop.new ) - - -* Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond] diff --git a/vendor/plugins/liquid/History.txt b/vendor/plugins/liquid/History.txt deleted file mode 100644 index 2f1c37f6..00000000 --- a/vendor/plugins/liquid/History.txt +++ /dev/null @@ -1,44 +0,0 @@ -1.9.0 / 2008-03-04 - -* Fixed gem install rake task -* Improve Error encapsulation in liquid by maintaining a own set of exceptions instead of relying on ruby build ins - -Before 1.9.0 - -* Added If with or / and expressions - -* Implemented .to_liquid for all objects which can be passed to liquid like Strings Arrays Hashes Numerics and Booleans. To export new objects to liquid just implement .to_liquid on them and return objects which themselves have .to_liquid methods. - -* Added more tags to standard library - -* Added include tag ( like partials in rails ) - -* [...] Gazillion of detail improvements - -* Added strainers as filter hosts for better security [Tobias Luetke] - -* Fixed that rails integration would call filter with the wrong "self" [Michael Geary] - -* Fixed bad error reporting when a filter called a method which doesn't exist. Liquid told you that it couldn't find the filter which was obviously misleading [Tobias Luetke] - -* Removed count helper from standard lib. use size [Tobias Luetke] - -* Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond] - -* Improved filter parameters. Filter parameters are now context sensitive; Types are resolved according to the rules of the context. Multiple parameters are now separated by the Liquid::ArgumentSeparator: , by default [Paul Hammond] - - {{ 'Typo' | link_to: 'http://typo.leetsoft.com', 'Typo - a modern weblog engine' }} - - -* Added Liquid::Drop. A base class which you can use for exporting proxy objects to liquid which can acquire more data when used in liquid. [Tobias Luetke] - - class ProductDrop < Liquid::Drop - def top_sales - Shop.current.products.find(:all, :order => 'sales', :limit => 10 ) - end - end - t = Liquid::Template.parse( ' {% for product in product.top_sales %} {{ product.name }} {% endfor %} ' ) - t.render('product' => ProductDrop.new ) - - -* Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond] diff --git a/vendor/plugins/liquid/MIT-LICENSE b/vendor/plugins/liquid/MIT-LICENSE deleted file mode 100644 index 441ca02c..00000000 --- a/vendor/plugins/liquid/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2005, 2006 Tobias Luetke - -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 diff --git a/vendor/plugins/liquid/Manifest.txt b/vendor/plugins/liquid/Manifest.txt deleted file mode 100644 index 593e0bfe..00000000 --- a/vendor/plugins/liquid/Manifest.txt +++ /dev/null @@ -1,34 +0,0 @@ -CHANGELOG -History.txt -MIT-LICENSE -Manifest.txt -README.txt -Rakefile -init.rb -lib/extras/liquid_view.rb -lib/liquid.rb -lib/liquid/block.rb -lib/liquid/condition.rb -lib/liquid/context.rb -lib/liquid/document.rb -lib/liquid/drop.rb -lib/liquid/errors.rb -lib/liquid/extensions.rb -lib/liquid/file_system.rb -lib/liquid/htmltags.rb -lib/liquid/module_ex.rb -lib/liquid/standardfilters.rb -lib/liquid/strainer.rb -lib/liquid/tag.rb -lib/liquid/tags/assign.rb -lib/liquid/tags/capture.rb -lib/liquid/tags/case.rb -lib/liquid/tags/comment.rb -lib/liquid/tags/cycle.rb -lib/liquid/tags/for.rb -lib/liquid/tags/if.rb -lib/liquid/tags/ifchanged.rb -lib/liquid/tags/include.rb -lib/liquid/tags/unless.rb -lib/liquid/template.rb -lib/liquid/variable.rb diff --git a/vendor/plugins/liquid/README.txt b/vendor/plugins/liquid/README.txt deleted file mode 100644 index 1d019af6..00000000 --- a/vendor/plugins/liquid/README.txt +++ /dev/null @@ -1,38 +0,0 @@ -= Liquid template engine - -Liquid is a template engine which I wrote for very specific requirements - -* It has to have beautiful and simple markup. - Template engines which don't produce good looking markup are no fun to use. -* It needs to be non evaling and secure. Liquid templates are made so that users can edit them. You don't want to run code on your server which your users wrote. -* It has to be stateless. Compile and render steps have to be seperate so that the expensive parsing and compiling can be done once and later on you can - just render it passing in a hash with local variables and objects. - -== Why should i use Liquid - -* You want to allow your users to edit the appearance of your application but don't want them to run insecure code on your server. -* You want to render templates directly from the database -* You like smarty style template engines -* You need a template engine which does HTML just as well as Emails -* You don't like the markup of your current one - -== What does it look like? - -#{p}
" - end -end - -class Servlet < LiquidServlet - - def index - { 'date' => Time.now } - end - - def products - { 'products' => products_list, 'section' => 'Snowboards', 'cool_products' => true} - end - - private - - def products_list - [{'name' => 'Arbor Draft', 'price' => 39900, 'description' => 'the *arbor draft* is a excellent product' }, - {'name' => 'Arbor Element', 'price' => 40000, 'description' => 'the *arbor element* rocks for freestyling'}, - {'name' => 'Arbor Diamond', 'price' => 59900, 'description' => 'the *arbor diamond* is a made up product because im obsessed with arbor and have no creativity'}] - end - -end \ No newline at end of file diff --git a/vendor/plugins/liquid/example/server/liquid_servlet.rb b/vendor/plugins/liquid/example/server/liquid_servlet.rb deleted file mode 100644 index 8f24f002..00000000 --- a/vendor/plugins/liquid/example/server/liquid_servlet.rb +++ /dev/null @@ -1,28 +0,0 @@ -class LiquidServlet < WEBrick::HTTPServlet::AbstractServlet - - def do_GET(req, res) - handle(:get, req, res) - end - - def do_POST(req, res) - handle(:post, req, res) - end - - private - - def handle(type, req, res) - @request, @response = req, res - - @request.path_info =~ /(\w+)$/ - @action = $1 || 'index' - @assigns = send(@action) if respond_to?(@action) - - @response['Content-Type'] = "text/html" - @response.status = 200 - @response.body = Liquid::Template.parse(read_template).render(@assigns, :filters => [ProductsFilter]) - end - - def read_template(filename = @action) - File.read( File.dirname(__FILE__) + "/templates/#{filename}.liquid" ) - end -end \ No newline at end of file diff --git a/vendor/plugins/liquid/example/server/server.rb b/vendor/plugins/liquid/example/server/server.rb deleted file mode 100644 index 6d71c72e..00000000 --- a/vendor/plugins/liquid/example/server/server.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'webrick' -require 'rexml/document' - -require File.dirname(__FILE__) + '/../../lib/liquid' -require File.dirname(__FILE__) + '/liquid_servlet' -require File.dirname(__FILE__) + '/example_servlet' - -# Setup webrick -server = WEBrick::HTTPServer.new( :Port => ARGV[1] || 3000 ) -server.mount('/', Servlet) -trap("INT"){ server.shutdown } -server.start \ No newline at end of file diff --git a/vendor/plugins/liquid/example/server/templates/index.liquid b/vendor/plugins/liquid/example/server/templates/index.liquid deleted file mode 100644 index 79a52b48..00000000 --- a/vendor/plugins/liquid/example/server/templates/index.liquid +++ /dev/null @@ -1,6 +0,0 @@ -Hello world!
- -It is {{date}}
- - -Check out the Products screen
\ No newline at end of file diff --git a/vendor/plugins/liquid/example/server/templates/products.liquid b/vendor/plugins/liquid/example/server/templates/products.liquid deleted file mode 100644 index 05af4f7d..00000000 --- a/vendor/plugins/liquid/example/server/templates/products.liquid +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - -Breakpoint.activate_drb('drbunix:/tmp/breakpoint_server')
. This
- # will only work on Unix based platforms.
- def activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
- ignore_collisions = false)
-
- return false if @use_drb
-
- uri ||= 'druby://localhost:42531'
-
- if allowed_hosts then
- acl = ["deny", "all"]
-
- Array(allowed_hosts).each do |host|
- acl += ["allow", host]
- end
-
- DRb.install_acl(ACL.new(acl))
- end
-
- @use_drb = true
- @drb_service = DRbService.new
- did_collision = false
- begin
- @service = DRb.start_service(uri, @drb_service)
- rescue Errno::EADDRINUSE
- if ignore_collisions then
- nil
- else
- # The port is already occupied by another
- # Breakpoint service. We will try to tell
- # the old service that we want its port.
- # It will then forward that request to the
- # user and retry.
- unless did_collision then
- DRbObject.new(nil, uri).collision
- did_collision = true
- end
- sleep(10)
- retry
- end
- end
-
- return true
- end
-
- # Deactivates a running Breakpoint service.
- def deactivate_drb
- Thread.exclusive do
- @service.stop_service unless @service.nil?
- @service = nil
- @use_drb = false
- @drb_service = nil
- end
- end
-
- # Returns true when Breakpoints are used over DRb.
- # Breakpoint.activate_drb causes this to be true.
- def use_drb?
- @use_drb == true
- end
-end
-
-module IRB # :nodoc:
- class << self; remove_method :start; end
- def self.start(ap_path = nil, main_context = nil, workspace = nil)
- $0 = File::basename(ap_path, ".rb") if ap_path
-
- # suppress some warnings about redefined constants
- old_verbose, $VERBOSE = $VERBOSE, nil
- IRB.setup(ap_path)
- $VERBOSE = old_verbose
-
- if @CONF[:SCRIPT] then
- irb = Irb.new(main_context, @CONF[:SCRIPT])
- else
- irb = Irb.new(main_context)
- end
-
- if workspace then
- irb.context.workspace = workspace
- end
-
- @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
- @CONF[:MAIN_CONTEXT] = irb.context
-
- old_sigint = trap("SIGINT") do
- begin
- irb.signal_handle
- rescue RubyLex::TerminateLineInput
- # ignored
- end
- end
-
- catch(:IRB_EXIT) do
- irb.eval_input
- end
- ensure
- trap("SIGINT", old_sigint)
- end
-
- class << self
- alias :old_CurrentContext :CurrentContext
- remove_method :CurrentContext
- remove_method :parse_opts
- end
-
- def IRB.CurrentContext
- if old_CurrentContext.nil? and Breakpoint.use_drb? then
- result = Object.new
- def result.last_value; end
- return result
- else
- old_CurrentContext
- end
- end
- def IRB.parse_opts() end
-
- class Context # :nodoc:
- alias :old_evaluate :evaluate
- def evaluate(line, line_no)
- if line.chomp == "exit" then
- exit
- else
- old_evaluate(line, line_no)
- end
- end
- end
-
- class WorkSpace # :nodoc:
- alias :old_evaluate :evaluate
-
- def evaluate(*args)
- if Breakpoint.use_drb? then
- result = old_evaluate(*args)
- if args[0] != :no_proxy and
- not [true, false, nil].include?(result)
- then
- result.extend(DRbUndumped) rescue nil
- end
- return result
- else
- old_evaluate(*args)
- end
- end
- end
-
- module InputCompletor # :nodoc:
- def self.eval(code, context, *more)
- # Big hack, this assumes that InputCompletor
- # will only call eval() when it wants code
- # to be executed in the IRB context.
- IRB.conf[:MAIN_CONTEXT].workspace.evaluate(:no_proxy, code, *more)
- end
- end
-end
-
-module DRb # :nodoc:
- class DRbObject # :nodoc:
- undef :inspect if method_defined?(:inspect)
- undef :clone if method_defined?(:clone)
- end
-end
-
-# See Breakpoint.breakpoint
-def breakpoint(id = nil, &block)
- Binding.of_caller do |context|
- Breakpoint.breakpoint(id, context, &block)
- end
-end
-
-# See Breakpoint.assert
-def assert(&block)
- Binding.of_caller do |context|
- Breakpoint.assert(context, &block)
- end
-end
diff --git a/vendor/plugins/liquid/test/extra/caller.rb b/vendor/plugins/liquid/test/extra/caller.rb
deleted file mode 100755
index 14c96eb2..00000000
--- a/vendor/plugins/liquid/test/extra/caller.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-class Continuation # :nodoc:
- def self.create(*args, &block) # :nodoc:
- cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
- result ||= args
- return *[cc, *result]
- end
-end
-
-class Binding; end # for RDoc
-# This method returns the binding of the method that called your
-# method. It will raise an Exception when you're not inside a method.
-#
-# It's used like this:
-# def inc_counter(amount = 1)
-# Binding.of_caller do |binding|
-# # Create a lambda that will increase the variable 'counter'
-# # in the caller of this method when called.
-# inc = eval("lambda { |arg| counter += arg }", binding)
-# # We can refer to amount from inside this block safely.
-# inc.call(amount)
-# end
-# # No other statements can go here. Put them inside the block.
-# end
-# counter = 0
-# 2.times { inc_counter }
-# counter # => 2
-#
-# Binding.of_caller must be the last statement in the method.
-# This means that you will have to put everything you want to
-# do after the call to Binding.of_caller into the block of it.
-# This should be no problem however, because Ruby has closures.
-# If you don't do this an Exception will be raised. Because of
-# the way that Binding.of_caller is implemented it has to be
-# done this way.
-def Binding.of_caller(&block)
- old_critical = Thread.critical
- Thread.critical = true
- count = 0
- cc, result, error, extra_data = Continuation.create(nil, nil)
- error.call if error
-
- tracer = lambda do |*args|
- type, context, extra_data = args[0], args[4], args
- if type == "return"
- count += 1
- # First this method and then calling one will return --
- # the trace event of the second event gets the context
- # of the method which called the method that called this
- # method.
- if count == 2
- # It would be nice if we could restore the trace_func
- # that was set before we swapped in our own one, but
- # this is impossible without overloading set_trace_func
- # in current Ruby.
- set_trace_func(nil)
- cc.call(eval("binding", context), nil, extra_data)
- end
- elsif type == "line" then
- nil
- elsif type == "c-return" and extra_data[3] == :set_trace_func then
- nil
- else
- set_trace_func(nil)
- error_msg = "Binding.of_caller used in non-method context or " +
- "trailing statements of method using it aren't in the block."
- cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
- end
- end
-
- unless result
- set_trace_func(tracer)
- return nil
- else
- Thread.critical = old_critical
- case block.arity
- when 1 then yield(result)
- else yield(result, extra_data)
- end
- end
-end
diff --git a/vendor/plugins/liquid/test/file_system_test.rb b/vendor/plugins/liquid/test/file_system_test.rb
deleted file mode 100644
index d3ab9487..00000000
--- a/vendor/plugins/liquid/test/file_system_test.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/helper'
-
-class FileSystemTest < Test::Unit::TestCase
- include Liquid
-
- def test_default
- assert_raise(FileSystemError) do
- BlankFileSystem.new.read_template_file("dummy")
- end
- end
-
- def test_local
- file_system = Liquid::LocalFileSystem.new("/some/path")
- assert_equal "/some/path/_mypartial.liquid" , file_system.full_path("mypartial")
- assert_equal "/some/path/dir/_mypartial.liquid", file_system.full_path("dir/mypartial")
-
- assert_raise(FileSystemError) do
- file_system.full_path("../dir/mypartial")
- end
-
- assert_raise(FileSystemError) do
- file_system.full_path("/dir/../../dir/mypartial")
- end
-
- assert_raise(FileSystemError) do
- file_system.full_path("/etc/passwd")
- end
- end
-end
\ No newline at end of file
diff --git a/vendor/plugins/liquid/test/filter_test.rb b/vendor/plugins/liquid/test/filter_test.rb
deleted file mode 100644
index c66fe063..00000000
--- a/vendor/plugins/liquid/test/filter_test.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/helper'
-
-module MoneyFilter
- def money(input)
- sprintf(' %d$ ', input)
- end
-
- def money_with_underscore(input)
- sprintf(' %d$ ', input)
- end
-end
-
-module CanadianMoneyFilter
- def money(input)
- sprintf(' %d$ CAD ', input)
- end
-end
-
-class FiltersTest < Test::Unit::TestCase
- include Liquid
-
- def setup
- @context = Context.new
- end
-
- def test_local_filter
- @context['var'] = 1000
- @context.add_filters(MoneyFilter)
- assert_equal ' 1000$ ', Variable.new("var | money").render(@context)
- end
-
- def test_underscore_in_filter_name
- @context['var'] = 1000
- @context.add_filters(MoneyFilter)
- assert_equal ' 1000$ ', Variable.new("var | money_with_underscore").render(@context)
- end
-
- def test_second_filter_overwrites_first
- @context['var'] = 1000
- @context.add_filters(MoneyFilter)
- @context.add_filters(CanadianMoneyFilter)
- assert_equal ' 1000$ CAD ', Variable.new("var | money").render(@context)
- end
-
- def test_size
- @context['var'] = 'abcd'
- @context.add_filters(MoneyFilter)
- assert_equal 4, Variable.new("var | size").render(@context)
- end
-
- def test_join
- @context['var'] = [1,2,3,4]
- assert_equal "1 2 3 4", Variable.new("var | join").render(@context)
- end
-
- def test_sort
- @context['value'] = 3
- @context['numbers'] = [2,1,4,3]
- @context['words'] = ['expected', 'as', 'alphabetic']
- @context['arrays'] = [['flattened'], ['are']]
- assert_equal [1,2,3,4], Variable.new("numbers | sort").render(@context)
- assert_equal ['alphabetic', 'as', 'expected'],
- Variable.new("words | sort").render(@context)
- assert_equal [3], Variable.new("value | sort").render(@context)
- assert_equal ['are', 'flattened'], Variable.new("arrays | sort").render(@context)
- end
-
- def test_strip_html
- @context['var'] = "bla blub"
- assert_equal "bla blub", Variable.new("var | strip_html").render(@context)
- end
-
- def test_capitalize
- @context['var'] = "blub"
- assert_equal "Blub", Variable.new("var | capitalize").render(@context)
- end
-end
-
-class FiltersInTemplate < Test::Unit::TestCase
- include Liquid
-
- def test_local_global
- Template.register_filter(MoneyFilter)
-
- assert_equal " 1000$ ", Template.parse("{{1000 | money}}").render(nil, nil)
- assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, :filters => CanadianMoneyFilter)
- assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, :filters => [CanadianMoneyFilter])
- end
-
- def test_local_filter_with_deprecated_syntax
- assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, CanadianMoneyFilter)
- assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, [CanadianMoneyFilter])
- end
-end
diff --git a/vendor/plugins/liquid/test/helper.rb b/vendor/plugins/liquid/test/helper.rb
deleted file mode 100644
index deb81859..00000000
--- a/vendor/plugins/liquid/test/helper.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env ruby
-$LOAD_PATH.unshift(File.dirname(__FILE__)+ '/extra')
-
-require 'test/unit'
-require 'test/unit/assertions'
-require 'caller'
-require 'breakpoint'
-require File.dirname(__FILE__) + '/../lib/liquid'
-
-
-module Test
- module Unit
- module Assertions
- include Liquid
- def assert_template_result(expected, template, assigns={}, message=nil)
- assert_equal expected, Template.parse(template).render(assigns)
- end
- end
- end
-end
\ No newline at end of file
diff --git a/vendor/plugins/liquid/test/html_tag_test.rb b/vendor/plugins/liquid/test/html_tag_test.rb
deleted file mode 100644
index 546344e9..00000000
--- a/vendor/plugins/liquid/test/html_tag_test.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-require File.dirname(__FILE__) + '/helper'
-
-class HtmlTagTest < Test::Unit::TestCase
- include Liquid
-
- def test_html_table
-
- assert_template_result("#{input}
" - end - - def link_to(name, url) - %|#{name}| - end -end - - -class OutputTest < Test::Unit::TestCase - include Liquid - - def setup - @assigns = { - 'best_cars' => 'bmw', - 'car' => {'bmw' => 'good', 'gm' => 'bad'} - } - - end - - def test_variable - text = %| {{best_cars}} | - - expected = %| bmw | - assert_equal expected, Template.parse(text).render(@assigns) - end - - def test_variable_traversing - text = %| {{car.bmw}} {{car.gm}} {{car.bmw}} | - - expected = %| good bad good | - assert_equal expected, Template.parse(text).render(@assigns) - end - - def test_variable_piping - text = %( {{ car.gm | make_funny }} ) - expected = %| LOL | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_variable_piping_with_input - text = %( {{ car.gm | cite_funny }} ) - expected = %| LOL: bad | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_variable_piping_with_args - text = %! {{ car.gm | add_smiley : ':-(' }} ! - expected = %| bad :-( | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_variable_piping_with_no_args - text = %! {{ car.gm | add_smiley }} ! - expected = %| bad :-) | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_multiple_variable_piping_with_args - text = %! {{ car.gm | add_smiley : ':-(' | add_smiley : ':-('}} ! - expected = %| bad :-( :-( | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_variable_piping_with_args - text = %! {{ car.gm | add_tag : 'span', 'bar'}} ! - expected = %| bad | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_variable_piping_with_variable_args - text = %! {{ car.gm | add_tag : 'span', car.bmw}} ! - expected = %| bad | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_multiple_pipings - text = %( {{ best_cars | cite_funny | paragraph }} ) - expected = %|LOL: bmw
| - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - def test_link_to - text = %( {{ 'Typo' | link_to: 'http://typo.leetsoft.com' }} ) - expected = %| Typo | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => [FunnyFilter]) - end - - -end \ No newline at end of file diff --git a/vendor/plugins/liquid/test/parsing_quirks_test.rb b/vendor/plugins/liquid/test/parsing_quirks_test.rb deleted file mode 100644 index 5cebd522..00000000 --- a/vendor/plugins/liquid/test/parsing_quirks_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/helper' - -class ParsingQuirksTest < Test::Unit::TestCase - include Liquid - - def test_error_with_css - text = %| div { font-weight: bold; } | - template = Template.parse(text) - - assert_equal text, template.render - assert_equal [String], template.root.nodelist.collect {|i| i.class} - end - - def test_raise_on_single_close_bracet - assert_raise(SyntaxError) do - Template.parse("text {{method} oh nos!") - end - end - - def test_raise_on_label_and_no_close_bracets - assert_raise(SyntaxError) do - Template.parse("TEST {{ ") - end - end - - def test_raise_on_label_and_no_close_bracets_percent - assert_raise(SyntaxError) do - Template.parse("TEST {% ") - end - end - - def test_error_on_empty_filter - assert_nothing_raised do - Template.parse("{{test |a|b|}}") - Template.parse("{{test}}") - Template.parse("{{|test|}}") - end - end - -end \ No newline at end of file diff --git a/vendor/plugins/liquid/test/regexp_test.rb b/vendor/plugins/liquid/test/regexp_test.rb deleted file mode 100644 index 719324cd..00000000 --- a/vendor/plugins/liquid/test/regexp_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.dirname(__FILE__) + '/helper' - -class RegexpTest < Test::Unit::TestCase - include Liquid - - def test_empty - assert_equal [], ''.scan(QuotedFragment) - end - - def test_quote - assert_equal ['"arg 1"'], '"arg 1"'.scan(QuotedFragment) - end - - - def test_words - assert_equal ['arg1', 'arg2'], 'arg1 arg2'.scan(QuotedFragment) - end - - def test_quoted_words - assert_equal ['arg1', 'arg2', '"arg 3"'], 'arg1 arg2 "arg 3"'.scan(QuotedFragment) - end - - def test_quoted_words - assert_equal ['arg1', 'arg2', "'arg 3'"], 'arg1 arg2 \'arg 3\''.scan(QuotedFragment) - end - - def test_quoted_words_in_the_middle - assert_equal ['arg1', 'arg2', '"arg 3"', 'arg4'], 'arg1 arg2 "arg 3" arg4 '.scan(QuotedFragment) - end - - def test_variable_parser - assert_equal ['var'], 'var'.scan(VariableParser) - assert_equal ['var', 'method'], 'var.method'.scan(VariableParser) - assert_equal ['var', '[method]'], 'var[method]'.scan(VariableParser) - assert_equal ['var', '[method]', '[0]'], 'var[method][0]'.scan(VariableParser) - assert_equal ['var', '["method"]', '[0]'], 'var["method"][0]'.scan(VariableParser) - assert_equal ['var', '[method]', '[0]', 'method'], 'var[method][0].method'.scan(VariableParser) - end - -end \ No newline at end of file diff --git a/vendor/plugins/liquid/test/security_test.rb b/vendor/plugins/liquid/test/security_test.rb deleted file mode 100644 index 1ab0d6fa..00000000 --- a/vendor/plugins/liquid/test/security_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.dirname(__FILE__) + '/helper' - -module SecurityFilter - def add_one(input) - "#{input} + 1" - end -end - -class SecurityTest < Test::Unit::TestCase - include Liquid - - def test_no_instance_eval - text = %( {{ '1+1' | instance_eval }} ) - expected = %| 1+1 | - - assert_equal expected, Template.parse(text).render(@assigns) - end - - def test_no_existing_instance_eval - text = %( {{ '1+1' | __instance_eval__ }} ) - expected = %| 1+1 | - - assert_equal expected, Template.parse(text).render(@assigns) - end - - - def test_no_instance_eval_after_mixing_in_new_filter - text = %( {{ '1+1' | instance_eval }} ) - expected = %| 1+1 | - - assert_equal expected, Template.parse(text).render(@assigns) - end - - - def test_no_instance_eval_later_in_chain - text = %( {{ '1+1' | add_one | instance_eval }} ) - expected = %| 1+1 + 1 | - - assert_equal expected, Template.parse(text).render(@assigns, :filters => SecurityFilter) - end -end \ No newline at end of file diff --git a/vendor/plugins/liquid/test/standard_filter_test.rb b/vendor/plugins/liquid/test/standard_filter_test.rb deleted file mode 100644 index 0b9ee5b7..00000000 --- a/vendor/plugins/liquid/test/standard_filter_test.rb +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/helper' - - -class Filters - include Liquid::StandardFilters -end - - -class StandardFiltersTest < Test::Unit::TestCase - include Liquid - - def setup - @filters = Filters.new - end - - def test_size - assert_equal 3, @filters.size([1,2,3]) - assert_equal 0, @filters.size([]) - assert_equal 0, @filters.size(nil) - end - - def test_downcase - assert_equal 'testing', @filters.downcase("Testing") - assert_equal '', @filters.downcase(nil) - end - - def test_upcase - assert_equal 'TESTING', @filters.upcase("Testing") - assert_equal '', @filters.upcase(nil) - end - - def test_upcase - assert_equal 'TESTING', @filters.upcase("Testing") - assert_equal '', @filters.upcase(nil) - end - - def test_truncate - assert_equal '1234...', @filters.truncate('1234567890', 7) - assert_equal '1234567890', @filters.truncate('1234567890', 20) - assert_equal '...', @filters.truncate('1234567890', 0) - assert_equal '1234567890', @filters.truncate('1234567890') - end - - def test_escape - assert_equal '<strong>', @filters.escape('') - assert_equal '<strong>', @filters.h('') - end - - def test_truncatewords - assert_equal 'one two three', @filters.truncatewords('one two three', 4) - assert_equal 'one two...', @filters.truncatewords('one two three', 2) - assert_equal 'one two three', @filters.truncatewords('one two three') - assert_equal 'Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13”...', @filters.truncatewords('Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13” x 16” x 10.5” high) with cover.', 15) - end - - def test_strip_html - assert_equal 'test', @filters.strip_html("