├── README ├── Rakefile ├── app ├── controllers │ ├── application.rb │ ├── categories_controller.rb │ ├── cities_controller.rb │ ├── classifieds_controller.rb │ ├── main_controller.rb │ ├── subcategories_controller.rb │ └── users_controller.rb ├── helpers │ ├── application_helper.rb │ ├── categories_helper.rb │ ├── cities_helper.rb │ ├── classifieds_helper.rb │ ├── main_helper.rb │ ├── subcategories_helper.rb │ └── users_helper.rb ├── models │ ├── category.rb │ ├── city.rb │ ├── classified.rb │ ├── contact_mailer.rb │ └── subcategory.rb └── views │ ├── categories │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── cities │ ├── edit.html.erb │ ├── index.html.erb │ └── new.html.erb │ ├── classifieds │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── contact_mailer │ ├── _contact_advertiser.html.erb │ ├── adactivationlink.html.erb │ └── contactadvertiser.html.erb │ ├── layouts │ ├── category.html.erb │ ├── classifieds.html.erb │ ├── main.html.erb │ └── showad.html.erb │ ├── main │ ├── _categorysearch.html.erb │ ├── _citylist.html.erb │ ├── _footer.html.erb │ ├── _logo.html.erb │ ├── _mainsearch.html.erb │ ├── _menu.html.erb │ ├── category.html.erb │ ├── categorysearch.html.erb │ ├── city.html.erb │ ├── index.html.erb │ └── mainsearch.html.erb │ ├── simple_captcha │ └── _simple_captcha.erb │ ├── subcategories │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ └── users │ ├── _menu.html.erb │ ├── index.html.erb │ └── show.html.erb ├── config ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── inflections.rb │ ├── mime_types.rb │ ├── new_rails_defaults.rb │ └── siteconfig.rb ├── locales │ └── en.yml └── routes.rb ├── db └── schema.rb ├── doc └── README_FOR_APP ├── log ├── production.log ├── server.log └── test.log ├── public ├── 404.html ├── 422.html ├── 500.html ├── default-index.html ├── dispatch.cgi ├── dispatch.fcgi ├── dispatch.rb ├── favicon.ico ├── images │ ├── 3_original.jpg │ ├── 4_original.jpg │ ├── 77_original.jpg │ ├── 8_original.jpg │ ├── error.png │ ├── info.png │ ├── rails.png │ ├── success.png │ └── warning.png ├── javascripts │ ├── application.js │ ├── cache │ │ └── railslist.js │ ├── controls.js │ ├── dragdrop.js │ ├── effects.js │ └── prototype.js ├── robots.txt └── stylesheets │ ├── cache │ └── railslist.css │ └── railslist.css ├── script ├── about ├── console ├── dbconsole ├── destroy ├── generate ├── performance │ ├── benchmarker │ ├── profiler │ └── request ├── plugin ├── process │ ├── inspector │ ├── reaper │ └── spawner ├── runner └── server ├── test ├── functional │ ├── main_controller_test.rb │ └── users_controller_test.rb ├── performance │ └── browsing_test.rb └── test_helper.rb └── vendor └── plugins ├── mislav-will_paginate ├── .gitignore ├── .manifest ├── CHANGELOG.rdoc ├── LICENSE ├── README.rdoc ├── Rakefile ├── examples │ ├── apple-circle.gif │ ├── index.haml │ ├── index.html │ ├── pagination.css │ └── pagination.sass ├── init.rb ├── lib │ ├── will_paginate.rb │ └── will_paginate │ │ ├── array.rb │ │ ├── collection.rb │ │ ├── core_ext.rb │ │ ├── finder.rb │ │ ├── named_scope.rb │ │ ├── named_scope_patch.rb │ │ ├── version.rb │ │ └── view_helpers.rb ├── test │ ├── boot.rb │ ├── collection_test.rb │ ├── console │ ├── database.yml │ ├── finder_test.rb │ ├── fixtures │ │ ├── admin.rb │ │ ├── developer.rb │ │ ├── developers_projects.yml │ │ ├── project.rb │ │ ├── projects.yml │ │ ├── replies.yml │ │ ├── reply.rb │ │ ├── schema.rb │ │ ├── topic.rb │ │ ├── topics.yml │ │ ├── user.rb │ │ └── users.yml │ ├── helper.rb │ ├── lib │ │ ├── activerecord_test_case.rb │ │ ├── activerecord_test_connector.rb │ │ ├── load_fixtures.rb │ │ └── view_test_process.rb │ ├── tasks.rake │ └── view_test.rb └── will_paginate.gemspec ├── paperclip ├── .gitignore ├── LICENSE ├── README.rdoc ├── Rakefile ├── generators │ └── paperclip │ │ ├── USAGE │ │ ├── paperclip_generator.rb │ │ └── templates │ │ └── paperclip_migration.rb.erb ├── init.rb ├── lib │ ├── paperclip.rb │ └── paperclip │ │ ├── attachment.rb │ │ ├── callback_compatability.rb │ │ ├── geometry.rb │ │ ├── iostream.rb │ │ ├── matchers.rb │ │ ├── matchers │ │ ├── have_attached_file_matcher.rb │ │ ├── validate_attachment_content_type_matcher.rb │ │ ├── validate_attachment_presence_matcher.rb │ │ └── validate_attachment_size_matcher.rb │ │ ├── processor.rb │ │ ├── storage.rb │ │ ├── thumbnail.rb │ │ └── upfile.rb ├── paperclip.gemspec ├── shoulda_macros │ └── paperclip.rb ├── tasks │ └── paperclip_tasks.rake └── test │ ├── .gitignore │ ├── attachment_test.rb │ ├── database.yml │ ├── fixtures │ ├── 12k.png │ ├── 50x50.png │ ├── 5k.png │ ├── bad.png │ ├── text.txt │ └── twopage.pdf │ ├── geometry_test.rb │ ├── helper.rb │ ├── integration_test.rb │ ├── iostream_test.rb │ ├── matchers │ ├── have_attached_file_matcher_test.rb │ ├── validate_attachment_content_type_matcher_test.rb │ ├── validate_attachment_presence_matcher_test.rb │ └── validate_attachment_size_matcher_test.rb │ ├── paperclip_test.rb │ ├── processor_test.rb │ ├── storage_test.rb │ └── thumbnail_test.rb ├── permalink_fu ├── README.markdown ├── init.rb ├── lib │ └── permalink_fu.rb └── test │ └── permalink_fu_test.rb └── simple_captcha ├── MIT-LICENSE ├── README ├── Rakefile ├── assets ├── migrate │ ├── create_simple_captcha_data.rb │ └── create_simple_captcha_data_less_than_2.0.rb └── views │ └── simple_captcha │ └── _simple_captcha.erb ├── init.rb ├── install.rb ├── lib ├── simple_captcha_action_controller.rb ├── simple_captcha_action_view.rb ├── simple_captcha_active_record.rb ├── simple_captcha_config.rb ├── simple_captcha_controller.rb ├── simple_captcha_data.rb ├── simple_captcha_image.rb └── simple_captcha_setup.rb ├── tasks └── simple_captcha_tasks.rake └── test └── simple_captcha_test.rb /README: -------------------------------------------------------------------------------- 1 | == Welcome to Railslist 2 | 3 | Railslist has been developed in Ruby on Rails, hence the name. It uses MySQL database. It runs out of the box with very little configuration. It comes with a very clean and simple interface like Craigslist™. Using Railslist does not require extensive technical expertise. An average internet user will be at ease setting up Railslist. It's Open Source, that means it is 100% free. Railslist can be used on unlimited domains / websites without any license restrictions. Try it now. You would love it. 4 | 5 | == Railslist Features 6 | 7 | * Open Source, 100% Free & SEO Enabled. 8 | * Customizable Titles, Keywords, Descriptions & even URLs. 9 | * 99% Text Based - Extremely Faster, Superb Performance. 10 | * Powerful Search - by City, by Category, by Subcategory. 11 | * Image Upload & Email Verification. 12 | * Easy Setup and Installation. 13 | * Simple, Clean and Easy to use interface. 14 | * Unlimited Categories, Subcategories & Cities. 15 | * No registration / No Signup to post ads. 16 | * Stripped down and simplified Admin Interface 17 | * Issues running railslist?. You are not alone. Ask in our forum 18 | 19 | 20 | == Setup & Installation 21 | 22 | Railslist can be installed either on a Webserver or locally (Desktop). Irrespective where you install, it is assumed that the target system is already installed with Ruby, Rails, MySQL and ImageMagick/RMagick (used for captcha). Go for Phusion Passenger, if you have a dedicated or semi-dedicated hosting. Passenger offers faster performance. 23 | 24 | == Prerequisites 25 | Apache, Ruby 1.8.6, Rails 2.2.2, RMagick/ImageMagick and MySQL / SQLite 26 | (InstantRails for Desktop - comes with all the above except RMagick/ImageMagick) 27 | If you are using Rails 2.3.3, then rename application.rb to application_controller.rb 28 | 29 | == Installing on a Webserver 30 | 31 | * Download Railslist and unzip contents to /public_html 32 | * Modify Database Connection settings (/public_html/config/database.yml), to point to your database. 33 | * Goto database folder (/public_html/db) and run -- rake db:schema:load -- to create necessary tables in your db 34 | * Change /public_html/config/initializers/siteconfig.rb - set SITENAME = "yoursitename" & SITEURL = "http://www.yoursite.com" 35 | * Open up /public_html/config/environment.rb, modify ActionMailer settings. 36 | * Restart Apache. Goto www.yourdomain.com 37 | 38 | == Installing Locally / Desktop Installation 39 | 40 | * Download and install InstantRails 41 | * Download Railslist and Unzip it to rails_apps folder 42 | * Modify Database Connection settings (\railslist\config\database.yml), to point to your database. 43 | * Goto Railslist db folder (\railslist\db) and run -- rake db:schema:load -- to create necessary tables in your db. 44 | * Amend \railslist\config\initializers\siteconfig.rb - set SITENAME = "railslist.com" & SITEURL = "http://localhost:3000". 45 | 46 | Thats it!. Change to Railslist Directory, Start Railslist -- ruby script/server. 47 | Open your browser and visit http://localhost:3000. 48 | 49 | == Logging in as Administrator 50 | Goto: www.yourdomain/user and use default password: railslist 51 | You must change default admin password at application.rb -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require(File.join(File.dirname(__FILE__), 'config', 'boot')) 5 | 6 | require 'rake' 7 | require 'rake/testtask' 8 | require 'rake/rdoctask' 9 | 10 | require 'tasks/rails' 11 | -------------------------------------------------------------------------------- /app/controllers/application.rb: -------------------------------------------------------------------------------- 1 | # Filters added to this controller apply to all controllers in the application. 2 | # Likewise, all the methods added will be available for all controllers. 3 | 4 | class ApplicationController < ActionController::Base 5 | helper :all # include all helpers, all the time 6 | 7 | # See ActionController::RequestForgeryProtection for details 8 | # Uncomment the :secret if you're not using the cookie session store 9 | protect_from_forgery # :secret => '059ea7062c3d2de35acda1e5035b12ae' 10 | 11 | # See ActionController::Base for details 12 | # Uncomment this to filter the contents of submitted sensitive data parameters 13 | # from your application log (in this case, all fields with names like "password"). 14 | # filter_parameter_logging :password 15 | helper_method :admin? 16 | include SimpleCaptcha::ControllerHelpers 17 | 18 | 19 | # All exception handler 20 | def rescue_with_handler(exception) 21 | render :file => "#{RAILS_ROOT}/public/404.html" 22 | end 23 | 24 | protected 25 | 26 | def admin? 27 | session[:password] == "railslist" 28 | end 29 | 30 | def authorize 31 | unless admin? 32 | flash[:error] = "unauthorized access. only administrators are allowed to access that page!" 33 | redirect_to('/') 34 | false 35 | end 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /app/controllers/categories_controller.rb: -------------------------------------------------------------------------------- 1 | class CategoriesController < ApplicationController 2 | before_filter :authorize 3 | layout 'main' 4 | 5 | def index 6 | @categories = Category.list 7 | end 8 | 9 | def show 10 | @category = Category.find_by_permalink(params[:id]) 11 | end 12 | 13 | def new 14 | @category = Category.new 15 | end 16 | 17 | 18 | def edit 19 | @category = Category.find_by_permalink(params[:id]) 20 | end 21 | 22 | def create 23 | @category = Category.new(params[:category]) 24 | @category.type="Category" 25 | 26 | if @category.save 27 | flash[:notice] = 'Category was successfully created.' 28 | redirect_to(categories_path) 29 | else 30 | render :action => "new" 31 | end 32 | end 33 | 34 | def update 35 | @category = Category.find_by_permalink(params[:id]) 36 | 37 | if @category.update_attributes(params[:category]) 38 | flash[:notice] = 'Category was successfully updated.' 39 | redirect_to(categories_path) 40 | else 41 | render :action => "edit" 42 | end 43 | end 44 | 45 | 46 | def destroy 47 | @category = Category.find_by_permalink(params[:id]) 48 | @category.destroy 49 | 50 | redirect_to(categories_url) 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /app/controllers/cities_controller.rb: -------------------------------------------------------------------------------- 1 | class CitiesController < ApplicationController 2 | 3 | before_filter :authorize 4 | layout 'main' 5 | 6 | def index 7 | @cities = City.list 8 | render :layout=>'main' 9 | end 10 | 11 | def new 12 | @city = City.new 13 | end 14 | 15 | def create 16 | @city = City.new(params[:city]) 17 | if @city.save 18 | flash[:notice] = 'City was successfully added.' 19 | redirect_to(cities_path) 20 | else 21 | render :action => "new" 22 | end 23 | end 24 | 25 | def edit 26 | @city = City.find_by_permalink(params[:id]) 27 | end 28 | 29 | def update 30 | @city = City.find_by_permalink(params[:id]) 31 | if @city.update_attributes(params[:city]) 32 | flash[:notice] = 'City was successfully updated.' 33 | redirect_to(cities_path) 34 | else 35 | render :action => "edit" 36 | end 37 | end 38 | 39 | def destroy 40 | @city = City.find_by_permalink(params[:id]) 41 | @city.destroy 42 | redirect_to(cities_path) 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /app/controllers/subcategories_controller.rb: -------------------------------------------------------------------------------- 1 | class SubcategoriesController < ApplicationController 2 | 3 | before_filter :authorize 4 | layout 'main' 5 | 6 | def index 7 | @subcategories = Subcategory.find(:all, :order=>'name asc') 8 | end 9 | 10 | def new 11 | @subcategory = Subcategory.new 12 | end 13 | 14 | def edit 15 | @subcategory = Subcategory.find_by_permalink(params[:id]) 16 | end 17 | 18 | def create 19 | @subcategory = Subcategory.new(params[:subcategory]) 20 | 21 | if @subcategory.save 22 | flash[:notice] = 'Subcategory was successfully created.' 23 | redirect_to(subcategories_path) 24 | else 25 | render :action => "new" 26 | end 27 | end 28 | 29 | def update 30 | @subcategory = Subcategory.find_by_permalink(params[:id]) 31 | 32 | if @subcategory.update_attributes(params[:subcategory]) 33 | flash[:notice] = 'Subcategory was successfully updated.' 34 | redirect_to(subcategories_path) 35 | else 36 | render :action => "edit" 37 | end 38 | end 39 | 40 | def destroy 41 | @subcategory = Subcategory.find_by_permalink(params[:id]) 42 | @subcategory.destroy 43 | 44 | redirect_to(subcategories_url) 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | 3 | def show 4 | redirect_to categories_path if admin? 5 | end 6 | 7 | def create 8 | session[:password] = params[:password] 9 | flash[:success] = "Administrator login successful!" if admin? 10 | redirect_to categories_path 11 | end 12 | 13 | def destroy 14 | session[:password]=nil 15 | reset_session 16 | cookies.delete :password 17 | flash[:notice]="successfully logged out!" 18 | redirect_to :controller=>'main' 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # Methods added to this helper will be available to all templates in the application. 2 | module ApplicationHelper 3 | end 4 | -------------------------------------------------------------------------------- /app/helpers/categories_helper.rb: -------------------------------------------------------------------------------- 1 | module CategoriesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/cities_helper.rb: -------------------------------------------------------------------------------- 1 | module CitiesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/classifieds_helper.rb: -------------------------------------------------------------------------------- 1 | module ClassifiedsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/main_helper.rb: -------------------------------------------------------------------------------- 1 | module MainHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/subcategories_helper.rb: -------------------------------------------------------------------------------- 1 | module SubcategoriesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/models/category.rb: -------------------------------------------------------------------------------- 1 | class Category < ActiveRecord::Base 2 | 3 | has_many :subcategories, :foreign_key => "parent_id" 4 | has_many :classifieds 5 | 6 | named_scope :list, :conditions => {:parent_id => '0'}, :order => "pos asc" 7 | 8 | has_permalink :name 9 | 10 | def to_param 11 | permalink 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /app/models/city.rb: -------------------------------------------------------------------------------- 1 | class City < ActiveRecord::Base 2 | has_many :classifieds 3 | 4 | named_scope :list, :select => 'id, name, permalink', :order => "name ASC" 5 | 6 | has_permalink :name 7 | 8 | def to_param 9 | permalink 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /app/models/classified.rb: -------------------------------------------------------------------------------- 1 | class Classified < ActiveRecord::Base 2 | belongs_to :category 3 | belongs_to :subcategory 4 | belongs_to :city 5 | 6 | validates_presence_of :title 7 | validates_presence_of :description 8 | validates_presence_of :email 9 | validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i 10 | 11 | has_attached_file :image, 12 | :url => "/:attachment/:id_:style.:extension", 13 | :path => ":rails_root/public/:attachment/:id_:style.:extension", 14 | :styles => { :original => "500x500>" } 15 | 16 | validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/png', 'image/gif'] 17 | validates_attachment_size :image, :less_than => 175.kilobytes, :message => 'image attachment size should be lessthan 175kb' 18 | 19 | has_permalink :title, :as => :permalink, :param => false 20 | 21 | def to_param 22 | permalink 23 | end 24 | 25 | apply_simple_captcha :message=>'Values entered did not match image in step 5', :add_to_base => true 26 | 27 | def activate! 28 | self.status = 1 29 | save(false) 30 | end 31 | 32 | def active? 33 | #Ad is inactive if status is zero 34 | status==1 35 | end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /app/models/contact_mailer.rb: -------------------------------------------------------------------------------- 1 | class ContactMailer < ActionMailer::Base 2 | 3 | def contactadvertiser(classified, contact) 4 | @subject = "#{SITENAME}: Message from a visitor" 5 | @recipients = classified.email 6 | @from = contact[:email] 7 | @sent_on = Time.now 8 | @body["title"] = classified.title 9 | @body["email"] = contact[:email] 10 | @body["msg"] = contact[:msg] 11 | end 12 | 13 | def adactivationlink(classified) 14 | @subject = "#{SITENAME}: Activate your Ad" 15 | @recipients = classified.email 16 | @from = "support@railslist.com" 17 | @sent_on = Time.now 18 | @body[:title] = classified.title 19 | @body[:activateurl] = "#{SITEURL}/activate/#{classified.activation_code}" 20 | @body[:editurl] = "#{SITEURL}/edit/#{classified.activation_code}" 21 | @body[:deleteurl] = "#{SITEURL}/delete/#{classified.activation_code}" 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/models/subcategory.rb: -------------------------------------------------------------------------------- 1 | class Subcategory < Category 2 | 3 | belongs_to :category, :foreign_key => "parent_id" 4 | 5 | has_many :classifieds 6 | 7 | named_scope :list, lambda { |catid| {:conditions => ["parent_id = ?", catid]} } 8 | 9 | has_permalink :name 10 | 11 | def to_param 12 | permalink 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /app/views/categories/edit.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 46 | 47 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are editing a category

10 | 11 | 12 | 41 | 42 |
13 | <% form_for(@category) do |f| %> 14 | <%= f.error_messages %> 15 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label "SEO URL" %>
22 | <%= f.text_field :permalink %> 23 |

24 |

25 | <%= f.label "Page Title" %>
26 | <%= f.text_field :pagetitle %> 27 |

28 |

29 | <%= f.label "Meta Keywords" %>
30 | <%= f.text_area :metakey, :size=>'25x5' %> 31 |

32 |

33 | <%= f.label "Meta Description" %>
34 | <%= f.text_area :metadesc, :size=>'25x5' %> 35 |

36 |

37 | <%= f.submit "Update" %> 38 |

39 | <% end %> 40 |
43 |
44 |
45 |
48 | 49 | -------------------------------------------------------------------------------- /app/views/categories/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 33 | 34 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | <% for category in @categories %> 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <% end %> 28 |
<%= link_to "create a new category", new_category_path, :style=>'padding:5px;background:#6E6A6B;font-weight:bold;color:white' %>
CATEGORYPARENTSEO URL
<%=h category.name %><%=h category.parent_id == 0?"Top Level":category.parent.name %><%=h category.permalink %><%= link_to 'Edit', edit_category_path(category) %><%= link_to 'Destroy', category, :confirm => 'Are you sure?', :method => :delete %>
29 |
30 | 31 |
32 |
35 | 36 | -------------------------------------------------------------------------------- /app/views/categories/new.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 46 | 47 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are creating a top level (parent) category

10 | 11 | 12 | 41 | 42 |
13 | <% form_for(@category) do |f| %> 14 | <%= f.error_messages %> 15 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label "SEO URL" %>
22 | <%= f.text_field :permalink %> 23 |

24 |

25 | <%= f.label "Page Title" %>
26 | <%= f.text_field :pagetitle %> 27 |

28 |

29 | <%= f.label "Meta Keywords" %>
30 | <%= f.text_area :metakey, :size=>'25x5' %> 31 |

32 |

33 | <%= f.label "Meta Description" %>
34 | <%= f.text_area :metadesc, :size=>'25x5' %> 35 |

36 |

37 | <%= f.submit "Update" %> 38 |

39 | <% end %> 40 |
43 |
44 |
45 |
48 | 49 | -------------------------------------------------------------------------------- /app/views/categories/show.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Name: 3 | <%=h @category.name %> 4 |

5 | 6 |

7 | Parent: 8 | <%=h @category.parent_id %> 9 |

10 | 11 |

12 | Permalink: 13 | <%=h @category.permalink %> 14 |

15 | 16 | 17 | <%= link_to 'Edit', edit_category_path(@category) %> | 18 | <%= link_to 'Back', categories_path %> 19 | -------------------------------------------------------------------------------- /app/views/cities/edit.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 46 | 47 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are editing city

10 | 11 | 12 | 41 | 42 |
13 | <% form_for(@city) do |f| %> 14 | <%= f.error_messages %> 15 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label "SEO URL" %>
22 | <%= f.text_field :permalink %> 23 |

24 |

25 | <%= f.label "Page Title" %>
26 | <%= f.text_field :pagetitle %> 27 |

28 |

29 | <%= f.label "Meta Keywords" %>
30 | <%= f.text_area :metakey, :size=>'25x5' %> 31 |

32 |

33 | <%= f.label "Meta Description" %>
34 | <%= f.text_area :metadesc, :size=>'25x5' %> 35 |

36 |

37 | <%= f.submit "Update" %> 38 |

39 | <% end %> 40 |
43 |
44 |
45 |
48 | 49 | -------------------------------------------------------------------------------- /app/views/cities/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 31 | 32 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% for city in @cities %> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | <% end %> 27 |
<%= link_to "create a new city", new_city_path, :style=>'padding:5px;background:#6E6A6B;font-weight:bold;color:white' %>
CITYSEO URL
<%= city.name %><%= city.permalink %><%= link_to 'Edit', edit_city_path(city) %><%= link_to 'Destroy', city, :confirm => 'Are you sure?', :method => :delete %>
28 |
29 |
30 |
33 | -------------------------------------------------------------------------------- /app/views/cities/new.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 46 | 47 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are adding a new city

10 | 11 | 12 | 41 | 42 |
13 | <% form_for(@city) do |f| %> 14 | <%= f.error_messages %> 15 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label "SEO URL" %>
22 | <%= f.text_field :permalink %> 23 |

24 |

25 | <%= f.label "Page Title" %>
26 | <%= f.text_field :pagetitle %> 27 |

28 |

29 | <%= f.label "Meta Keywords" %>
30 | <%= f.text_area :metakey, :size=>'25x5' %> 31 |

32 |

33 | <%= f.label "Meta Description" %>
34 | <%= f.text_area :metadesc, :size=>'25x5' %> 35 |

36 |

37 | <%= f.submit "Create" %> 38 |

39 | <% end %> 40 |
43 |
44 |
45 |
48 | 49 | -------------------------------------------------------------------------------- /app/views/classifieds/edit.html.erb: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | please post to a single city and category only.  posting to multiple cities and/or categories are not allowed!. 10 |
11 | 12 |
13 | 14 | 15 | 84 | 85 |
16 | <% form_for :classified, @classified, :url => { :action => "update", :activation_code=>@classified.activation_code }, :html => { :multipart => true } do |f| %> 17 | <%= error_messages_for 'classified', :header_message=>'please rectify these errors !', :message=>"" %> 18 |
19 | 1. choose a category, a city and enter specific location 20 | 21 | 22 | 27 | 28 | 31 | 32 | 35 | 36 |
category
23 | 26 |
 city
29 | <%= collection_select(:classified, :city_id, City.list, :id, :name) %> 30 |
 specific location
33 | <%= f.text_field :location, :maxlength=>50, :size=>32, :title=>"provide a specific location/area within the selected city" %> 34 |
37 |
38 | 39 |
40 | 2. provide a title and a description 41 | 42 | 43 | 46 | 47 | 51 | 52 | 53 | 56 | 57 |
posting title:
44 | <%= f.text_field :title, :maxlength => 100, :size => 72, :title => "Better Ad Title brings higher responses." %> 45 |
 choose ad type
48 | <%= radio_button "classified", "adtype", "O", :checked=>true, :title=>"Offerd = Goods or Services for sale, for rent, for lease etc" %>Offered 49 | <%= radio_button "classified", "adtype", "W", :title=>"Wanted = You are looking to Buy, Rent Goods or Services" %>Wanted 50 |
posting description:
54 | <%= f.text_area :description, :rows => 10, :cols => 72, :title => 'Provide all necessary information such as Price, Terms, Contact Person etc' %> 55 |
58 |
59 | 60 |
61 | 3. add/edit image (overwrite's existing image) 62 | 63 | 64 | 65 | 66 |
<%= f.file_field :image, :size => 80 %>
67 |
68 | 69 |
70 | 4. contact information 71 | 72 | 73 | 76 | 77 | 78 | 79 |
Email for Communication (make sure your email is correct!)
74 | <%= f.text_field :email, :maxlength => 60, :size => 57, :title => 'Site Visitors will write to this mail id when they want to contactyou.' %> 75 |
Phone / Mobile
<%= f.text_field :phone,:maxlength => 15, :size => 30%>
we will send an activation link to this email id.
80 |
81 |
<%= submit_tag 'Update Classifieds', :style=>'font-weight:bold;font-size:14px;margin-top:5px;height:50px;width:150px;' %>
82 | <% end %> 83 |
86 |
87 | -------------------------------------------------------------------------------- /app/views/classifieds/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 60 | 61 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 | 9 | 10 | 11 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | <% form_tag :action=>'delete_multiple' do %> 37 | <% for classified in @classifieds %> 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | <% end %> 51 | 52 | 53 | 54 | <% end %> 55 |
12 | 13 | <%form_tag 'adminsearch', :method=>'get' do %> 14 | 17 | 20 | <%= text_field_tag :query %> in 21 | <%= collection_select(:subcategory, :id, Subcategory.find(:all, :order=>'name asc'), :id, :name,{:prompt=>true} ) %> 22 | <%= submit_tag "Search"%> 23 | <% end %> 24 |
idtitletypeemailcategorysubcategorystatus
<%=h classified.id %><%=h classified.title %><%=h classified.adtype %><%=h classified.email %><%=h classified.category.name %><%=h classified.subcategory.name %><%=h classified.status %><%= link_to "Edit", edit_classified_path(classified)%><%= link_to 'Destroy', classified, :confirm => 'Are you sure?', :method => :delete %><%= check_box_tag 'remove[id][]', classified.id, false %>
<%= submit_tag 'Delete Checked', :confirm => 'permanently deleting marked ads. are you sure?' %>
56 | <%= will_paginate @classifieds %> 57 |
58 | 59 |
62 | 63 | -------------------------------------------------------------------------------- /app/views/classifieds/new.html.erb: -------------------------------------------------------------------------------- 1 | 7 |
8 | please post to a single city and category only.  posting to multiple cities and/or categories are not allowed!. 9 |
10 | 11 |
12 | 13 | 14 | 92 | 93 |
15 | <% form_for(@classified, :html => { :multipart => true }) do |f| %> 16 | <%= error_messages_for 'classified', :header_message=>'please rectify these errors !', :message=>"" %> 17 |
18 | 1. choose a category, a city and enter specific location 19 | 20 | 21 | 26 | 27 | 30 | 31 | 34 | 35 |
category
22 | 25 |
 city
28 | <%= f.collection_select(:city_id, City.list, :id, :name) %> 29 |
 specific location
32 | <%= f.text_field :location, :maxlength=>50, :size=>32, :title=>"provide a specific location/area within the selected city" %> 33 |
36 |
37 | 38 |
39 | 2. provide a title and a description 40 | 41 | 42 | 45 | 46 | 50 | 51 | 52 | 55 | 56 |
posting title:
43 | <%= f.text_field :title, :maxlength => 100, :size => 72, :title => "Better Ad Title brings higher responses." %> 44 |
 choose ad type
47 | <%= radio_button "classified", "adtype", "O", :checked=>true, :title=>"Offerd = Goods or Services for sale, for rent, for lease etc" %>Offered 48 | <%= radio_button "classified", "adtype", "W", :title=>"Wanted = You are looking to Buy, Rent Goods or Services" %>Wanted 49 |
posting description:
53 | <%= f.text_area :description, :rows => 10, :cols => 72, :title => 'Provide all necessary information such as Price, Terms, Contact Person etc' %> 54 |
57 |
58 | 59 |
60 | 3. add an image 61 | 62 | 63 | 64 | 65 |
<%= f.file_field :image, :size => 80 %>
66 |
67 | 68 |
69 | 4. contact information 70 | 71 | 72 | 75 | 76 | 77 | 78 |
Email for Communication (make sure your email is correct!)
73 | <%= f.text_field :email, :maxlength => 60, :size => 57, :title => 'Site Visitors will write to this mail id when they want to contactyou.' %> 74 |
Phone / Mobile
<%= f.text_field :phone,:maxlength => 15, :size => 30%>
we will send an activation link to this email id.
79 |
80 | 81 |
82 | 5. enter the value shown in the image below
83 | 84 | 85 | 86 | 87 |
<%= show_simple_captcha(:object => "classified", :code_type=>"numeric") %>
88 |
89 |
<%= submit_tag 'Post Classified Ad', :style=>'font-weight:bold;font-size:14px;margin-top:5px;height:50px;width:150px;' %>
90 | <% end %> 91 |
94 |
95 | -------------------------------------------------------------------------------- /app/views/classifieds/show.html.erb: -------------------------------------------------------------------------------- 1 | 4 |
5 | do flag with care:

6 | miscategorised

7 | prohibited

8 | spam/overpost

9 | one of the best!!

10 |
11 |
Beware of scams & frauds.  Always deal locally and in-person
12 |

<%= @classified.title %><%= !(@classified.location.nil?)?" (#{@classified.location})":""%>

13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Ad Type:  <%= @classified.adtype == "O"?"Wanted":"Offered" %>
   Posted: <%= @classified.created_at.strftime('%Y-%m-%d, %I:%M%p') %>
30 | 31 |
32 | 33 | 34 | 39 | 47 | 48 |
35 | 38 | 40 | <%= @classified.description.gsub("\r\n","
")%> 41 |

42 | <% if @classified.image.exists? %> 43 | <%= image_tag @classified.image.url %> 44 | <% end %> 45 |

46 |
49 |
50 | -------------------------------------------------------------------------------- /app/views/contact_mailer/_contact_advertiser.html.erb: -------------------------------------------------------------------------------- 1 |
Be Safe!  Avoid Scams! 2 | 7 |
8 | 9 | <% form_tag :controller=>'main',:action => "contactadvertiser", :id=>@classified.id do %> 10 | 11 | 12 | 13 | 14 | 15 |
My Email
<%= text_field :contact, :email, :size=>'47' %>
Message to Advertiser
<%= text_area :contact, :msg, :cols=>37, :rows=>5 %>
<%= show_simple_captcha(:label=>"
(enter code from the image)") %>
<%= submit_tag "Send" %>  
16 | <% end %> -------------------------------------------------------------------------------- /app/views/contact_mailer/adactivationlink.html.erb: -------------------------------------------------------------------------------- 1 | Thankyou for Posting @ railslist.com 2 | 3 | Ad Title: <%=@title%> 4 | 5 | Now you will have to Activate it using the links provided below. Either Click the links (or) Copy & Paste them in your browser. 6 | 7 | Activate Ad: <%=@activateurl %> 8 | Edit Ad: <%=@editurl %> 9 | 10 | _____________________________________________________________________________ 11 | (Delete link will DELETE YOUR AD INSTANTLY WITHOUT ANY CONFIRMATION (or) WARNING!) 12 | 13 | Delete Ad: <%=@deleteurl %> 14 | _____________________________________________________________________________ 15 | 16 | 17 | Please store this email safe, you need it to Update / Remove your Ad. 18 | 19 | 20 | sincerely 21 | 22 | railslist.com 23 | 24 | -------------------------------------------------------------------------------- /app/views/contact_mailer/contactadvertiser.html.erb: -------------------------------------------------------------------------------- 1 | hi there! 2 | 3 | for your ad : <%= @title %>, 4 | 5 | a visitor has left you the following message: 6 | --------------------------------------------------- 7 | <%= @msg %> 8 | --------------------------------------------------- 9 | you can directly contact them at <%= @email %> 10 | 11 | 12 | thanks! 13 | 14 | 15 | [ railslist.com ] -------------------------------------------------------------------------------- /app/views/layouts/category.html.erb: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <%= @page_title || "railslist classifieds: jobs, housing, personals, for sale, services and community" %> 10 | <%= stylesheet_link_tag "railslist.css", :cache => "cache/railslist" %> 11 | 12 | 13 | <% flash.each do |key, msg| %> 14 | <%= content_tag :div, msg, :class => key, :id => key %> 15 | <% end %> 16 | 17 | <%= yield -%> 18 | 19 | -------------------------------------------------------------------------------- /app/views/layouts/classifieds.html.erb: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <%= @page_title || "railslist classifieds: jobs, housing, personals, for sale, services and community" %> 10 | <%= stylesheet_link_tag "railslist.css", :cache => "cache/railslist" %> 11 | <%= javascript_include_tag :defaults, :cache => "cache/railslist" %> 12 | 13 | 14 | <% flash.each do |key, msg| %> 15 | <%= content_tag :div, msg, :class => key, :id => key %> 16 | <% end %> 17 | 18 | <%= yield -%> 19 | 20 | -------------------------------------------------------------------------------- /app/views/layouts/main.html.erb: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <%= @page_title || "railslist classifieds: jobs, housing, personals, for sale, services and community" %> 10 | <%= stylesheet_link_tag "railslist.css", :cache => "cache/railslist" %> 11 | 12 | 13 | <% flash.each do |key, msg| %> 14 | <%= content_tag :div, msg, :class => key, :id => key %> 15 | <% end %> 16 | <%= yield -%> 17 | 18 | -------------------------------------------------------------------------------- /app/views/layouts/showad.html.erb: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <%= @page_title || "Classifieds" %> 11 | <%= stylesheet_link_tag "railslist.css", :cache => "cache/railslist" %> 12 | <%= javascript_include_tag :defaults, :cache => "cache/railslist" %> 13 | 14 | 15 | <% flash.each do |key, msg| %> 16 | <%= content_tag :div, msg, :class => key, :id => key %> 17 | <% end %> 18 | 19 | <%= yield -%> 20 | 21 | -------------------------------------------------------------------------------- /app/views/main/_categorysearch.html.erb: -------------------------------------------------------------------------------- 1 | <%form_tag 'categorysearch', :method=>'get' do %> 2 | 3 | 4 | 5 | 12 | 13 |
search for: 6 | <%= text_field_tag :mainquery, params[:mainquery] %> in 7 | <%= collection_select(:subcategory, :id, Subcategory.list(session[:categoryid]), :id, :name, :prompt=>true) %> 8 | <%= radio_button_tag "adtype","O", :checked=>true %>Offered 9 | <%= radio_button_tag "adtype","W" %>Wanted 10 |  <%= submit_tag "Search"%> 11 |
14 | <% end %> -------------------------------------------------------------------------------- /app/views/main/_citylist.html.erb: -------------------------------------------------------------------------------- 1 | <% ctcount=0 %> 2 | 3 | 4 | 20 | 21 |
5 | 6 | 7 | 17 | 18 |
8 | <% @cities.each do |c| %> 9 | <% ctcount += 1 %> 10 | ><%=c.name%> 11 | <% if ctcount == 29 %> 12 | <% ctcount = 0 %> 13 | 14 | <% end%> 15 | <% end %> 16 |
19 |
-------------------------------------------------------------------------------- /app/views/main/_footer.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | powered by railslist 4 | 5 |
-------------------------------------------------------------------------------- /app/views/main/_logo.html.erb: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /app/views/main/_mainsearch.html.erb: -------------------------------------------------------------------------------- 1 | <%form_tag 'mainsearch', :method=>'get' do %> 2 | 3 | 4 | 5 | 12 | 13 |
search for: 6 | <%= text_field_tag :mainquery, params[:mainquery] %> in 7 | <%= collection_select(:category, :id, Category.list, :id, :name) %> 8 | <%= radio_button_tag "adtype","O", :checked=>true %>Offered 9 | <%= radio_button_tag "adtype","W" %>Wanted 10 |  <%= submit_tag "search"%> 11 |
14 | <% end %> -------------------------------------------------------------------------------- /app/views/main/_menu.html.erb: -------------------------------------------------------------------------------- 1 | 7 |
powered by railslist
-------------------------------------------------------------------------------- /app/views/main/category.html.erb: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | <%form_tag 'categorysearch', :method=>'get' do %> 10 | 11 | 12 | 13 | 20 | 21 |
search for: 14 | <%= text_field_tag :mainquery %> in 15 | <%= collection_select(:subcategory, :id, Subcategory.list(session[:categoryid]), :id, :name, :prompt=>true) %> 16 | <%= radio_button_tag "adtype","O", :checked=>true %>Offered 17 | <%= radio_button_tag "adtype","W" %>Wanted 18 |  <%= submit_tag "Search"%> 19 |
22 | <% end %> 23 |
24 | 25 | 42 | 43 |
26 | <% @classifieds.group_by { |c| c.created_at.to_date }.each do |d, classifieds| %> 27 |

<%= d.strftime('%a, %d %b') %>

28 | <% for c in classifieds %> 29 | <%if c.image.exists? -%> 30 |

<%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> pic << <%=c.subcategory.name%>

31 | <%else%> 32 |

<%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> << <%=c.subcategory.name%>

33 | <%end%> 34 | <% end %> 35 | <% end %> 36 |
37 | <%= will_paginate @classifieds %>
38 |
39 | 40 |
powered by railslist
41 |
44 |
45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/views/main/categorysearch.html.erb: -------------------------------------------------------------------------------- 1 | 7 |
8 | <%= render :partial => "main/categorysearch" %> 9 |
10 | 11 | 28 | 29 |
12 | search results for: [ <%= params[:mainquery] %> ] in <%= @category.name %> / <%= @city.name %> 13 | <% for c in @classifieds %> 14 | 15 | <%if c.image.exists? -%> 16 |

<%= c.created_at.strftime('%a, %d %b')%> - <%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> pic << <%=c.subcategory.name%>

17 | <%else%> 18 |

<%= c.created_at.strftime('%a, %d %b')%> - <%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> << <%=c.subcategory.name%>

19 | <%end%> 20 | 21 | <% end %> 22 |
23 | <%= will_paginate @classifieds %>
24 |
25 | 26 |
powered by railslist
27 |
30 |
-------------------------------------------------------------------------------- /app/views/main/city.html.erb: -------------------------------------------------------------------------------- 1 | <% catcount = 0 %> 2 | 3 | 4 | 5 | 26 | 27 | 54 | 55 | 56 |
6 | <%= render :partial => "main/logo" %> 7 | <%= render :partial => "main/menu" %> 8 | <%form_tag 'mainsearch', :method=>'get' do %> 9 | 10 | 14 | 17 | 20 | 23 |
11 | <%= radio_button_tag "adtype","O", :checked=>true %> Offered 12 |   <%= radio_button_tag "adtype","W" %> Wanted 13 |
15 | <%= text_field_tag :mainquery %> 16 |
18 | <%= collection_select :category, :id, Category.list, :id, :name %> 19 |
21 | <%= submit_tag "search"%> 22 |
24 | <% end %> 25 |
   28 | 29 | 30 | 31 | 51 | 52 |

<%= @city.name %>

32 | <% @categories.each do |c| %> 33 | <% catcount += 1 %> 34 | 35 | 36 | 44 |
37 | <% c.subcategories.each do |s| %> 38 | <% if s.id == 9 || s.id == 52 || s.id == 79%> 39 | 40 | <% end %> 41 | <%=s.name%> 42 | <% end %> 43 |
 
45 | <% if c.id == 32 || c.id == 15 %> 46 | <% catcount = 0 %> 47 |
  48 | <% end%> 49 | <% end %> 50 |
53 |
<%= render :partial => "main/citylist" %>
-------------------------------------------------------------------------------- /app/views/main/index.html.erb: -------------------------------------------------------------------------------- 1 | <% citycount = 0 %> 2 | 3 | 4 | 8 | 9 | 34 | 35 |
5 | <%= render :partial => "main/logo" %> 6 | <%= render :partial => "main/menu" %> 7 | 10 | 11 | 12 | 31 | 32 |
13 | 14 | 15 | 16 | 17 | 18 | 28 | 29 |

please select a city

19 | <% @cities.each do |c| %> 20 | <% citycount += 1 %> 21 | <%=c.name%> 22 | <% if citycount == 20 %> 23 | <% citycount = 0 %> 24 | 25 | <% end%> 26 | <% end %> 27 |
30 |
33 |
36 | -------------------------------------------------------------------------------- /app/views/main/mainsearch.html.erb: -------------------------------------------------------------------------------- 1 | 7 |
8 | <%= render :partial => "main/mainsearch" %> 9 |
10 | 11 | 28 | 29 |
12 | search results for: [ <%= params[:mainquery] %> ] in <%= @category.name %> / <%= @city.name %> 13 | <% for c in @classifieds %> 14 | 15 | <%if c.image.exists? -%> 16 |

<%= c.created_at.strftime('%a, %d %b')%> - <%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> pic << <%=c.subcategory.name%>

17 | <%else%> 18 |

<%= c.created_at.strftime('%a, %d %b')%> - <%=c.title%> <%=" - (#{c.location}) " if !c.location.blank?%> << <%=c.subcategory.name%>

19 | <%end%> 20 | 21 | <% end %> 22 |
23 | <%= will_paginate @classifieds %>
24 |
25 | 26 |
powered by railslist
27 |
30 |
-------------------------------------------------------------------------------- /app/views/simple_captcha/_simple_captcha.erb: -------------------------------------------------------------------------------- 1 | 2 |
3 | <%= @simple_captcha_options[:image] %> 4 | <%= @simple_captcha_options[:field] %> 5 | <%= @simple_captcha_options[:label] %> 6 |
-------------------------------------------------------------------------------- /app/views/subcategories/edit.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 53 | 54 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are editing a category

10 | 11 | 12 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label :parent %>
22 | <%= f.collection_select(:parent_id, Category.list, :id, :name) %> 23 |

24 |

25 | <%= f.label "SEO URL" %>
26 | <%= f.text_field :permalink %> 27 |

28 |

29 | <%= f.label "Page Title" %>
30 | <%= f.text_field :pagetitle %> 31 |

32 |

33 | <%= f.label "Meta Keywords" %>
34 | <%= f.text_area :metakey, :size=>'25x5' %> 35 |

36 |

37 | <%= f.label "Meta Description" %>
38 | <%= f.text_area :metadesc, :size=>'25x5' %> 39 |

40 | 41 | 42 |

43 | <%= f.submit "Update" %> 44 |

45 | 46 | <% end %> 47 | 48 | 49 |
13 | <% form_for(@subcategory) do |f| %> 14 | <%= f.error_messages %> 15 |
50 |
51 |
52 |
55 | -------------------------------------------------------------------------------- /app/views/subcategories/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 32 | 33 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | <% for subcategory in @subcategories %> 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <% end %> 28 |
<%= link_to "create a new subcategory", new_subcategory_path, :style=>'padding:5px;background:#6E6A6B;font-weight:bold;color:white' %>
SUBCATEGORYPARENTSEO URL
<%=h subcategory.name %><%=h subcategory.category.name %><%=h subcategory.permalink %><%= link_to 'Edit', edit_subcategory_path(subcategory) %><%= link_to 'Destroy', subcategory, :confirm => 'Are you sure?', :method => :delete %>
29 |
30 |
31 |
34 | 35 | -------------------------------------------------------------------------------- /app/views/subcategories/new.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 53 | 54 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 |

you are editing a category

10 | 11 | 12 | 16 |

17 | <%= f.label :name %>
18 | <%= f.text_field :name %> 19 |

20 |

21 | <%= f.label :parent %>
22 | <%= f.collection_select(:parent_id, Category.list, :id, :name) %> 23 |

24 |

25 | <%= f.label "SEO URL" %>
26 | <%= f.text_field :permalink %> 27 |

28 |

29 | <%= f.label "Page Title" %>
30 | <%= f.text_field :pagetitle %> 31 |

32 |

33 | <%= f.label "Meta Keywords" %>
34 | <%= f.text_area :metakey, :size=>'25x5' %> 35 |

36 |

37 | <%= f.label "Meta Description" %>
38 | <%= f.text_area :metadesc, :size=>'25x5' %> 39 |

40 | 41 | 42 |

43 | <%= f.submit "Update" %> 44 |

45 | 46 | <% end %> 47 | 48 | 49 |
13 | <% form_for(@subcategory) do |f| %> 14 | <%= f.error_messages %> 15 |
50 |
51 |
52 |
55 | -------------------------------------------------------------------------------- /app/views/subcategories/show.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= link_to 'Edit', edit_subcategory_path(@subcategory) %> | 3 | <%= link_to 'Back', subcategories_path %> 4 | -------------------------------------------------------------------------------- /app/views/users/_menu.html.erb: -------------------------------------------------------------------------------- 1 | 9 |
powered by railslist
-------------------------------------------------------------------------------- /app/views/users/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 31 | 32 |
4 | <%= render :partial => "main/logo" %> 5 | <%= render :partial => "users/menu" %> 6 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% for city in @cities %> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | <% end %> 27 |
<%= link_to "create a new city", new_city_path %>
CITYSEO URL
<%= city.name %><%= city.permalink %><%= link_to 'Edit', edit_city_path(city) %><%= link_to 'Destroy', city, :confirm => 'Are you sure?', :method => :delete %>
28 |
29 |
30 |
33 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 | <% if !(admin?) %> 2 |
3 | 4 | <% form_tag user_path do %> 5 | 6 | 7 | 8 | 9 | 12 | 15 | 16 |

Administrator Login

10 | Password: <%= password_field_tag :password%> 11 | 13 | <%= submit_tag 'login' %> 14 |
17 |

18 | powered by: railslist 19 |
20 | <% end %> 21 | <% else %> 22 | 23 | 24 | 28 | 29 | 30 |
25 | <%= render :partial => "main/logo" %> 26 | <%= render :partial => "users/menu" %> 27 |   
31 | <% end %> 32 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Don't change this file! 2 | # Configure your app in config/environment.rb and config/environments/*.rb 3 | 4 | RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) 5 | 6 | module Rails 7 | class << self 8 | def boot! 9 | unless booted? 10 | preinitialize 11 | pick_boot.run 12 | end 13 | end 14 | 15 | def booted? 16 | defined? Rails::Initializer 17 | end 18 | 19 | def pick_boot 20 | (vendor_rails? ? VendorBoot : GemBoot).new 21 | end 22 | 23 | def vendor_rails? 24 | File.exist?("#{RAILS_ROOT}/vendor/rails") 25 | end 26 | 27 | def preinitialize 28 | load(preinitializer_path) if File.exist?(preinitializer_path) 29 | end 30 | 31 | def preinitializer_path 32 | "#{RAILS_ROOT}/config/preinitializer.rb" 33 | end 34 | end 35 | 36 | class Boot 37 | def run 38 | load_initializer 39 | Rails::Initializer.run(:set_load_path) 40 | end 41 | end 42 | 43 | class VendorBoot < Boot 44 | def load_initializer 45 | require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" 46 | Rails::Initializer.run(:install_gem_spec_stubs) 47 | end 48 | end 49 | 50 | class GemBoot < Boot 51 | def load_initializer 52 | self.class.load_rubygems 53 | load_rails_gem 54 | require 'initializer' 55 | end 56 | 57 | def load_rails_gem 58 | if version = self.class.gem_version 59 | gem 'rails', version 60 | else 61 | gem 'rails' 62 | end 63 | rescue Gem::LoadError => load_error 64 | $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) 65 | exit 1 66 | end 67 | 68 | class << self 69 | def rubygems_version 70 | Gem::RubyGemsVersion rescue nil 71 | end 72 | 73 | def gem_version 74 | if defined? RAILS_GEM_VERSION 75 | RAILS_GEM_VERSION 76 | elsif ENV.include?('RAILS_GEM_VERSION') 77 | ENV['RAILS_GEM_VERSION'] 78 | else 79 | parse_gem_version(read_environment_rb) 80 | end 81 | end 82 | 83 | def load_rubygems 84 | require 'rubygems' 85 | min_version = '1.3.1' 86 | unless rubygems_version >= min_version 87 | $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) 88 | exit 1 89 | end 90 | 91 | rescue LoadError 92 | $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) 93 | exit 1 94 | end 95 | 96 | def parse_gem_version(text) 97 | $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ 98 | end 99 | 100 | private 101 | def read_environment_rb 102 | File.read("#{RAILS_ROOT}/config/environment.rb") 103 | end 104 | end 105 | end 106 | end 107 | 108 | # All that for this: 109 | Rails.boot! 110 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3-ruby (not necessary on OS X Leopard) 3 | development: 4 | adapter: mysql 5 | database: mysql-database-name 6 | username: mysql-user-name 7 | password: mysql-password 8 | host: localhost 9 | 10 | # Warning: The database defined as "test" will be erased and 11 | # re-generated from your development database when you run "rake". 12 | # Do not set this db to the same as development or production. 13 | test: 14 | adapter: mysql 15 | database: mysql-database-name 16 | username: mysql-user-name 17 | password: mysql-password 18 | host: localhost 19 | 20 | production: 21 | adapter: mysql 22 | database: mysql-database-name 23 | username: mysql-user-name 24 | password: mysql-password 25 | host: localhost 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file 2 | 3 | # Uncomment below to force Rails into production mode when 4 | # you don't control web/app server and can't set it the proper way 5 | # ENV['RAILS_ENV'] ||= 'production' 6 | 7 | # Specifies gem version of Rails to use when vendor/rails is not present 8 | RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION 9 | 10 | # Bootstrap the Rails environment, frameworks, and default configuration 11 | require File.join(File.dirname(__FILE__), 'boot') 12 | 13 | Rails::Initializer.run do |config| 14 | # Settings in config/environments/* take precedence over those specified here. 15 | # Application configuration should go into files in config/initializers 16 | # -- all .rb files in that directory are automatically loaded. 17 | # See Rails::Configuration for more options. 18 | 19 | # Skip frameworks you're not going to use. To use Rails without a database 20 | # you must remove the Active Record framework. 21 | # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] 22 | 23 | # Specify gems that this application depends on. 24 | # They can then be installed with "rake gems:install" on new installations. 25 | # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3) 26 | # config.gem "bj" 27 | # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" 28 | # config.gem "sqlite3-ruby", :lib => "sqlite3" 29 | # config.gem "aws-s3", :lib => "aws/s3" 30 | 31 | # Only load the plugins named here, in the order given. By default, all plugins 32 | # in vendor/plugins are loaded in alphabetical order. 33 | # :all can be used as a placeholder for all plugins not explicitly named 34 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 35 | 36 | # Add additional load paths for your own custom dirs 37 | # config.load_paths += %W( #{RAILS_ROOT}/extras ) 38 | 39 | # Force all environments to use the same logger level 40 | # (by default production uses :info, the others :debug) 41 | # config.log_level = :debug 42 | 43 | # Make Time.zone default to the specified zone, and make Active Record store time values 44 | # in the database in UTC, and return them converted to the specified local zone. 45 | # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time. 46 | config.time_zone = 'UTC' 47 | 48 | # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. 49 | # All files from config/locales/*.rb,yml are added automatically. 50 | # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] 51 | # config.i18n.default_locale = :de 52 | 53 | # Your secret key for verifying cookie session data integrity. 54 | # If you change this key, all old sessions will become invalid! 55 | # Make sure the secret is at least 30 characters and all random, 56 | # no regular words or you'll be exposed to dictionary attacks. 57 | config.action_controller.session = { 58 | :session_key => '_railslist_session', 59 | :secret => 'b1dc292a193228fb4e63522b41b5bb4989995edf5b8748497e3777174b51da1a66e9cf229686096c4e6a248229d51e566c004418bee8939211d5d0005aa0c337' 60 | } 61 | 62 | # Use the database for sessions instead of the cookie-based default, 63 | # which shouldn't be used to store highly confidential information 64 | # (create the session table with "rake db:sessions:create") 65 | # config.action_controller.session_store = :active_record_store 66 | 67 | # Use SQL instead of Active Record's schema dumper when creating the test database. 68 | # This is necessary if your schema can't be completely dumped by the schema dumper, 69 | # like if you have constraints or database-specific column types 70 | # config.active_record.schema_format = :sql 71 | 72 | # Activate observers that should always be running 73 | # Please note that observers generated using script/generate observer need to have an _observer suffix 74 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 75 | end 76 | 77 | ActionMailer::Base.raise_delivery_errors = true 78 | ActionMailer::Base.perform_deliveries = true 79 | ActionMailer::Base.delivery_method = :smtp 80 | 81 | #Email settings 82 | ActionMailer::Base.smtp_settings = { 83 | :address => "localhost", 84 | :port => 25, 85 | :domain => "yourdomain.com", 86 | :authentication => :login, 87 | :user_name => "mailuser@yourdomain.com", 88 | :password => "mailuserpassword" 89 | } 90 | 91 | require "will_paginate" 92 | require "paperclip" -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # In the development environment your application's code is reloaded on 4 | # every request. This slows down response time but is perfect for development 5 | # since you don't have to restart the webserver when you make code changes. 6 | config.cache_classes = false 7 | 8 | # Log error messages when you accidentally call methods on nil. 9 | config.whiny_nils = true 10 | 11 | # Show full error reports and disable caching 12 | config.action_controller.consider_all_requests_local = true 13 | config.action_view.debug_rjs = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # The production environment is meant for finished, "live" apps. 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Enable threaded mode 8 | # config.threadsafe! 9 | 10 | # Use a different logger for distributed setups 11 | # config.logger = SyslogLogger.new 12 | 13 | # Full error reports are disabled and caching is turned on 14 | config.action_controller.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Use a different cache store in production 18 | # config.cache_store = :mem_cache_store 19 | 20 | # Enable serving of images, stylesheets, and javascripts from an asset server 21 | # config.action_controller.asset_host = "http://assets.example.com" 22 | 23 | # Disable delivery errors, bad email addresses will be ignored 24 | # config.action_mailer.raise_delivery_errors = false 25 | 26 | ActionMailer::Base.raise_delivery_errors = true 27 | ActionMailer::Base.perform_deliveries = true 28 | ActionMailer::Base.delivery_method = :smtp 29 | 30 | #Email settings 31 | ActionMailer::Base.smtp_settings = { 32 | :address => "localhost", 33 | :port => 25, 34 | :domain => "yourdomain.com", 35 | :authentication => :login, 36 | :user_name => "mailuser@yourdomain.com", 37 | :password => "mailuserpassword" 38 | } 39 | 40 | require "will_paginate" 41 | require "paperclip" -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | config.cache_classes = true 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.action_controller.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Disable request forgery protection in test environment 17 | config.action_controller.allow_forgery_protection = false 18 | 19 | # Tell Action Mailer not to deliver emails to the real world. 20 | # The :test delivery method accumulates sent emails in the 21 | # ActionMailer::Base.deliveries array. 22 | config.action_mailer.delivery_method = :test 23 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/new_rails_defaults.rb: -------------------------------------------------------------------------------- 1 | # These settings change the behavior of Rails 2 apps and will be defaults 2 | # for Rails 3. You can remove this initializer when Rails 3 is released. 3 | 4 | if defined?(ActiveRecord) 5 | # Include Active Record class name as root for JSON serialized output. 6 | ActiveRecord::Base.include_root_in_json = true 7 | 8 | # Store the full class name (including module namespace) in STI type column. 9 | ActiveRecord::Base.store_full_sti_class = true 10 | end 11 | 12 | # Use ISO 8601 format for JSON serialized times and dates. 13 | ActiveSupport.use_standard_json_time_format = true 14 | 15 | # Don't escape HTML entities in JSON, leave that for the #json_escape helper. 16 | # if you're including raw json in an HTML page. 17 | ActiveSupport.escape_html_entities_in_json = false -------------------------------------------------------------------------------- /config/initializers/siteconfig.rb: -------------------------------------------------------------------------------- 1 | SITENAME = "railslist.com" 2 | SITEURL = "http://www.railslist.com" 3 | 4 | #city page cities limit 5 | CITYLIMIT=87 -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | ActionController::Routing::Routes.draw do |map| 2 | 3 | map.resource :user 4 | map.resources :cities, :categories, :subcategories, :classifieds 5 | 6 | #main 7 | map.root :controller => "main" 8 | 9 | # route for simple captcha 10 | map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha' 11 | 12 | #admin logout 13 | map.connect '/logout', :controller=>'users', :action=>'destroy' 14 | 15 | 16 | map.connect '/adminsearch', :controller=>'classifieds', :action=>'adminsearch' 17 | 18 | #search 19 | map.connect '/mainsearch', :controller=>'main', :action=>'mainsearch' 20 | map.connect '/:permalink_1/categorysearch', :controller=>'main', :action=>'categorysearch' 21 | 22 | map.connect '/contactadvertiser', :controller=>'main', :action=>'contactadvertiser' 23 | 24 | #city page 25 | map.connect '/:permalink_1', :controller => 'main', :action => 'city' 26 | 27 | #activate, edit classifieds 28 | map.activate '/activate/:activation_code', :controller => 'main', :action => 'activate' 29 | map.edit '/edit/:activation_code', :controller => 'classifieds', :action => 'edit' 30 | map.update '/update/:activation_code', :controller => 'classifieds', :action => 'update' 31 | map.delete '/delete/:activation_code', :controller => 'classifieds', :action => 'destroy' 32 | map.connect '/classifieds/multidelete', :controller=>'classifieds', :action=>'delete_multiple' 33 | 34 | #category page 35 | map.connect '/:permalink_1/:permalink_2', :controller => 'main', :action => 'category' 36 | 37 | #ad page 38 | map.connect '/:permalink_1/:permalink_2/:permalink_3', :controller => 'classifieds', :action => 'show' 39 | 40 | map.connect '*path', :controller => 'main' 41 | end 42 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead of editing this file, 2 | # please use the migrations feature of Active Record to incrementally modify your database, and 3 | # then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your database schema. If you need 6 | # to create the application database on another system, you should be using db:schema:load, not running 7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations 8 | # you'll amass, the slower it'll run and the greater likelihood for issues). 9 | # 10 | # It's strongly recommended to check this file into your version control system. 11 | 12 | ActiveRecord::Schema.define(:version => 0) do 13 | 14 | create_table "categories", :force => true do |t| 15 | t.string "name" 16 | t.string "permalink", :limit => 75 17 | t.integer "parent_id", :default => 0 18 | t.string "type", :limit => 12 19 | t.integer "pos", :default => 0 20 | t.string "pagetitle", :limit => 100, :default => "railslist.com" 21 | t.string "metakey", :default => "railslist.com" 22 | t.string "metadesc", :default => "railslist.com" 23 | t.datetime "created_at" 24 | t.datetime "updated_at" 25 | end 26 | 27 | create_table "cities", :force => true do |t| 28 | t.string "name" 29 | t.string "permalink", :limit => 75 30 | t.string "pagetitle", :limit => 100 31 | t.string "metakey" 32 | t.string "metadesc" 33 | t.datetime "created_at" 34 | t.datetime "updated_at" 35 | end 36 | 37 | create_table "classifieds", :force => true do |t| 38 | t.string "title", :limit => 75 39 | t.text "description" 40 | t.string "location", :limit => 75 41 | t.string "adtype", :limit => 1, :default => "O" 42 | t.string "email", :limit => 75 43 | t.string "phone", :limit => 75 44 | t.string "activation_code", :limit => 40 45 | t.integer "status", :limit => 1, :default => 0 46 | t.integer "category_id" 47 | t.integer "subcategory_id" 48 | t.integer "city_id" 49 | t.string "permalink" 50 | t.string "image_file_name" 51 | t.string "image_content_type" 52 | t.integer "image_file_size" 53 | t.datetime "created_at" 54 | t.datetime "updated_at" 55 | end 56 | 57 | create_table "simple_captcha_data", :force => true do |t| 58 | t.string "key", :limit => 40 59 | t.string "value", :limit => 6 60 | t.datetime "created_at" 61 | t.datetime "updated_at" 62 | end 63 | 64 | end 65 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | To build the guides: 2 | 3 | * Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html) 4 | * Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master) 5 | * Run `rake guides` from the railties directory -------------------------------------------------------------------------------- /log/production.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/log/production.log -------------------------------------------------------------------------------- /log/server.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/log/server.log -------------------------------------------------------------------------------- /log/test.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/log/test.log -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | railslist.com 9 | 21 | 22 | 23 | 24 | 25 |
26 |

railslist.com

27 |

The page you were looking for doesn't exist.

28 |

You may have mistyped the address or the page may have moved.

29 |

you can goto railslist.com and try again!

30 |

if this issue continues, please notify support [at] railslist.com and we'll take a look at it.

31 |
32 | 33 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | railslist.com 9 | 21 | 22 | 23 | 24 | 25 |
26 |

railslist.com

27 |

We're sorry, but something went wrong.

28 |

if this issue continues, please notify support [at] railslist.com and we'll take a look at it.

29 |

you can goto railslist.com and try again!

30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | railslist.com 9 | 21 | 22 | 23 | 24 | 25 |
26 |

railslist.com

27 |

We're sorry, but something went wrong.

28 |

if this issue continues, please notify support [at] railslist.com and we'll take a look at it.

29 |

you can goto railslist.com and try again!

30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /public/dispatch.cgi: -------------------------------------------------------------------------------- 1 | #!C:/rails/ruby/bin/ruby 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch 11 | -------------------------------------------------------------------------------- /public/dispatch.fcgi: -------------------------------------------------------------------------------- 1 | #!C:/rails/ruby/bin/ruby 2 | # 3 | # You may specify the path to the FastCGI crash log (a log of unhandled 4 | # exceptions which forced the FastCGI instance to exit, great for debugging) 5 | # and the number of requests to process before running garbage collection. 6 | # 7 | # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log 8 | # and the GC period is nil (turned off). A reasonable number of requests 9 | # could range from 10-100 depending on the memory footprint of your app. 10 | # 11 | # Example: 12 | # # Default log path, normal GC behavior. 13 | # RailsFCGIHandler.process! 14 | # 15 | # # Default log path, 50 requests between GC. 16 | # RailsFCGIHandler.process! nil, 50 17 | # 18 | # # Custom log path, normal GC behavior. 19 | # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log' 20 | # 21 | require File.dirname(__FILE__) + "/../config/environment" 22 | require 'fcgi_handler' 23 | 24 | RailsFCGIHandler.process! 25 | -------------------------------------------------------------------------------- /public/dispatch.rb: -------------------------------------------------------------------------------- 1 | #!C:/rails/ruby/bin/ruby 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch 11 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/favicon.ico -------------------------------------------------------------------------------- /public/images/3_original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/3_original.jpg -------------------------------------------------------------------------------- /public/images/4_original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/4_original.jpg -------------------------------------------------------------------------------- /public/images/77_original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/77_original.jpg -------------------------------------------------------------------------------- /public/images/8_original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/8_original.jpg -------------------------------------------------------------------------------- /public/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/error.png -------------------------------------------------------------------------------- /public/images/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/info.png -------------------------------------------------------------------------------- /public/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/rails.png -------------------------------------------------------------------------------- /public/images/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/success.png -------------------------------------------------------------------------------- /public/images/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/public/images/warning.png -------------------------------------------------------------------------------- /public/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // Place your application-specific JavaScript functions and classes here 2 | // This file is automatically included by javascript_include_tag :defaults 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /script/about: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" 4 | require 'commands/about' -------------------------------------------------------------------------------- /script/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/console' 4 | -------------------------------------------------------------------------------- /script/dbconsole: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/dbconsole' 4 | -------------------------------------------------------------------------------- /script/destroy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/destroy' 4 | -------------------------------------------------------------------------------- /script/generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/generate' 4 | -------------------------------------------------------------------------------- /script/performance/benchmarker: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/benchmarker' 4 | -------------------------------------------------------------------------------- /script/performance/profiler: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/profiler' 4 | -------------------------------------------------------------------------------- /script/performance/request: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/request' 4 | -------------------------------------------------------------------------------- /script/plugin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/plugin' 4 | -------------------------------------------------------------------------------- /script/process/inspector: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/inspector' 4 | -------------------------------------------------------------------------------- /script/process/reaper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/reaper' 4 | -------------------------------------------------------------------------------- /script/process/spawner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/spawner' 4 | -------------------------------------------------------------------------------- /script/runner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/runner' 4 | -------------------------------------------------------------------------------- /script/server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/server' 4 | -------------------------------------------------------------------------------- /test/functional/main_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MainControllerTest < ActionController::TestCase 4 | # Replace this with your real tests. 5 | test "the truth" do 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/functional/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersControllerTest < ActionController::TestCase 4 | # Replace this with your real tests. 5 | test "the truth" do 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/performance/browsing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'performance_test_help' 3 | 4 | # Profiling results for each test method are written to tmp/performance. 5 | class BrowsingTest < ActionController::PerformanceTest 6 | def test_homepage 7 | get '/' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 3 | require 'test_help' 4 | 5 | class Test::Unit::TestCase 6 | # Transactional fixtures accelerate your tests by wrapping each test method 7 | # in a transaction that's rolled back on completion. This ensures that the 8 | # test database remains unchanged so your fixtures don't have to be reloaded 9 | # between every test method. Fewer database queries means faster tests. 10 | # 11 | # Read Mike Clark's excellent walkthrough at 12 | # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting 13 | # 14 | # Every Active Record database supports transactions except MyISAM tables 15 | # in MySQL. Turn off transactional fixtures in this case; however, if you 16 | # don't care one way or the other, switching from MyISAM to InnoDB tables 17 | # is recommended. 18 | # 19 | # The only drawback to using transactional fixtures is when you actually 20 | # need to test transactions. Since your test is bracketed by a transaction, 21 | # any transactions started in your code will be automatically rolled back. 22 | self.use_transactional_fixtures = true 23 | 24 | # Instantiated fixtures are slow, but give you @david where otherwise you 25 | # would need people(:david). If you don't want to migrate your existing 26 | # test cases which use the @david style and don't mind the speed hit (each 27 | # instantiated fixtures translates to a database query per test method), 28 | # then set this back to true. 29 | self.use_instantiated_fixtures = false 30 | 31 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 32 | # 33 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 34 | # -- they do not yet inherit this setting 35 | fixtures :all 36 | 37 | # Add more helper methods to be used by all tests here... 38 | end 39 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/.gitignore: -------------------------------------------------------------------------------- 1 | /doc 2 | /rails 3 | *.gem 4 | /coverage 5 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/.manifest: -------------------------------------------------------------------------------- 1 | CHANGELOG.rdoc 2 | LICENSE 3 | README.rdoc 4 | Rakefile 5 | examples/apple-circle.gif 6 | examples/index.haml 7 | examples/index.html 8 | examples/pagination.css 9 | examples/pagination.sass 10 | init.rb 11 | lib/will_paginate.rb 12 | lib/will_paginate/array.rb 13 | lib/will_paginate/collection.rb 14 | lib/will_paginate/core_ext.rb 15 | lib/will_paginate/finder.rb 16 | lib/will_paginate/named_scope.rb 17 | lib/will_paginate/named_scope_patch.rb 18 | lib/will_paginate/version.rb 19 | lib/will_paginate/view_helpers.rb 20 | test/boot.rb 21 | test/collection_test.rb 22 | test/console 23 | test/database.yml 24 | test/finder_test.rb 25 | test/fixtures/admin.rb 26 | test/fixtures/developer.rb 27 | test/fixtures/developers_projects.yml 28 | test/fixtures/project.rb 29 | test/fixtures/projects.yml 30 | test/fixtures/replies.yml 31 | test/fixtures/reply.rb 32 | test/fixtures/schema.rb 33 | test/fixtures/topic.rb 34 | test/fixtures/topics.yml 35 | test/fixtures/user.rb 36 | test/fixtures/users.yml 37 | test/helper.rb 38 | test/lib/activerecord_test_case.rb 39 | test/lib/activerecord_test_connector.rb 40 | test/lib/load_fixtures.rb 41 | test/lib/view_test_process.rb 42 | test/tasks.rake 43 | test/view_test.rb -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 PJ Hyett and Mislav Marohnić 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/README.rdoc: -------------------------------------------------------------------------------- 1 | = WillPaginate 2 | 3 | Pagination is just limiting the number of records displayed. Why should you let 4 | it get in your way while developing, then? This plugin makes magic happen. Did 5 | you ever want to be able to do just this on a model: 6 | 7 | Post.paginate :page => 1, :order => 'created_at DESC' 8 | 9 | ... and then render the page links with a single view helper? Well, now you 10 | can. 11 | 12 | Some resources to get you started: 13 | 14 | * {Installation instructions}[http://github.com/mislav/will_paginate/wikis/installation] 15 | on {the wiki}[http://github.com/mislav/will_paginate/wikis] 16 | * Your mind reels with questions? Join our 17 | {Google group}[http://groups.google.com/group/will_paginate]. 18 | * {How to report bugs}[http://github.com/mislav/will_paginate/wikis/report-bugs] 19 | 20 | 21 | == Example usage 22 | 23 | Use a paginate finder in the controller: 24 | 25 | @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC' 26 | 27 | Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the 28 | records. Don't forget to tell it which page you want, or it will complain! 29 | Read more on WillPaginate::Finder::ClassMethods. 30 | 31 | Render the posts in your view like you would normally do. When you need to render 32 | pagination, just stick this in: 33 | 34 | <%= will_paginate @posts %> 35 | 36 | You're done. (You can find the option list at WillPaginate::ViewHelpers.) 37 | 38 | How does it know how much items to fetch per page? It asks your model by calling 39 | its per_page class method. You can define it like this: 40 | 41 | class Post < ActiveRecord::Base 42 | cattr_reader :per_page 43 | @@per_page = 50 44 | end 45 | 46 | ... or like this: 47 | 48 | class Post < ActiveRecord::Base 49 | def self.per_page 50 | 50 51 | end 52 | end 53 | 54 | ... or don't worry about it at all. WillPaginate defines it to be 30 by default. 55 | But you can always specify the count explicitly when calling +paginate+: 56 | 57 | @posts = Post.paginate :page => params[:page], :per_page => 50 58 | 59 | The +paginate+ finder wraps the original finder and returns your resultset that now has 60 | some new properties. You can use the collection as you would with any ActiveRecord 61 | resultset. WillPaginate view helpers also need that object to be able to render pagination: 62 | 63 |
    64 | <% for post in @posts -%> 65 |
  1. Render `post` in some nice way.
  2. 66 | <% end -%> 67 |
68 | 69 |

Now let's render us some pagination!

70 | <%= will_paginate @posts %> 71 | 72 | More detailed documentation: 73 | 74 | * WillPaginate::Finder::ClassMethods for pagination on your models; 75 | * WillPaginate::ViewHelpers for your views. 76 | 77 | 78 | == Authors and credits 79 | 80 | Authors:: Mislav Marohnić, PJ Hyett 81 | Original announcement:: http://errtheblog.com/post/929 82 | Original PHP source:: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php 83 | 84 | All these people helped making will_paginate what it is now with their code 85 | contributions or just simply awesome ideas: 86 | 87 | Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence 88 | Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs 89 | van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel, 90 | Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris Eppstein, 91 | Denis Barushev, Ben Pickles. 92 | 93 | 94 | == Usable pagination in the UI 95 | 96 | There are some CSS styles to get you started in the "examples/" directory. They 97 | are {showcased online here}[http://mislav.caboo.se/static/will_paginate/]. 98 | 99 | More reading about pagination as design pattern: 100 | 101 | * {Pagination 101}[http://kurafire.net/log/archive/2007/06/22/pagination-101] 102 | * {Pagination gallery}[http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/] 103 | * {Pagination on Yahoo Design Pattern Library}[http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination] 104 | 105 | Want to discuss, request features, ask questions? Join the 106 | {Google group}[http://groups.google.com/group/will_paginate]. 107 | 108 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | begin 3 | hanna_dir = '/Users/mislav/Projects/Hanna/lib' 4 | $:.unshift hanna_dir if File.exists? hanna_dir 5 | require 'hanna/rdoctask' 6 | rescue LoadError 7 | require 'rake' 8 | require 'rake/rdoctask' 9 | end 10 | load 'test/tasks.rake' 11 | 12 | desc 'Default: run unit tests.' 13 | task :default => :test 14 | 15 | desc 'Generate RDoc documentation for the will_paginate plugin.' 16 | Rake::RDocTask.new(:rdoc) do |rdoc| 17 | rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG.rdoc'). 18 | include('lib/**/*.rb'). 19 | exclude('lib/will_paginate/named_scope*'). 20 | exclude('lib/will_paginate/array.rb'). 21 | exclude('lib/will_paginate/version.rb') 22 | 23 | rdoc.main = "README.rdoc" # page to start on 24 | rdoc.title = "will_paginate documentation" 25 | 26 | rdoc.rdoc_dir = 'doc' # rdoc output folder 27 | rdoc.options << '--inline-source' << '--charset=UTF-8' 28 | rdoc.options << '--webcvs=http://github.com/mislav/will_paginate/tree/master/' 29 | end 30 | 31 | desc %{Update ".manifest" with the latest list of project filenames. Respect\ 32 | .gitignore by excluding everything that git ignores. Update `files` and\ 33 | `test_files` arrays in "*.gemspec" file if it's present.} 34 | task :manifest do 35 | list = `git ls-files --full-name --exclude=*.gemspec --exclude=.*`.chomp.split("\n") 36 | 37 | if spec_file = Dir['*.gemspec'].first 38 | spec = File.read spec_file 39 | spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do 40 | assignment = $1 41 | bunch = $2 ? list.grep(/^test\//) : list 42 | '%s%%w(%s)' % [assignment, bunch.join(' ')] 43 | end 44 | 45 | File.open(spec_file, 'w') { |f| f << spec } 46 | end 47 | File.open('.manifest', 'w') { |f| f << list.join("\n") } 48 | end 49 | 50 | task :examples do 51 | %x(haml examples/index.haml examples/index.html) 52 | %x(sass examples/pagination.sass examples/pagination.css) 53 | end 54 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/examples/apple-circle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/mislav-will_paginate/examples/apple-circle.gif -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/examples/index.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html 3 | %head 4 | %title Samples of pagination styling for will_paginate 5 | %link{ :rel => 'stylesheet', :type => 'text/css', :href => 'pagination.css' } 6 | %style{ :type => 'text/css' } 7 | :sass 8 | html 9 | :margin 0 10 | :padding 0 11 | :background #999 12 | :font normal 76% "Lucida Grande", Verdana, Helvetica, sans-serif 13 | body 14 | :margin 2em 15 | :padding 2em 16 | :border 2px solid gray 17 | :background white 18 | :color #222 19 | h1 20 | :font-size 2em 21 | :font-weight normal 22 | :margin 0 0 1em 0 23 | h2 24 | :font-size 1.4em 25 | :margin 1em 0 .5em 0 26 | pre 27 | :font-size 13px 28 | :font-family Monaco, "DejaVu Sans Mono", "Bitstream Vera Mono", "Courier New", monospace 29 | 30 | - pagination = '« Previous 1 3 4 5 6 7 8 9 29 30 ' 31 | - pagination_no_page_links = '« Previous ' 32 | 33 | %body 34 | %h1 Samples of pagination styling for will_paginate 35 | %p 36 | Find these styles in "examples/pagination.css" of will_paginate library. 37 | There is a Sass version of it for all you sassy people. 38 | %p 39 | Read about good rules for pagination: 40 | %a{ :href => 'http://kurafire.net/log/archive/2007/06/22/pagination-101' } Pagination 101 41 | %p 42 | %em Warning: 43 | page links below don't lead anywhere (so don't click on them). 44 | 45 | %h2 Unstyled pagination (ewww!) 46 | %div= pagination 47 | 48 | %h2 Digg.com 49 | .digg_pagination= pagination 50 | 51 | %h2 Digg-style, no page links 52 | .digg_pagination= pagination_no_page_links 53 | %p Code that renders this: 54 | %pre= '%s' % %[<%= will_paginate @posts, :page_links => false %>].gsub('<', '<').gsub('>', '>') 55 | 56 | %h2 Digg-style, extra content 57 | .digg_pagination 58 | .page_info Displaying entries 1 - 6 of 180 in total 59 | = pagination 60 | %p Code that renders this: 61 | %pre= '%s' % %[
\n
\n <%= page_entries_info @posts %>\n
\n <%= will_paginate @posts, :container => false %>\n
].gsub('<', '<').gsub('>', '>') 62 | 63 | %h2 Apple.com store 64 | .apple_pagination= pagination 65 | 66 | %h2 Flickr.com 67 | .flickr_pagination 68 | = pagination 69 | .page_info (118 photos) 70 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/examples/pagination.css: -------------------------------------------------------------------------------- 1 | .digg_pagination { 2 | background: white; 3 | /* self-clearing method: */ } 4 | .digg_pagination a, .digg_pagination span { 5 | padding: .2em .5em; 6 | display: block; 7 | float: left; 8 | margin-right: 1px; } 9 | .digg_pagination span.disabled { 10 | color: #999; 11 | border: 1px solid #DDD; } 12 | .digg_pagination span.current { 13 | font-weight: bold; 14 | background: #2E6AB1; 15 | color: white; 16 | border: 1px solid #2E6AB1; } 17 | .digg_pagination a { 18 | text-decoration: none; 19 | color: #105CB6; 20 | border: 1px solid #9AAFE5; } 21 | .digg_pagination a:hover, .digg_pagination a:focus { 22 | color: #003; 23 | border-color: #003; } 24 | .digg_pagination .page_info { 25 | background: #2E6AB1; 26 | color: white; 27 | padding: .4em .6em; 28 | width: 22em; 29 | margin-bottom: .3em; 30 | text-align: center; } 31 | .digg_pagination .page_info b { 32 | color: #003; 33 | background: #6aa6ed; 34 | padding: .1em .25em; } 35 | .digg_pagination:after { 36 | content: "."; 37 | display: block; 38 | height: 0; 39 | clear: both; 40 | visibility: hidden; } 41 | * html .digg_pagination { 42 | height: 1%; } 43 | *:first-child+html .digg_pagination { 44 | overflow: hidden; } 45 | 46 | .apple_pagination { 47 | background: #F1F1F1; 48 | border: 1px solid #E5E5E5; 49 | text-align: center; 50 | padding: 1em; } 51 | .apple_pagination a, .apple_pagination span { 52 | padding: .2em .3em; } 53 | .apple_pagination span.disabled { 54 | color: #AAA; } 55 | .apple_pagination span.current { 56 | font-weight: bold; 57 | background: transparent url(apple-circle.gif) no-repeat 50% 50%; } 58 | .apple_pagination a { 59 | text-decoration: none; 60 | color: black; } 61 | .apple_pagination a:hover, .apple_pagination a:focus { 62 | text-decoration: underline; } 63 | 64 | .flickr_pagination { 65 | text-align: center; 66 | padding: .3em; } 67 | .flickr_pagination a, .flickr_pagination span { 68 | padding: .2em .5em; } 69 | .flickr_pagination span.disabled { 70 | color: #AAA; } 71 | .flickr_pagination span.current { 72 | font-weight: bold; 73 | color: #FF0084; } 74 | .flickr_pagination a { 75 | border: 1px solid #DDDDDD; 76 | color: #0063DC; 77 | text-decoration: none; } 78 | .flickr_pagination a:hover, .flickr_pagination a:focus { 79 | border-color: #003366; 80 | background: #0063DC; 81 | color: white; } 82 | .flickr_pagination .page_info { 83 | color: #aaa; 84 | padding-top: .8em; } 85 | .flickr_pagination .prev_page, .flickr_pagination .next_page { 86 | border-width: 2px; } 87 | .flickr_pagination .prev_page { 88 | margin-right: 1em; } 89 | .flickr_pagination .next_page { 90 | margin-left: 1em; } 91 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/examples/pagination.sass: -------------------------------------------------------------------------------- 1 | .digg_pagination 2 | :background white 3 | a, span 4 | :padding .2em .5em 5 | :display block 6 | :float left 7 | :margin-right 1px 8 | span.disabled 9 | :color #999 10 | :border 1px solid #DDD 11 | span.current 12 | :font-weight bold 13 | :background #2E6AB1 14 | :color white 15 | :border 1px solid #2E6AB1 16 | a 17 | :text-decoration none 18 | :color #105CB6 19 | :border 1px solid #9AAFE5 20 | &:hover, &:focus 21 | :color #003 22 | :border-color #003 23 | .page_info 24 | :background #2E6AB1 25 | :color white 26 | :padding .4em .6em 27 | :width 22em 28 | :margin-bottom .3em 29 | :text-align center 30 | b 31 | :color #003 32 | :background = #2E6AB1 + 60 33 | :padding .1em .25em 34 | 35 | /* self-clearing method: 36 | &:after 37 | :content "." 38 | :display block 39 | :height 0 40 | :clear both 41 | :visibility hidden 42 | * html & 43 | :height 1% 44 | *:first-child+html & 45 | :overflow hidden 46 | 47 | .apple_pagination 48 | :background #F1F1F1 49 | :border 1px solid #E5E5E5 50 | :text-align center 51 | :padding 1em 52 | a, span 53 | :padding .2em .3em 54 | span.disabled 55 | :color #AAA 56 | span.current 57 | :font-weight bold 58 | :background transparent url(apple-circle.gif) no-repeat 50% 50% 59 | a 60 | :text-decoration none 61 | :color black 62 | &:hover, &:focus 63 | :text-decoration underline 64 | 65 | .flickr_pagination 66 | :text-align center 67 | :padding .3em 68 | a, span 69 | :padding .2em .5em 70 | span.disabled 71 | :color #AAA 72 | span.current 73 | :font-weight bold 74 | :color #FF0084 75 | a 76 | :border 1px solid #DDDDDD 77 | :color #0063DC 78 | :text-decoration none 79 | &:hover, &:focus 80 | :border-color #003366 81 | :background #0063DC 82 | :color white 83 | .page_info 84 | :color #aaa 85 | :padding-top .8em 86 | .prev_page, .next_page 87 | :border-width 2px 88 | .prev_page 89 | :margin-right 1em 90 | .next_page 91 | :margin-left 1em 92 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/init.rb: -------------------------------------------------------------------------------- 1 | require 'will_paginate' 2 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/lib/will_paginate.rb: -------------------------------------------------------------------------------- 1 | require 'active_support' 2 | require 'will_paginate/core_ext' 3 | 4 | # = You *will* paginate! 5 | # 6 | # First read about WillPaginate::Finder::ClassMethods, then see 7 | # WillPaginate::ViewHelpers. The magical array you're handling in-between is 8 | # WillPaginate::Collection. 9 | # 10 | # Happy paginating! 11 | module WillPaginate 12 | class << self 13 | # shortcut for enable_actionpack and enable_activerecord combined 14 | def enable 15 | enable_actionpack 16 | enable_activerecord 17 | end 18 | 19 | # hooks WillPaginate::ViewHelpers into ActionView::Base 20 | def enable_actionpack 21 | return if ActionView::Base.instance_methods.include_method? :will_paginate 22 | require 'will_paginate/view_helpers' 23 | ActionView::Base.send :include, ViewHelpers 24 | 25 | if defined?(ActionController::Base) and ActionController::Base.respond_to? :rescue_responses 26 | ActionController::Base.rescue_responses['WillPaginate::InvalidPage'] = :not_found 27 | end 28 | end 29 | 30 | # hooks WillPaginate::Finder into ActiveRecord::Base and classes that deal 31 | # with associations 32 | def enable_activerecord 33 | return if ActiveRecord::Base.respond_to? :paginate 34 | require 'will_paginate/finder' 35 | ActiveRecord::Base.send :include, Finder 36 | 37 | # support pagination on associations 38 | a = ActiveRecord::Associations 39 | returning([ a::AssociationCollection ]) { |classes| 40 | # detect http://dev.rubyonrails.org/changeset/9230 41 | unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation 42 | classes << a::HasManyThroughAssociation 43 | end 44 | }.each do |klass| 45 | klass.send :include, Finder::ClassMethods 46 | klass.class_eval { alias_method_chain :method_missing, :paginate } 47 | end 48 | 49 | # monkeypatch Rails ticket #2189: "count breaks has_many :through" 50 | ActiveRecord::Base.class_eval do 51 | protected 52 | def self.construct_count_options_from_args(*args) 53 | result = super 54 | result[0] = '*' if result[0].is_a?(String) and result[0] =~ /\.\*$/ 55 | result 56 | end 57 | end 58 | end 59 | 60 | # Enable named_scope, a feature of Rails 2.1, even if you have older Rails 61 | # (tested on Rails 2.0.2 and 1.2.6). 62 | # 63 | # You can pass +false+ for +patch+ parameter to skip monkeypatching 64 | # *associations*. Use this if you feel that named_scope broke 65 | # has_many, has_many :through or has_and_belongs_to_many associations in 66 | # your app. By passing +false+, you can still use named_scope in 67 | # your models, but not through associations. 68 | def enable_named_scope(patch = true) 69 | return if defined? ActiveRecord::NamedScope 70 | require 'will_paginate/named_scope' 71 | require 'will_paginate/named_scope_patch' if patch 72 | 73 | ActiveRecord::Base.send :include, WillPaginate::NamedScope 74 | end 75 | end 76 | 77 | module Deprecation # :nodoc: 78 | extend ActiveSupport::Deprecation 79 | 80 | def self.warn(message, callstack = caller) 81 | message = 'WillPaginate: ' + message.strip.gsub(/\s+/, ' ') 82 | ActiveSupport::Deprecation.warn(message, callstack) 83 | end 84 | end 85 | end 86 | 87 | if defined? Rails 88 | WillPaginate.enable_activerecord if defined? ActiveRecord 89 | WillPaginate.enable_actionpack if defined? ActionController 90 | end 91 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/lib/will_paginate/array.rb: -------------------------------------------------------------------------------- 1 | require 'will_paginate/collection' 2 | 3 | # http://www.desimcadam.com/archives/8 4 | Array.class_eval do 5 | def paginate(options = {}) 6 | raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options 7 | 8 | WillPaginate::Collection.create( 9 | options[:page] || 1, 10 | options[:per_page] || 30, 11 | options[:total_entries] || self.length 12 | ) { |pager| 13 | pager.replace self[pager.offset, pager.per_page].to_a 14 | } 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/lib/will_paginate/core_ext.rb: -------------------------------------------------------------------------------- 1 | require 'set' 2 | require 'will_paginate/array' 3 | 4 | # helper to check for method existance in ruby 1.8- and 1.9-compatible way 5 | # because `methods`, `instance_methods` and others return strings in 1.8 and symbols in 1.9 6 | # 7 | # ['foo', 'bar'].include_method?(:foo) # => true 8 | class Array 9 | def include_method?(name) 10 | name = name.to_sym 11 | !!(find { |item| item.to_sym == name }) 12 | end 13 | end 14 | 15 | unless Hash.instance_methods.include_method? :except 16 | Hash.class_eval do 17 | # Returns a new hash without the given keys. 18 | def except(*keys) 19 | rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) 20 | reject { |key,| rejected.include?(key) } 21 | end 22 | 23 | # Replaces the hash without only the given keys. 24 | def except!(*keys) 25 | replace(except(*keys)) 26 | end 27 | end 28 | end 29 | 30 | unless Hash.instance_methods.include_method? :slice 31 | Hash.class_eval do 32 | # Returns a new hash with only the given keys. 33 | def slice(*keys) 34 | allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) 35 | reject { |key,| !allowed.include?(key) } 36 | end 37 | 38 | # Replaces the hash with only the given keys. 39 | def slice!(*keys) 40 | replace(slice(*keys)) 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/lib/will_paginate/named_scope_patch.rb: -------------------------------------------------------------------------------- 1 | ActiveRecord::Associations::AssociationProxy.class_eval do 2 | protected 3 | def with_scope(*args) 4 | @reflection.klass.send(:with_scope, *args) { |*a| yield(*a) if block_given? } 5 | end 6 | end 7 | 8 | [ ActiveRecord::Associations::AssociationCollection, 9 | ActiveRecord::Associations::HasManyThroughAssociation ].each do |klass| 10 | klass.class_eval do 11 | protected 12 | alias :method_missing_without_scopes :method_missing_without_paginate 13 | def method_missing_without_paginate(method, *args) 14 | if @reflection.klass.scopes.include?(method) 15 | @reflection.klass.scopes[method].call(self, *args) { |*a| yield(*a) if block_given? } 16 | else 17 | method_missing_without_scopes(method, *args) { |*a| yield(*a) if block_given? } 18 | end 19 | end 20 | end 21 | end 22 | 23 | # Rails 1.2.6 24 | ActiveRecord::Associations::HasAndBelongsToManyAssociation.class_eval do 25 | protected 26 | def method_missing(method, *args) 27 | if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) 28 | super 29 | elsif @reflection.klass.scopes.include?(method) 30 | @reflection.klass.scopes[method].call(self, *args) 31 | else 32 | @reflection.klass.with_scope(:find => { :conditions => @finder_sql, :joins => @join_sql, :readonly => false }) do 33 | @reflection.klass.send(method, *args) { |*a| yield(*a) if block_given? } 34 | end 35 | end 36 | end 37 | end if ActiveRecord::Base.respond_to? :find_first 38 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/lib/will_paginate/version.rb: -------------------------------------------------------------------------------- 1 | module WillPaginate 2 | module VERSION 3 | MAJOR = 2 4 | MINOR = 3 5 | TINY = 11 6 | 7 | STRING = [MAJOR, MINOR, TINY].join('.') 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/boot.rb: -------------------------------------------------------------------------------- 1 | plugin_root = File.join(File.dirname(__FILE__), '..') 2 | version = ENV['RAILS_VERSION'] 3 | version = nil if version and version == "" 4 | 5 | # first look for a symlink to a copy of the framework 6 | if !version and framework_root = ["#{plugin_root}/rails", "#{plugin_root}/../../rails"].find { |p| File.directory? p } 7 | puts "found framework root: #{framework_root}" 8 | # this allows for a plugin to be tested outside of an app and without Rails gems 9 | $:.unshift "#{framework_root}/activesupport/lib", "#{framework_root}/activerecord/lib", "#{framework_root}/actionpack/lib" 10 | else 11 | # simply use installed gems if available 12 | puts "using Rails#{version ? ' ' + version : nil} gems" 13 | require 'rubygems' 14 | 15 | if version 16 | gem 'rails', version 17 | else 18 | gem 'actionpack' 19 | gem 'activerecord' 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/collection_test.rb: -------------------------------------------------------------------------------- 1 | require 'helper' 2 | require 'will_paginate/array' 3 | 4 | class ArrayPaginationTest < Test::Unit::TestCase 5 | 6 | def setup ; end 7 | 8 | def test_simple 9 | collection = ('a'..'e').to_a 10 | 11 | [{ :page => 1, :per_page => 3, :expected => %w( a b c ) }, 12 | { :page => 2, :per_page => 3, :expected => %w( d e ) }, 13 | { :page => 1, :per_page => 5, :expected => %w( a b c d e ) }, 14 | { :page => 3, :per_page => 5, :expected => [] }, 15 | ]. 16 | each do |conditions| 17 | expected = conditions.delete :expected 18 | assert_equal expected, collection.paginate(conditions) 19 | end 20 | end 21 | 22 | def test_defaults 23 | result = (1..50).to_a.paginate 24 | assert_equal 1, result.current_page 25 | assert_equal 30, result.size 26 | end 27 | 28 | def test_deprecated_api 29 | assert_raise(ArgumentError) { [].paginate(2) } 30 | assert_raise(ArgumentError) { [].paginate(2, 10) } 31 | end 32 | 33 | def test_total_entries_has_precedence 34 | result = %w(a b c).paginate :total_entries => 5 35 | assert_equal 5, result.total_entries 36 | end 37 | 38 | def test_argument_error_with_params_and_another_argument 39 | assert_raise ArgumentError do 40 | [].paginate({}, 5) 41 | end 42 | end 43 | 44 | def test_paginated_collection 45 | entries = %w(a b c) 46 | collection = create(2, 3, 10) do |pager| 47 | assert_equal entries, pager.replace(entries) 48 | end 49 | 50 | assert_equal entries, collection 51 | assert_respond_to_all collection, %w(total_pages each offset size current_page per_page total_entries) 52 | assert_kind_of Array, collection 53 | assert_instance_of Array, collection.entries 54 | assert_equal 3, collection.offset 55 | assert_equal 4, collection.total_pages 56 | assert !collection.out_of_bounds? 57 | end 58 | 59 | def test_previous_next_pages 60 | collection = create(1, 1, 3) 61 | assert_nil collection.previous_page 62 | assert_equal 2, collection.next_page 63 | 64 | collection = create(2, 1, 3) 65 | assert_equal 1, collection.previous_page 66 | assert_equal 3, collection.next_page 67 | 68 | collection = create(3, 1, 3) 69 | assert_equal 2, collection.previous_page 70 | assert_nil collection.next_page 71 | end 72 | 73 | def test_out_of_bounds 74 | entries = create(2, 3, 2){} 75 | assert entries.out_of_bounds? 76 | 77 | entries = create(1, 3, 2){} 78 | assert !entries.out_of_bounds? 79 | end 80 | 81 | def test_guessing_total_count 82 | entries = create do |pager| 83 | # collection is shorter than limit 84 | pager.replace array 85 | end 86 | assert_equal 8, entries.total_entries 87 | 88 | entries = create(2, 5, 10) do |pager| 89 | # collection is shorter than limit, but we have an explicit count 90 | pager.replace array 91 | end 92 | assert_equal 10, entries.total_entries 93 | 94 | entries = create do |pager| 95 | # collection is the same as limit; we can't guess 96 | pager.replace array(5) 97 | end 98 | assert_equal nil, entries.total_entries 99 | 100 | entries = create do |pager| 101 | # collection is empty; we can't guess 102 | pager.replace array(0) 103 | end 104 | assert_equal nil, entries.total_entries 105 | 106 | entries = create(1) do |pager| 107 | # collection is empty and we're on page 1, 108 | # so the whole thing must be empty, too 109 | pager.replace array(0) 110 | end 111 | assert_equal 0, entries.total_entries 112 | end 113 | 114 | def test_invalid_page 115 | bad_inputs = [0, -1, nil, '', 'Schnitzel'] 116 | 117 | bad_inputs.each do |bad| 118 | assert_raise(WillPaginate::InvalidPage) { create bad } 119 | end 120 | end 121 | 122 | def test_invalid_per_page_setting 123 | assert_raise(ArgumentError) { create(1, -1) } 124 | end 125 | 126 | def test_page_count_was_removed 127 | assert_raise(NoMethodError) { create.page_count } 128 | # It's `total_pages` now. 129 | end 130 | 131 | private 132 | def create(page = 2, limit = 5, total = nil, &block) 133 | if block_given? 134 | WillPaginate::Collection.create(page, limit, total, &block) 135 | else 136 | WillPaginate::Collection.new(page, limit, total) 137 | end 138 | end 139 | 140 | def array(size = 3) 141 | Array.new(size) 142 | end 143 | end 144 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' 3 | libs = [] 4 | 5 | libs << 'irb/completion' 6 | libs << File.join('lib', 'load_fixtures') 7 | 8 | exec "#{irb} -Ilib:test#{libs.map{ |l| " -r #{l}" }.join} --simple-prompt" 9 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/database.yml: -------------------------------------------------------------------------------- 1 | sqlite3: 2 | database: ":memory:" 3 | adapter: sqlite3 4 | timeout: 500 5 | 6 | sqlite2: 7 | database: ":memory:" 8 | adapter: sqlite2 9 | 10 | mysql: 11 | adapter: mysql 12 | username: root 13 | password: 14 | encoding: utf8 15 | database: will_paginate_unittest 16 | 17 | postgres: 18 | adapter: postgresql 19 | username: mislav 20 | password: 21 | database: will_paginate_unittest 22 | min_messages: warning 23 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/admin.rb: -------------------------------------------------------------------------------- 1 | class Admin < User 2 | has_many :companies, :finder_sql => 'SELECT * FROM companies' 3 | end 4 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/developer.rb: -------------------------------------------------------------------------------- 1 | class Developer < User 2 | has_and_belongs_to_many :projects, :include => :topics, :order => 'projects.name' 3 | 4 | def self.with_poor_ones(&block) 5 | with_scope :find => { :conditions => ['salary <= ?', 80000], :order => 'salary' } do 6 | yield 7 | end 8 | end 9 | 10 | named_scope :distinct, :select => 'DISTINCT `users`.*' 11 | named_scope :poor, :conditions => ['salary <= ?', 80000], :order => 'salary' 12 | 13 | def self.per_page() 10 end 14 | end 15 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/developers_projects.yml: -------------------------------------------------------------------------------- 1 | david_action_controller: 2 | developer_id: 1 3 | project_id: 2 4 | joined_on: 2004-10-10 5 | 6 | david_active_record: 7 | developer_id: 1 8 | project_id: 1 9 | joined_on: 2004-10-10 10 | 11 | jamis_active_record: 12 | developer_id: 2 13 | project_id: 1 -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/project.rb: -------------------------------------------------------------------------------- 1 | class Project < ActiveRecord::Base 2 | has_and_belongs_to_many :developers, :uniq => true 3 | 4 | has_many :topics 5 | # :finder_sql => 'SELECT * FROM topics WHERE (topics.project_id = #{id})', 6 | # :counter_sql => 'SELECT COUNT(*) FROM topics WHERE (topics.project_id = #{id})' 7 | 8 | has_many :replies, :through => :topics do 9 | def find_recent(params = {}) 10 | with_scope :find => { :conditions => ['replies.created_at > ?', 15.minutes.ago] } do 11 | find :all, params 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/projects.yml: -------------------------------------------------------------------------------- 1 | active_record: 2 | id: 1 3 | name: Active Record 4 | action_controller: 5 | id: 2 6 | name: Active Controller 7 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/replies.yml: -------------------------------------------------------------------------------- 1 | witty_retort: 2 | id: 1 3 | topic_id: 1 4 | content: Birdman is better! 5 | created_at: <%= 6.hours.ago.to_s(:db) %> 6 | 7 | another: 8 | id: 2 9 | topic_id: 2 10 | content: Nuh uh! 11 | created_at: <%= 1.hour.ago.to_s(:db) %> 12 | 13 | spam: 14 | id: 3 15 | topic_id: 1 16 | content: Nice site! 17 | created_at: <%= 1.hour.ago.to_s(:db) %> 18 | 19 | decisive: 20 | id: 4 21 | topic_id: 4 22 | content: "I'm getting to the bottom of this" 23 | created_at: <%= 30.minutes.ago.to_s(:db) %> 24 | 25 | brave: 26 | id: 5 27 | topic_id: 4 28 | content: "AR doesn't scare me a bit" 29 | created_at: <%= 10.minutes.ago.to_s(:db) %> 30 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/reply.rb: -------------------------------------------------------------------------------- 1 | class Reply < ActiveRecord::Base 2 | belongs_to :topic, :include => [:replies] 3 | 4 | named_scope :recent, :conditions => ['replies.created_at > ?', 15.minutes.ago] 5 | 6 | validates_presence_of :content 7 | end 8 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/schema.rb: -------------------------------------------------------------------------------- 1 | ActiveRecord::Schema.define do 2 | 3 | create_table "users", :force => true do |t| 4 | t.column "name", :text 5 | t.column "salary", :integer, :default => 70000 6 | t.column "created_at", :datetime 7 | t.column "updated_at", :datetime 8 | t.column "type", :text 9 | end 10 | 11 | create_table "projects", :force => true do |t| 12 | t.column "name", :text 13 | end 14 | 15 | create_table "developers_projects", :id => false, :force => true do |t| 16 | t.column "developer_id", :integer, :null => false 17 | t.column "project_id", :integer, :null => false 18 | t.column "joined_on", :date 19 | t.column "access_level", :integer, :default => 1 20 | end 21 | 22 | create_table "topics", :force => true do |t| 23 | t.column "project_id", :integer 24 | t.column "title", :string 25 | t.column "subtitle", :string 26 | t.column "content", :text 27 | t.column "created_at", :datetime 28 | t.column "updated_at", :datetime 29 | end 30 | 31 | create_table "replies", :force => true do |t| 32 | t.column "content", :text 33 | t.column "created_at", :datetime 34 | t.column "updated_at", :datetime 35 | t.column "topic_id", :integer 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/topic.rb: -------------------------------------------------------------------------------- 1 | class Topic < ActiveRecord::Base 2 | has_many :replies, :dependent => :destroy, :order => 'replies.created_at DESC' 3 | belongs_to :project 4 | 5 | named_scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%'] 6 | 7 | named_scope :with_replies_starting_with, lambda { |text| 8 | { :conditions => "replies.content LIKE '#{text}%' ", :include => :replies } 9 | } 10 | end 11 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/topics.yml: -------------------------------------------------------------------------------- 1 | futurama: 2 | id: 1 3 | title: Isnt futurama awesome? 4 | subtitle: It really is, isnt it. 5 | content: I like futurama 6 | created_at: <%= 1.day.ago.to_s(:db) %> 7 | updated_at: 8 | 9 | harvey_birdman: 10 | id: 2 11 | title: Harvey Birdman is the king of all men 12 | subtitle: yup 13 | content: He really is 14 | created_at: <%= 2.hours.ago.to_s(:db) %> 15 | updated_at: 16 | 17 | rails: 18 | id: 3 19 | project_id: 1 20 | title: Rails is nice 21 | subtitle: It makes me happy 22 | content: except when I have to hack internals to fix pagination. even then really. 23 | created_at: <%= 20.minutes.ago.to_s(:db) %> 24 | 25 | ar: 26 | id: 4 27 | project_id: 1 28 | title: ActiveRecord sometimes freaks me out 29 | content: "I mean, what's the deal with eager loading?" 30 | created_at: <%= 15.minutes.ago.to_s(:db) %> 31 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | david: 2 | id: 1 3 | name: David 4 | salary: 80000 5 | type: Developer 6 | 7 | jamis: 8 | id: 2 9 | name: Jamis 10 | salary: 150000 11 | type: Developer 12 | 13 | <% for digit in 3..10 %> 14 | dev_<%= digit %>: 15 | id: <%= digit %> 16 | name: fixture_<%= digit %> 17 | salary: 100000 18 | type: Developer 19 | <% end %> 20 | 21 | poor_jamis: 22 | id: 11 23 | name: Jamis 24 | salary: 9000 25 | type: Developer 26 | 27 | admin: 28 | id: 12 29 | name: admin 30 | type: Admin 31 | 32 | goofy: 33 | id: 13 34 | name: Goofy 35 | type: Admin 36 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/helper.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | require 'rubygems' 3 | 4 | # gem install redgreen for colored test output 5 | begin require 'redgreen'; rescue LoadError; end 6 | 7 | require 'boot' unless defined?(ActiveRecord) 8 | 9 | class Test::Unit::TestCase 10 | protected 11 | def assert_respond_to_all object, methods 12 | methods.each do |method| 13 | [method.to_s, method.to_sym].each { |m| assert_respond_to object, m } 14 | end 15 | end 16 | 17 | def collect_deprecations 18 | old_behavior = WillPaginate::Deprecation.behavior 19 | deprecations = [] 20 | WillPaginate::Deprecation.behavior = Proc.new do |message, callstack| 21 | deprecations << message 22 | end 23 | result = yield 24 | [result, deprecations] 25 | ensure 26 | WillPaginate::Deprecation.behavior = old_behavior 27 | end 28 | end 29 | 30 | # Wrap tests that use Mocha and skip if unavailable. 31 | def uses_mocha(test_name) 32 | unless Object.const_defined?(:Mocha) 33 | gem 'mocha', '>= 0.9.5' 34 | require 'mocha' 35 | end 36 | rescue LoadError => load_error 37 | $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again." 38 | else 39 | yield 40 | end 41 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/lib/activerecord_test_case.rb: -------------------------------------------------------------------------------- 1 | require 'lib/activerecord_test_connector' 2 | 3 | class ActiveRecordTestCase < Test::Unit::TestCase 4 | if defined?(ActiveSupport::Testing::SetupAndTeardown) 5 | include ActiveSupport::Testing::SetupAndTeardown 6 | end 7 | 8 | if defined?(ActiveRecord::TestFixtures) 9 | include ActiveRecord::TestFixtures 10 | end 11 | # Set our fixture path 12 | if ActiveRecordTestConnector.able_to_connect 13 | self.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures') 14 | self.use_transactional_fixtures = true 15 | end 16 | 17 | def self.fixtures(*args) 18 | super if ActiveRecordTestConnector.connected 19 | end 20 | 21 | def run(*args) 22 | super if ActiveRecordTestConnector.connected 23 | end 24 | 25 | # Default so Test::Unit::TestCase doesn't complain 26 | def test_truth 27 | end 28 | 29 | protected 30 | 31 | def assert_queries(num = 1) 32 | $query_count = 0 33 | yield 34 | ensure 35 | assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed." 36 | end 37 | 38 | def assert_no_queries(&block) 39 | assert_queries(0, &block) 40 | end 41 | end 42 | 43 | ActiveRecordTestConnector.setup 44 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/lib/activerecord_test_connector.rb: -------------------------------------------------------------------------------- 1 | require 'active_record' 2 | require 'active_record/version' 3 | require 'active_record/fixtures' 4 | 5 | class ActiveRecordTestConnector 6 | cattr_accessor :able_to_connect 7 | cattr_accessor :connected 8 | 9 | FIXTURES_PATH = File.join(File.dirname(__FILE__), '..', 'fixtures') 10 | 11 | # Set our defaults 12 | self.connected = false 13 | self.able_to_connect = true 14 | 15 | def self.setup 16 | unless self.connected || !self.able_to_connect 17 | setup_connection 18 | load_schema 19 | add_load_path FIXTURES_PATH 20 | self.connected = true 21 | end 22 | rescue Exception => e # errors from ActiveRecord setup 23 | $stderr.puts "\nSkipping ActiveRecord tests: #{e}\n\n" 24 | self.able_to_connect = false 25 | end 26 | 27 | private 28 | 29 | def self.add_load_path(path) 30 | dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies 31 | dep.load_paths.unshift path 32 | end 33 | 34 | def self.setup_connection 35 | db = ENV['DB'].blank?? 'sqlite3' : ENV['DB'] 36 | 37 | configurations = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'database.yml')) 38 | raise "no configuration for '#{db}'" unless configurations.key? db 39 | configuration = configurations[db] 40 | 41 | ActiveRecord::Base.logger = Logger.new(STDOUT) if $0 == 'irb' 42 | puts "using #{configuration['adapter']} adapter" unless ENV['DB'].blank? 43 | 44 | gem 'sqlite3-ruby' if 'sqlite3' == db 45 | 46 | ActiveRecord::Base.establish_connection(configuration) 47 | ActiveRecord::Base.configurations = { db => configuration } 48 | prepare ActiveRecord::Base.connection 49 | 50 | unless Object.const_defined?(:QUOTED_TYPE) 51 | Object.send :const_set, :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name('type') 52 | end 53 | end 54 | 55 | def self.load_schema 56 | ActiveRecord::Base.silence do 57 | ActiveRecord::Migration.verbose = false 58 | load File.join(FIXTURES_PATH, 'schema.rb') 59 | end 60 | end 61 | 62 | def self.prepare(conn) 63 | class << conn 64 | IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SHOW FIELDS /] 65 | 66 | def execute_with_counting(sql, name = nil, &block) 67 | $query_count ||= 0 68 | $query_count += 1 unless IGNORED_SQL.any? { |r| sql =~ r } 69 | execute_without_counting(sql, name, &block) 70 | end 71 | 72 | alias_method_chain :execute, :counting 73 | end 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/lib/load_fixtures.rb: -------------------------------------------------------------------------------- 1 | require 'boot' 2 | require 'lib/activerecord_test_connector' 3 | 4 | # setup the connection 5 | ActiveRecordTestConnector.setup 6 | 7 | # load all fixtures 8 | Fixtures.create_fixtures(ActiveRecordTestConnector::FIXTURES_PATH, ActiveRecord::Base.connection.tables) 9 | 10 | require 'will_paginate' 11 | WillPaginate.enable_activerecord 12 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/test/tasks.rake: -------------------------------------------------------------------------------- 1 | require 'rake/testtask' 2 | 3 | desc 'Test the will_paginate plugin.' 4 | Rake::TestTask.new(:test) do |t| 5 | t.pattern = 'test/**/*_test.rb' 6 | t.verbose = true 7 | t.libs << 'test' 8 | end 9 | 10 | # I want to specify environment variables at call time 11 | class EnvTestTask < Rake::TestTask 12 | attr_accessor :env 13 | 14 | def ruby(*args) 15 | env.each { |key, value| ENV[key] = value } if env 16 | super 17 | env.keys.each { |key| ENV.delete key } if env 18 | end 19 | end 20 | 21 | for configuration in %w( sqlite3 mysql postgres ) 22 | EnvTestTask.new("test_#{configuration}") do |t| 23 | t.pattern = 'test/finder_test.rb' 24 | t.verbose = true 25 | t.env = { 'DB' => configuration } 26 | t.libs << 'test' 27 | end 28 | end 29 | 30 | task :test_databases => %w(test_mysql test_sqlite3 test_postgres) 31 | 32 | desc %{Test everything on SQLite3, MySQL and PostgreSQL} 33 | task :test_full => %w(test test_mysql test_postgres) 34 | 35 | desc %{Test everything with Rails 2.1.x, 2.0.x & 1.2.x gems} 36 | task :test_all do 37 | all = Rake::Task['test_full'] 38 | versions = %w(2.3.2 2.2.2 2.1.0 2.0.4 1.2.6) 39 | versions.each do |version| 40 | ENV['RAILS_VERSION'] = "~> #{version}" 41 | all.invoke 42 | reset_invoked unless version == versions.last 43 | end 44 | end 45 | 46 | def reset_invoked 47 | %w( test_full test test_mysql test_postgres ).each do |name| 48 | Rake::Task[name].instance_variable_set '@already_invoked', false 49 | end 50 | end 51 | 52 | task :rcov do 53 | excludes = %w( lib/will_paginate/named_scope* 54 | lib/will_paginate/core_ext.rb 55 | lib/will_paginate.rb 56 | rails* ) 57 | 58 | system %[rcov -Itest:lib test/*.rb -x #{excludes.join(',')}] 59 | end 60 | -------------------------------------------------------------------------------- /vendor/plugins/mislav-will_paginate/will_paginate.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'will_paginate' 3 | s.version = '2.3.11' 4 | s.date = '2009-06-02' 5 | 6 | s.summary = "Most awesome pagination solution for Rails" 7 | s.description = "The will_paginate library provides a simple, yet powerful and extensible API for ActiveRecord pagination and rendering of pagination links in ActionView templates." 8 | 9 | s.authors = ['Mislav Marohnić', 'PJ Hyett'] 10 | s.email = 'mislav.marohnic@gmail.com' 11 | s.homepage = 'http://github.com/mislav/will_paginate/wikis' 12 | 13 | s.has_rdoc = true 14 | s.rdoc_options = ['--main', 'README.rdoc'] 15 | s.rdoc_options << '--inline-source' << '--charset=UTF-8' 16 | s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc'] 17 | 18 | s.files = %w(CHANGELOG.rdoc LICENSE README.rdoc Rakefile examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb) 19 | s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb) 20 | end 21 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.swp 3 | tmp 4 | s3.yml 5 | public -------------------------------------------------------------------------------- /vendor/plugins/paperclip/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | LICENSE 3 | 4 | The MIT License 5 | 6 | Copyright (c) 2008 Jon Yurek and thoughtbot, inc. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'rake/testtask' 3 | require 'rake/rdoctask' 4 | 5 | $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') 6 | require 'paperclip' 7 | 8 | desc 'Default: run unit tests.' 9 | task :default => [:clean, :test] 10 | 11 | desc 'Test the paperclip plugin.' 12 | Rake::TestTask.new(:test) do |t| 13 | t.libs << 'lib' << 'profile' 14 | t.pattern = 'test/**/*_test.rb' 15 | t.verbose = true 16 | end 17 | 18 | desc 'Start an IRB session with all necessary files required.' 19 | task :shell do |t| 20 | chdir File.dirname(__FILE__) 21 | exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init' 22 | end 23 | 24 | desc 'Generate documentation for the paperclip plugin.' 25 | Rake::RDocTask.new(:rdoc) do |rdoc| 26 | rdoc.rdoc_dir = 'doc' 27 | rdoc.title = 'Paperclip' 28 | rdoc.options << '--line-numbers' << '--inline-source' 29 | rdoc.rdoc_files.include('README*') 30 | rdoc.rdoc_files.include('lib/**/*.rb') 31 | end 32 | 33 | desc 'Update documentation on website' 34 | task :sync_docs => 'rdoc' do 35 | `rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/paperclip` 36 | end 37 | 38 | desc 'Clean up files.' 39 | task :clean do |t| 40 | FileUtils.rm_rf "doc" 41 | FileUtils.rm_rf "tmp" 42 | FileUtils.rm_rf "pkg" 43 | FileUtils.rm "test/debug.log" rescue nil 44 | FileUtils.rm "test/paperclip.db" rescue nil 45 | end 46 | 47 | spec = Gem::Specification.new do |s| 48 | s.name = "paperclip" 49 | s.version = Paperclip::VERSION 50 | s.author = "Jon Yurek" 51 | s.email = "jyurek@thoughtbot.com" 52 | s.homepage = "http://www.thoughtbot.com/projects/paperclip" 53 | s.platform = Gem::Platform::RUBY 54 | s.summary = "File attachments as attributes for ActiveRecord" 55 | s.files = FileList["README*", 56 | "LICENSE", 57 | "Rakefile", 58 | "init.rb", 59 | "{generators,lib,tasks,test,shoulda_macros}/**/*"].to_a 60 | s.require_path = "lib" 61 | s.test_files = FileList["test/**/test_*.rb"].to_a 62 | s.rubyforge_project = "paperclip" 63 | s.has_rdoc = true 64 | s.extra_rdoc_files = FileList["README*"].to_a 65 | s.rdoc_options << '--line-numbers' << '--inline-source' 66 | s.requirements << "ImageMagick" 67 | s.add_runtime_dependency 'right_aws' 68 | s.add_development_dependency 'thoughtbot-shoulda' 69 | s.add_development_dependency 'mocha' 70 | end 71 | 72 | desc "Generate a gemspec file for GitHub" 73 | task :gemspec do 74 | File.open("#{spec.name}.gemspec", 'w') do |f| 75 | f.write spec.to_ruby 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/generators/paperclip/USAGE: -------------------------------------------------------------------------------- 1 | Usage: 2 | 3 | script/generate paperclip Class attachment1 (attachment2 ...) 4 | 5 | This will create a migration that will add the proper columns to your class's table. -------------------------------------------------------------------------------- /vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb: -------------------------------------------------------------------------------- 1 | class PaperclipGenerator < Rails::Generator::NamedBase 2 | attr_accessor :attachments, :migration_name 3 | 4 | def initialize(args, options = {}) 5 | super 6 | @class_name, @attachments = args[0], args[1..-1] 7 | end 8 | 9 | def manifest 10 | file_name = generate_file_name 11 | @migration_name = file_name.camelize 12 | record do |m| 13 | m.migration_template "paperclip_migration.rb.erb", 14 | File.join('db', 'migrate'), 15 | :migration_file_name => file_name 16 | end 17 | end 18 | 19 | private 20 | 21 | def generate_file_name 22 | names = attachments.map{|a| a.underscore } 23 | names = names[0..-2] + ["and", names[-1]] if names.length > 1 24 | "add_attachments_#{names.join("_")}_to_#{@class_name.underscore}" 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb: -------------------------------------------------------------------------------- 1 | class <%= migration_name %> < ActiveRecord::Migration 2 | def self.up 3 | <% attachments.each do |attachment| -%> 4 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string 5 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string 6 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer 7 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime 8 | <% end -%> 9 | end 10 | 11 | def self.down 12 | <% attachments.each do |attachment| -%> 13 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name 14 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type 15 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size 16 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at 17 | <% end -%> 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/init.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), "lib", "paperclip") 2 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | # This module is intended as a compatability shim for the differences in 3 | # callbacks between Rails 2.0 and Rails 2.1. 4 | module CallbackCompatability 5 | def self.included(base) 6 | base.extend(ClassMethods) 7 | base.send(:include, InstanceMethods) 8 | end 9 | 10 | module ClassMethods 11 | # The implementation of this method is taken from the Rails 1.2.6 source, 12 | # from rails/activerecord/lib/active_record/callbacks.rb, line 192. 13 | def define_callbacks(*args) 14 | args.each do |method| 15 | self.class_eval <<-"end_eval" 16 | def self.#{method}(*callbacks, &block) 17 | callbacks << block if block_given? 18 | write_inheritable_array(#{method.to_sym.inspect}, callbacks) 19 | end 20 | end_eval 21 | end 22 | end 23 | end 24 | 25 | module InstanceMethods 26 | # The callbacks in < 2.1 don't worry about the extra options or the 27 | # block, so just run what we have available. 28 | def run_callbacks(meth, opts = nil, &blk) 29 | callback(meth) 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/geometry.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | 3 | # Defines the geometry of an image. 4 | class Geometry 5 | attr_accessor :height, :width, :modifier 6 | 7 | # Gives a Geometry representing the given height and width 8 | def initialize width = nil, height = nil, modifier = nil 9 | @height = height.to_f 10 | @width = width.to_f 11 | @modifier = modifier 12 | end 13 | 14 | # Uses ImageMagick to determing the dimensions of a file, passed in as either a 15 | # File or path. 16 | def self.from_file file 17 | file = file.path if file.respond_to? "path" 18 | geometry = begin 19 | Paperclip.run("identify", %Q[-format "%wx%h" "#{file}"[0]]) 20 | rescue PaperclipCommandLineError 21 | "" 22 | end 23 | parse(geometry) || 24 | raise(NotIdentifiedByImageMagickError.new("#{file} is not recognized by the 'identify' command.")) 25 | end 26 | 27 | # Parses a "WxH" formatted string, where W is the width and H is the height. 28 | def self.parse string 29 | if match = (string && string.match(/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/)) 30 | Geometry.new(*match[1,3]) 31 | end 32 | end 33 | 34 | # True if the dimensions represent a square 35 | def square? 36 | height == width 37 | end 38 | 39 | # True if the dimensions represent a horizontal rectangle 40 | def horizontal? 41 | height < width 42 | end 43 | 44 | # True if the dimensions represent a vertical rectangle 45 | def vertical? 46 | height > width 47 | end 48 | 49 | # The aspect ratio of the dimensions. 50 | def aspect 51 | width / height 52 | end 53 | 54 | # Returns the larger of the two dimensions 55 | def larger 56 | [height, width].max 57 | end 58 | 59 | # Returns the smaller of the two dimensions 60 | def smaller 61 | [height, width].min 62 | end 63 | 64 | # Returns the width and height in a format suitable to be passed to Geometry.parse 65 | def to_s 66 | s = "" 67 | s << width.to_i.to_s if width > 0 68 | s << "x#{height.to_i}" if height > 0 69 | s << modifier.to_s 70 | s 71 | end 72 | 73 | # Same as to_s 74 | def inspect 75 | to_s 76 | end 77 | 78 | # Returns the scaling and cropping geometries (in string-based ImageMagick format) 79 | # neccessary to transform this Geometry into the Geometry given. If crop is true, 80 | # then it is assumed the destination Geometry will be the exact final resolution. 81 | # In this case, the source Geometry is scaled so that an image containing the 82 | # destination Geometry would be completely filled by the source image, and any 83 | # overhanging image would be cropped. Useful for square thumbnail images. The cropping 84 | # is weighted at the center of the Geometry. 85 | def transformation_to dst, crop = false 86 | if crop 87 | ratio = Geometry.new( dst.width / self.width, dst.height / self.height ) 88 | scale_geometry, scale = scaling(dst, ratio) 89 | crop_geometry = cropping(dst, ratio, scale) 90 | else 91 | scale_geometry = dst.to_s 92 | end 93 | 94 | [ scale_geometry, crop_geometry ] 95 | end 96 | 97 | private 98 | 99 | def scaling dst, ratio 100 | if ratio.horizontal? || ratio.square? 101 | [ "%dx" % dst.width, ratio.width ] 102 | else 103 | [ "x%d" % dst.height, ratio.height ] 104 | end 105 | end 106 | 107 | def cropping dst, ratio, scale 108 | if ratio.horizontal? || ratio.square? 109 | "%dx%d+%d+%d" % [ dst.width, dst.height, 0, (self.height * scale - dst.height) / 2 ] 110 | else 111 | "%dx%d+%d+%d" % [ dst.width, dst.height, (self.width * scale - dst.width) / 2, 0 ] 112 | end 113 | end 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/iostream.rb: -------------------------------------------------------------------------------- 1 | # Provides method that can be included on File-type objects (IO, StringIO, Tempfile, etc) to allow stream copying 2 | # and Tempfile conversion. 3 | module IOStream 4 | 5 | # Returns a Tempfile containing the contents of the readable object. 6 | def to_tempfile 7 | tempfile = Tempfile.new("stream") 8 | tempfile.binmode 9 | self.stream_to(tempfile) 10 | end 11 | 12 | # Copies one read-able object from one place to another in blocks, obviating the need to load 13 | # the whole thing into memory. Defaults to 8k blocks. If this module is included in both 14 | # StringIO and Tempfile, then either can have its data copied anywhere else without typing 15 | # worries or memory overhead worries. Returns a File if a String is passed in as the destination 16 | # and returns the IO or Tempfile as passed in if one is sent as the destination. 17 | def stream_to path_or_file, in_blocks_of = 8192 18 | dstio = case path_or_file 19 | when String then File.new(path_or_file, "wb+") 20 | when IO then path_or_file 21 | when Tempfile then path_or_file 22 | end 23 | buffer = "" 24 | self.rewind 25 | while self.read(in_blocks_of, buffer) do 26 | dstio.write(buffer) 27 | end 28 | dstio.rewind 29 | dstio 30 | end 31 | end 32 | 33 | class IO #:nodoc: 34 | include IOStream 35 | end 36 | 37 | %w( Tempfile StringIO ).each do |klass| 38 | if Object.const_defined? klass 39 | Object.const_get(klass).class_eval do 40 | include IOStream 41 | end 42 | end 43 | end 44 | 45 | # Corrects a bug in Windows when asking for Tempfile size. 46 | if defined? Tempfile 47 | class Tempfile 48 | def size 49 | if @tmpfile 50 | @tmpfile.fsync 51 | @tmpfile.flush 52 | @tmpfile.stat.size 53 | else 54 | 0 55 | end 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/matchers.rb: -------------------------------------------------------------------------------- 1 | require 'paperclip/matchers/have_attached_file_matcher' 2 | require 'paperclip/matchers/validate_attachment_presence_matcher' 3 | require 'paperclip/matchers/validate_attachment_content_type_matcher' 4 | require 'paperclip/matchers/validate_attachment_size_matcher' 5 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | module Shoulda 3 | module Matchers 4 | def have_attached_file name 5 | HaveAttachedFileMatcher.new(name) 6 | end 7 | 8 | class HaveAttachedFileMatcher 9 | def initialize attachment_name 10 | @attachment_name = attachment_name 11 | end 12 | 13 | def matches? subject 14 | @subject = subject 15 | responds? && has_column? && included? 16 | end 17 | 18 | def failure_message 19 | "Should have an attachment named #{@attachment_name}" 20 | end 21 | 22 | def negative_failure_message 23 | "Should not have an attachment named #{@attachment_name}" 24 | end 25 | 26 | def description 27 | "have an attachment named #{@attachment_name}" 28 | end 29 | 30 | protected 31 | 32 | def responds? 33 | methods = @subject.instance_methods 34 | methods.include?("#{@attachment_name}") && 35 | methods.include?("#{@attachment_name}=") && 36 | methods.include?("#{@attachment_name}?") 37 | end 38 | 39 | def has_column? 40 | @subject.column_names.include?("#{@attachment_name}_file_name") 41 | end 42 | 43 | def included? 44 | @subject.ancestors.include?(Paperclip::InstanceMethods) 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | module Shoulda 3 | module Matchers 4 | def validate_attachment_content_type name 5 | ValidateAttachmentContentTypeMatcher.new(name) 6 | end 7 | 8 | class ValidateAttachmentContentTypeMatcher 9 | def initialize attachment_name 10 | @attachment_name = attachment_name 11 | end 12 | 13 | def allowing *types 14 | @allowed_types = types.flatten 15 | self 16 | end 17 | 18 | def rejecting *types 19 | @rejected_types = types.flatten 20 | self 21 | end 22 | 23 | def matches? subject 24 | @subject = subject 25 | @allowed_types && @rejected_types && 26 | allowed_types_allowed? && rejected_types_rejected? 27 | end 28 | 29 | def failure_message 30 | "Content types #{@allowed_types.join(", ")} should be accepted" + 31 | " and #{@rejected_types.join(", ")} rejected by #{@attachment_name}" 32 | end 33 | 34 | def negative_failure_message 35 | "Content types #{@allowed_types.join(", ")} should be rejected" + 36 | " and #{@rejected_types.join(", ")} accepted by #{@attachment_name}" 37 | end 38 | 39 | def description 40 | "validate the content types allowed on attachment #{@attachment_name}" 41 | end 42 | 43 | protected 44 | 45 | def allow_types?(types) 46 | types.all? do |type| 47 | file = StringIO.new(".") 48 | file.content_type = type 49 | attachment = @subject.new.attachment_for(@attachment_name) 50 | attachment.assign(file) 51 | attachment.errors[:content_type].nil? 52 | end 53 | end 54 | 55 | def allowed_types_allowed? 56 | allow_types?(@allowed_types) 57 | end 58 | 59 | def rejected_types_rejected? 60 | not allow_types?(@rejected_types) 61 | end 62 | end 63 | end 64 | end 65 | end 66 | 67 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | module Shoulda 3 | module Matchers 4 | def validate_attachment_presence name 5 | ValidateAttachmentPresenceMatcher.new(name) 6 | end 7 | 8 | class ValidateAttachmentPresenceMatcher 9 | def initialize attachment_name 10 | @attachment_name = attachment_name 11 | end 12 | 13 | def matches? subject 14 | @subject = subject 15 | error_when_not_valid? && no_error_when_valid? 16 | end 17 | 18 | def failure_message 19 | "Attachment #{@attachment_name} should be required" 20 | end 21 | 22 | def negative_failure_message 23 | "Attachment #{@attachment_name} should not be required" 24 | end 25 | 26 | def description 27 | "require presence of attachment #{@attachment_name}" 28 | end 29 | 30 | protected 31 | 32 | def error_when_not_valid? 33 | @attachment = @subject.new.send(@attachment_name) 34 | @attachment.assign(nil) 35 | not @attachment.errors[:presence].nil? 36 | end 37 | 38 | def no_error_when_valid? 39 | @file = StringIO.new(".") 40 | @attachment = @subject.new.send(@attachment_name) 41 | @attachment.assign(@file) 42 | @attachment.errors[:presence].nil? 43 | end 44 | end 45 | end 46 | end 47 | end 48 | 49 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | module Shoulda 3 | module Matchers 4 | def validate_attachment_size name 5 | ValidateAttachmentSizeMatcher.new(name) 6 | end 7 | 8 | class ValidateAttachmentSizeMatcher 9 | def initialize attachment_name 10 | @attachment_name = attachment_name 11 | @low, @high = 0, (1.0/0) 12 | end 13 | 14 | def less_than size 15 | @high = size 16 | self 17 | end 18 | 19 | def greater_than size 20 | @low = size 21 | self 22 | end 23 | 24 | def in range 25 | @low, @high = range.first, range.last 26 | self 27 | end 28 | 29 | def matches? subject 30 | @subject = subject 31 | lower_than_low? && higher_than_low? && lower_than_high? && higher_than_high? 32 | end 33 | 34 | def failure_message 35 | "Attachment #{@attachment_name} must be between #{@low} and #{@high} bytes" 36 | end 37 | 38 | def negative_failure_message 39 | "Attachment #{@attachment_name} cannot be between #{@low} and #{@high} bytes" 40 | end 41 | 42 | def description 43 | "validate the size of attachment #{@attachment_name}" 44 | end 45 | 46 | protected 47 | 48 | def override_method object, method, &replacement 49 | (class << object; self; end).class_eval do 50 | define_method(method, &replacement) 51 | end 52 | end 53 | 54 | def passes_validation_with_size(new_size) 55 | file = StringIO.new(".") 56 | override_method(file, :size){ new_size } 57 | attachment = @subject.new.attachment_for(@attachment_name) 58 | attachment.assign(file) 59 | attachment.errors[:size].nil? 60 | end 61 | 62 | def lower_than_low? 63 | not passes_validation_with_size(@low - 1) 64 | end 65 | 66 | def higher_than_low? 67 | passes_validation_with_size(@low + 1) 68 | end 69 | 70 | def lower_than_high? 71 | return true if @high == (1.0/0) 72 | passes_validation_with_size(@high - 1) 73 | end 74 | 75 | def higher_than_high? 76 | return true if @high == (1.0/0) 77 | not passes_validation_with_size(@high + 1) 78 | end 79 | end 80 | end 81 | end 82 | end 83 | 84 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/processor.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | # Paperclip processors allow you to modify attached files when they are 3 | # attached in any way you are able. Paperclip itself uses command-line 4 | # programs for its included Thumbnail processor, but custom processors 5 | # are not required to follow suit. 6 | # 7 | # Processors are required to be defined inside the Paperclip module and 8 | # are also required to be a subclass of Paperclip::Processor. There are 9 | # only two methods you must implement to properly be a subclass: 10 | # #initialize and #make. Initialize's arguments are the file that will 11 | # be operated on (which is an instance of File), and a hash of options 12 | # that were defined in has_attached_file's style hash. 13 | # 14 | # All #make needs to do is return an instance of File (Tempfile is 15 | # acceptable) which contains the results of the processing. 16 | # 17 | # See Paperclip.run for more information about using command-line 18 | # utilities from within Processors. 19 | class Processor 20 | attr_accessor :file, :options, :attachment 21 | 22 | def initialize file, options = {}, attachment = nil 23 | @file = file 24 | @options = options 25 | @attachment = attachment 26 | end 27 | 28 | def make 29 | end 30 | 31 | def self.make file, options = {}, attachment = nil 32 | new(file, options, attachment).make 33 | end 34 | end 35 | 36 | # Due to how ImageMagick handles its image format conversion and how Tempfile 37 | # handles its naming scheme, it is necessary to override how Tempfile makes 38 | # its names so as to allow for file extensions. Idea taken from the comments 39 | # on this blog post: 40 | # http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions 41 | class Tempfile < ::Tempfile 42 | # Replaces Tempfile's +make_tmpname+ with one that honors file extensions. 43 | def make_tmpname(basename, n) 44 | extension = File.extname(basename) 45 | sprintf("%s,%d,%d%s", File.basename(basename, extension), $$, n, extension) 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/thumbnail.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | # Handles thumbnailing images that are uploaded. 3 | class Thumbnail < Processor 4 | 5 | attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options 6 | 7 | # Creates a Thumbnail object set to work on the +file+ given. It 8 | # will attempt to transform the image into one defined by +target_geometry+ 9 | # which is a "WxH"-style string. +format+ will be inferred from the +file+ 10 | # unless specified. Thumbnail creation will raise no errors unless 11 | # +whiny+ is true (which it is, by default. If +convert_options+ is 12 | # set, the options will be appended to the convert command upon image conversion 13 | def initialize file, options = {}, attachment = nil 14 | super 15 | geometry = options[:geometry] 16 | @file = file 17 | @crop = geometry[-1,1] == '#' 18 | @target_geometry = Geometry.parse geometry 19 | @current_geometry = Geometry.from_file @file 20 | @convert_options = options[:convert_options] 21 | @whiny = options[:whiny].nil? ? true : options[:whiny] 22 | @format = options[:format] 23 | 24 | @current_format = File.extname(@file.path) 25 | @basename = File.basename(@file.path, @current_format) 26 | end 27 | 28 | # Returns true if the +target_geometry+ is meant to crop. 29 | def crop? 30 | @crop 31 | end 32 | 33 | # Returns true if the image is meant to make use of additional convert options. 34 | def convert_options? 35 | not @convert_options.blank? 36 | end 37 | 38 | # Performs the conversion of the +file+ into a thumbnail. Returns the Tempfile 39 | # that contains the new image. 40 | def make 41 | src = @file 42 | dst = Tempfile.new([@basename, @format].compact.join(".")) 43 | dst.binmode 44 | 45 | command = <<-end_command 46 | "#{ File.expand_path(src.path) }[0]" 47 | #{ transformation_command } 48 | "#{ File.expand_path(dst.path) }" 49 | end_command 50 | 51 | begin 52 | success = Paperclip.run("convert", command.gsub(/\s+/, " ")) 53 | rescue PaperclipCommandLineError 54 | raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if @whiny 55 | end 56 | 57 | dst 58 | end 59 | 60 | # Returns the command ImageMagick's +convert+ needs to transform the image 61 | # into the thumbnail. 62 | def transformation_command 63 | scale, crop = @current_geometry.transformation_to(@target_geometry, crop?) 64 | trans = "-resize \"#{scale}\"" 65 | trans << " -crop \"#{crop}\" +repage" if crop 66 | trans << " #{convert_options}" if convert_options? 67 | trans 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/lib/paperclip/upfile.rb: -------------------------------------------------------------------------------- 1 | module Paperclip 2 | # The Upfile module is a convenience module for adding uploaded-file-type methods 3 | # to the +File+ class. Useful for testing. 4 | # user.avatar = File.new("test/test_avatar.jpg") 5 | module Upfile 6 | 7 | # Infer the MIME-type of the file from the extension. 8 | def content_type 9 | type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase 10 | case type 11 | when %r"jpe?g" then "image/jpeg" 12 | when %r"tiff?" then "image/tiff" 13 | when %r"png", "gif", "bmp" then "image/#{type}" 14 | when "txt" then "text/plain" 15 | when %r"html?" then "text/html" 16 | when "csv", "xml", "css", "js" then "text/#{type}" 17 | else "application/x-#{type}" 18 | end 19 | end 20 | 21 | # Returns the file's normal name. 22 | def original_filename 23 | File.basename(self.path) 24 | end 25 | 26 | # Returns the size of the file. 27 | def size 28 | File.size(self) 29 | end 30 | end 31 | end 32 | 33 | if defined? StringIO 34 | class StringIO 35 | attr_accessor :original_filename, :content_type 36 | def original_filename 37 | @original_filename ||= "stringio.txt" 38 | end 39 | def content_type 40 | @content_type ||= "text/plain" 41 | end 42 | end 43 | end 44 | 45 | class File #:nodoc: 46 | include Paperclip::Upfile 47 | end 48 | 49 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/paperclip.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | 3 | Gem::Specification.new do |s| 4 | s.name = %q{paperclip} 5 | s.version = "2.2.8" 6 | 7 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 8 | s.authors = ["Jon Yurek"] 9 | s.date = %q{2009-04-02} 10 | s.email = %q{jyurek@thoughtbot.com} 11 | s.extra_rdoc_files = ["README.rdoc"] 12 | s.files = ["README.rdoc", "LICENSE", "Rakefile", "init.rb", "generators/paperclip", "generators/paperclip/paperclip_generator.rb", "generators/paperclip/templates", "generators/paperclip/templates/paperclip_migration.rb.erb", "generators/paperclip/USAGE", "lib/paperclip", "lib/paperclip/attachment.rb", "lib/paperclip/callback_compatability.rb", "lib/paperclip/geometry.rb", "lib/paperclip/iostream.rb", "lib/paperclip/matchers", "lib/paperclip/matchers/have_attached_file_matcher.rb", "lib/paperclip/matchers/validate_attachment_content_type_matcher.rb", "lib/paperclip/matchers/validate_attachment_presence_matcher.rb", "lib/paperclip/matchers/validate_attachment_size_matcher.rb", "lib/paperclip/matchers.rb", "lib/paperclip/processor.rb", "lib/paperclip/storage.rb", "lib/paperclip/thumbnail.rb", "lib/paperclip/upfile.rb", "lib/paperclip.rb", "tasks/paperclip_tasks.rake", "test/attachment_test.rb", "test/database.yml", "test/debug.log", "test/fixtures", "test/fixtures/12k.png", "test/fixtures/50x50.png", "test/fixtures/5k.png", "test/fixtures/bad.png", "test/fixtures/s3.yml", "test/fixtures/text.txt", "test/fixtures/twopage.pdf", "test/geometry_test.rb", "test/helper.rb", "test/integration_test.rb", "test/iostream_test.rb", "test/matchers", "test/matchers/have_attached_file_matcher_test.rb", "test/matchers/validate_attachment_content_type_matcher_test.rb", "test/matchers/validate_attachment_presence_matcher_test.rb", "test/matchers/validate_attachment_size_matcher_test.rb", "test/paperclip_test.rb", "test/processor_test.rb", "test/s3.yml", "test/storage_test.rb", "test/thumbnail_test.rb", "test/tmp", "test/tmp/storage.txt", "shoulda_macros/paperclip.rb"] 13 | s.has_rdoc = true 14 | s.homepage = %q{http://www.thoughtbot.com/projects/paperclip} 15 | s.rdoc_options = ["--line-numbers", "--inline-source"] 16 | s.require_paths = ["lib"] 17 | s.requirements = ["ImageMagick"] 18 | s.rubyforge_project = %q{paperclip} 19 | s.rubygems_version = %q{1.3.1} 20 | s.summary = %q{File attachments as attributes for ActiveRecord} 21 | 22 | if s.respond_to? :specification_version then 23 | current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION 24 | s.specification_version = 2 25 | 26 | if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then 27 | s.add_runtime_dependency(%q, [">= 0"]) 28 | s.add_development_dependency(%q, [">= 0"]) 29 | s.add_development_dependency(%q, [">= 0"]) 30 | else 31 | s.add_dependency(%q, [">= 0"]) 32 | s.add_dependency(%q, [">= 0"]) 33 | s.add_dependency(%q, [">= 0"]) 34 | end 35 | else 36 | s.add_dependency(%q, [">= 0"]) 37 | s.add_dependency(%q, [">= 0"]) 38 | s.add_dependency(%q, [">= 0"]) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/shoulda_macros/paperclip.rb: -------------------------------------------------------------------------------- 1 | require 'paperclip/matchers' 2 | 3 | module Paperclip 4 | # =Paperclip Shoulda Macros 5 | # 6 | # These macros are intended for use with shoulda, and will be included into 7 | # your tests automatically. All of the macros use the standard shoulda 8 | # assumption that the name of the test is based on the name of the model 9 | # you're testing (that is, UserTest is the test for the User model), and 10 | # will load that class for testing purposes. 11 | module Shoulda 12 | include Matchers 13 | # This will test whether you have defined your attachment correctly by 14 | # checking for all the required fields exist after the definition of the 15 | # attachment. 16 | def should_have_attached_file name 17 | klass = self.name.gsub(/Test$/, '').constantize 18 | matcher = have_attached_file name 19 | should matcher.description do 20 | assert_accepts(matcher, klass) 21 | end 22 | end 23 | 24 | # Tests for validations on the presence of the attachment. 25 | def should_validate_attachment_presence name 26 | klass = self.name.gsub(/Test$/, '').constantize 27 | matcher = validate_attachment_presence name 28 | should matcher.description do 29 | assert_accepts(matcher, klass) 30 | end 31 | end 32 | 33 | # Tests that you have content_type validations specified. There are two 34 | # options, :valid and :invalid. Both accept an array of strings. The 35 | # strings should be a list of content types which will pass and fail 36 | # validation, respectively. 37 | def should_validate_attachment_content_type name, options = {} 38 | klass = self.name.gsub(/Test$/, '').constantize 39 | valid = [options[:valid]].flatten 40 | invalid = [options[:invalid]].flatten 41 | matcher = validate_attachment_content_type(name).allowing(valid).rejecting(invalid) 42 | should matcher.description do 43 | assert_accepts(matcher, klass) 44 | end 45 | end 46 | 47 | # Tests to ensure that you have file size validations turned on. You 48 | # can pass the same options to this that you can to 49 | # validate_attachment_file_size - :less_than, :greater_than, and :in. 50 | # :less_than checks that a file is less than a certain size, :greater_than 51 | # checks that a file is more than a certain size, and :in takes a Range or 52 | # Array which specifies the lower and upper limits of the file size. 53 | def should_validate_attachment_size name, options = {} 54 | klass = self.name.gsub(/Test$/, '').constantize 55 | min = options[:greater_than] || (options[:in] && options[:in].first) || 0 56 | max = options[:less_than] || (options[:in] && options[:in].last) || (1.0/0) 57 | range = (min..max) 58 | matcher = validate_attachment_size(name).in(range) 59 | should matcher.description do 60 | assert_accepts(matcher, klass) 61 | end 62 | end 63 | end 64 | end 65 | 66 | class Test::Unit::TestCase #:nodoc: 67 | extend Paperclip::Shoulda 68 | end 69 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/tasks/paperclip_tasks.rake: -------------------------------------------------------------------------------- 1 | def obtain_class 2 | class_name = ENV['CLASS'] || ENV['class'] 3 | raise "Must specify CLASS" unless class_name 4 | @klass = Object.const_get(class_name) 5 | end 6 | 7 | def obtain_attachments 8 | name = ENV['ATTACHMENT'] || ENV['attachment'] 9 | raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions) 10 | if !name.blank? && @klass.attachment_definitions.keys.include?(name) 11 | [ name ] 12 | else 13 | @klass.attachment_definitions.keys 14 | end 15 | end 16 | 17 | def for_all_attachments 18 | klass = obtain_class 19 | names = obtain_attachments 20 | ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id')) 21 | 22 | ids.each do |id| 23 | instance = klass.find(id) 24 | names.each do |name| 25 | result = if instance.send("#{ name }?") 26 | yield(instance, name) 27 | else 28 | true 29 | end 30 | print result ? "." : "x"; $stdout.flush 31 | end 32 | end 33 | puts " Done." 34 | end 35 | 36 | namespace :paperclip do 37 | desc "Refreshes both metadata and thumbnails." 38 | task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"] 39 | 40 | namespace :refresh do 41 | desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)." 42 | task :thumbnails => :environment do 43 | errors = [] 44 | for_all_attachments do |instance, name| 45 | result = instance.send(name).reprocess! 46 | errors << [instance.id, instance.errors] unless instance.errors.blank? 47 | result 48 | end 49 | errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" } 50 | end 51 | 52 | desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)." 53 | task :metadata => :environment do 54 | for_all_attachments do |instance, name| 55 | if file = instance.send(name).to_file 56 | instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip) 57 | instance.send("#{name}_content_type=", file.content_type.strip) 58 | instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size") 59 | instance.save(false) 60 | else 61 | true 62 | end 63 | end 64 | end 65 | end 66 | 67 | desc "Cleans out invalid attachments. Useful after you've added new validations." 68 | task :clean => :environment do 69 | for_all_attachments do |instance, name| 70 | instance.send(name).send(:validate) 71 | if instance.send(name).valid? 72 | true 73 | else 74 | instance.send("#{name}=", nil) 75 | instance.save 76 | end 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/.gitignore: -------------------------------------------------------------------------------- 1 | debug.log 2 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/database.yml: -------------------------------------------------------------------------------- 1 | test: 2 | adapter: sqlite3 3 | database: ":memory:" 4 | 5 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/12k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/paperclip/test/fixtures/12k.png -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/paperclip/test/fixtures/50x50.png -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/5k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/paperclip/test/fixtures/5k.png -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/bad.png: -------------------------------------------------------------------------------- 1 | This is not an image. 2 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/text.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/paperclip/test/fixtures/text.txt -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/fixtures/twopage.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railslist/craigslist-clone/94d73732631aebd3dd12a9676c9c23a87e1ea090/vendor/plugins/paperclip/test/fixtures/twopage.pdf -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | gem 'thoughtbot-shoulda', ">= 2.9.0" 4 | require 'shoulda' 5 | require 'mocha' 6 | require 'tempfile' 7 | 8 | gem 'sqlite3-ruby' 9 | 10 | require 'active_record' 11 | require 'active_support' 12 | begin 13 | require 'ruby-debug' 14 | rescue LoadError 15 | puts "ruby-debug not loaded" 16 | end 17 | 18 | ROOT = File.join(File.dirname(__FILE__), '..') 19 | RAILS_ROOT = ROOT 20 | 21 | $LOAD_PATH << File.join(ROOT, 'lib') 22 | $LOAD_PATH << File.join(ROOT, 'lib', 'paperclip') 23 | 24 | require File.join(ROOT, 'lib', 'paperclip.rb') 25 | 26 | require 'shoulda_macros/paperclip' 27 | 28 | ENV['RAILS_ENV'] ||= 'test' 29 | 30 | FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures") 31 | config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) 32 | ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") 33 | ActiveRecord::Base.establish_connection(config['test']) 34 | 35 | def reset_class class_name 36 | ActiveRecord::Base.send(:include, Paperclip) 37 | Object.send(:remove_const, class_name) rescue nil 38 | klass = Object.const_set(class_name, Class.new(ActiveRecord::Base)) 39 | klass.class_eval{ include Paperclip } 40 | klass 41 | end 42 | 43 | def reset_table table_name, &block 44 | block ||= lambda{ true } 45 | ActiveRecord::Base.connection.create_table :dummies, {:force => true}, &block 46 | end 47 | 48 | def modify_table table_name, &block 49 | ActiveRecord::Base.connection.change_table :dummies, &block 50 | end 51 | 52 | def rebuild_model options = {} 53 | ActiveRecord::Base.connection.create_table :dummies, :force => true do |table| 54 | table.column :other, :string 55 | table.column :avatar_file_name, :string 56 | table.column :avatar_content_type, :string 57 | table.column :avatar_file_size, :integer 58 | table.column :avatar_updated_at, :datetime 59 | end 60 | rebuild_class options 61 | end 62 | 63 | def rebuild_class options = {} 64 | ActiveRecord::Base.send(:include, Paperclip) 65 | Object.send(:remove_const, "Dummy") rescue nil 66 | Object.const_set("Dummy", Class.new(ActiveRecord::Base)) 67 | Dummy.class_eval do 68 | include Paperclip 69 | has_attached_file :avatar, options 70 | end 71 | end 72 | 73 | def temporary_rails_env(new_env) 74 | old_env = defined?(RAILS_ENV) ? RAILS_ENV : nil 75 | silence_warnings do 76 | Object.const_set("RAILS_ENV", new_env) 77 | end 78 | yield 79 | silence_warnings do 80 | Object.const_set("RAILS_ENV", old_env) 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/iostream_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class IOStreamTest < Test::Unit::TestCase 4 | context "IOStream" do 5 | should "be included in IO, File, Tempfile, and StringIO" do 6 | [IO, File, Tempfile, StringIO].each do |klass| 7 | assert klass.included_modules.include?(IOStream), "Not in #{klass}" 8 | end 9 | end 10 | end 11 | 12 | context "A file" do 13 | setup do 14 | @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb') 15 | end 16 | 17 | teardown { @file.close } 18 | 19 | context "that is sent #stream_to" do 20 | 21 | context "and given a String" do 22 | setup do 23 | FileUtils.mkdir_p(File.join(ROOT, 'tmp')) 24 | assert @result = @file.stream_to(File.join(ROOT, 'tmp', 'iostream.string.test')) 25 | end 26 | 27 | should "return a File" do 28 | assert @result.is_a?(File) 29 | end 30 | 31 | should "contain the same data as the original file" do 32 | @file.rewind; @result.rewind 33 | assert_equal @file.read, @result.read 34 | end 35 | end 36 | 37 | context "and given a Tempfile" do 38 | setup do 39 | tempfile = Tempfile.new('iostream.test') 40 | tempfile.binmode 41 | assert @result = @file.stream_to(tempfile) 42 | end 43 | 44 | should "return a Tempfile" do 45 | assert @result.is_a?(Tempfile) 46 | end 47 | 48 | should "contain the same data as the original file" do 49 | @file.rewind; @result.rewind 50 | assert_equal @file.read, @result.read 51 | end 52 | end 53 | 54 | end 55 | 56 | context "that is sent #to_tempfile" do 57 | setup do 58 | assert @tempfile = @file.to_tempfile 59 | end 60 | 61 | should "convert it to a Tempfile" do 62 | assert @tempfile.is_a?(Tempfile) 63 | end 64 | 65 | should "have the Tempfile contain the same data as the file" do 66 | @file.rewind; @tempfile.rewind 67 | assert_equal @file.read, @tempfile.read 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class HaveAttachedFileMatcherTest < Test::Unit::TestCase 4 | context "have_attached_file" do 5 | setup do 6 | @dummy_class = reset_class "Dummy" 7 | reset_table "dummies" 8 | @matcher = self.class.have_attached_file(:avatar) 9 | end 10 | 11 | should "reject a class with no attachment" do 12 | assert_rejects @matcher, @dummy_class 13 | end 14 | 15 | should "accept a class with an attachment" do 16 | modify_table("dummies"){|d| d.string :avatar_file_name } 17 | @dummy_class.has_attached_file :avatar 18 | assert_accepts @matcher, @dummy_class 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase 4 | context "validate_attachment_content_type" do 5 | setup do 6 | reset_table("dummies") do |d| 7 | d.string :avatar_file_name 8 | end 9 | @dummy_class = reset_class "Dummy" 10 | @dummy_class.has_attached_file :avatar 11 | @matcher = self.class.validate_attachment_content_type(:avatar). 12 | allowing(%w(image/png image/jpeg)). 13 | rejecting(%w(audio/mp3 application/octet-stream)) 14 | end 15 | 16 | should "reject a class with no validation" do 17 | assert_rejects @matcher, @dummy_class 18 | end 19 | 20 | should "reject a class with a validation that doesn't match" do 21 | @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{audio/.*} 22 | assert_rejects @matcher, @dummy_class 23 | end 24 | 25 | should "accept a class with a validation" do 26 | @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{image/.*} 27 | assert_accepts @matcher, @dummy_class 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase 4 | context "validate_attachment_presence" do 5 | setup do 6 | reset_table("dummies"){|d| d.string :avatar_file_name } 7 | @dummy_class = reset_class "Dummy" 8 | @dummy_class.has_attached_file :avatar 9 | @matcher = self.class.validate_attachment_presence(:avatar) 10 | end 11 | 12 | should "reject a class with no validation" do 13 | assert_rejects @matcher, @dummy_class 14 | end 15 | 16 | should "accept a class with a validation" do 17 | @dummy_class.validates_attachment_presence :avatar 18 | assert_accepts @matcher, @dummy_class 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase 4 | context "validate_attachment_size" do 5 | setup do 6 | reset_table("dummies") do |d| 7 | d.string :avatar_file_name 8 | end 9 | @dummy_class = reset_class "Dummy" 10 | @dummy_class.has_attached_file :avatar 11 | end 12 | 13 | context "of limited size" do 14 | setup{ @matcher = self.class.validate_attachment_size(:avatar).in(256..1024) } 15 | 16 | should "reject a class with no validation" do 17 | assert_rejects @matcher, @dummy_class 18 | end 19 | 20 | should "reject a class with a validation that's too high" do 21 | @dummy_class.validates_attachment_size :avatar, :in => 256..2048 22 | assert_rejects @matcher, @dummy_class 23 | end 24 | 25 | should "reject a class with a validation that's too low" do 26 | @dummy_class.validates_attachment_size :avatar, :in => 0..1024 27 | assert_rejects @matcher, @dummy_class 28 | end 29 | 30 | should "accept a class with a validation that matches" do 31 | @dummy_class.validates_attachment_size :avatar, :in => 256..1024 32 | assert_accepts @matcher, @dummy_class 33 | end 34 | end 35 | 36 | context "validates_attachment_size with infinite range" do 37 | setup{ @matcher = self.class.validate_attachment_size(:avatar) } 38 | 39 | should "accept a class with an upper limit" do 40 | @dummy_class.validates_attachment_size :avatar, :less_than => 1 41 | assert_accepts @matcher, @dummy_class 42 | end 43 | 44 | should "accept a class with no upper limit" do 45 | @dummy_class.validates_attachment_size :avatar, :greater_than => 1 46 | assert_accepts @matcher, @dummy_class 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /vendor/plugins/paperclip/test/processor_test.rb: -------------------------------------------------------------------------------- 1 | require 'test/helper' 2 | 3 | class ProcessorTest < Test::Unit::TestCase 4 | should "instantiate and call #make when sent #make to the class" do 5 | processor = mock 6 | processor.expects(:make).with() 7 | Paperclip::Processor.expects(:new).with(:one, :two, :three).returns(processor) 8 | Paperclip::Processor.make(:one, :two, :three) 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /vendor/plugins/permalink_fu/README.markdown: -------------------------------------------------------------------------------- 1 | # PermalinkFu 2 | 3 | A simple plugin for creating URL-friendly permalinks (slugs) from attributes. 4 | 5 | Uses [`ActiveSupport::Multibyte::Handlers::UTF8Handler`](http://api.rubyonrails.org/classes/ActiveSupport/Multibyte/Handlers/UTF8Handler.html) (part of Rails since 1.2) rather than `iconv` (which is [inconsistent between platforms](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243426)) for normalization/decomposition. 6 | 7 | 8 | ## Usage 9 | 10 | class Article < ActiveRecord::Base 11 | has_permalink :title 12 | end 13 | 14 | This will escape the title in a before_validation callback, turning e.g. "Föö!! Bàr" into "foo-bar". 15 | 16 | The permalink is by default stored in the `permalink` attribute. 17 | 18 | has_permalink :title, :as => :slug 19 | 20 | will store it in `slug` instead. 21 | 22 | has_permalink [:category, :title] 23 | 24 | will store a permalink form of `"#{category}-#{title}"`. 25 | 26 | Permalinks are guaranteed unique: "foo-bar-2", "foo-bar-3" etc are used if there are conflicts. You can set the scope of the uniqueness like 27 | 28 | has_permalink :title, :scope => :blog_id 29 | 30 | This means that two articles with the same `blog_id` can not have the same permalink, but two articles with different `blog_id`s can. 31 | 32 | Two finders are provided: 33 | 34 | Article.find_by_permalink(params[:id]) 35 | Article.find_by_permalink!(params[:id]) 36 | 37 | These methods keep their name no matter what attribute is used to store the permalink. 38 | 39 | The `find_by_permalink` method returns `nil` if there is no match; the `find_by_permalink!` method will raise `ActiveRecord::RecordNotFound`. 40 | 41 | You can override the model's `to_param` method with 42 | 43 | has_permalink :title, :param => true 44 | 45 | This means that the permalink will be used instead of the primary key (id) in generated URLs. Remember to change your controller code from e.g. `find` to `find_by_permalink!`. 46 | 47 | You can add conditions to `has_permalink` like so: 48 | 49 | class Article < ActiveRecord::Base 50 | has_permalink :title, :if => Proc.new { |article| article.needs_permalink? } 51 | end 52 | 53 | Use the `:if` or `:unless` options to specify a Proc, method, or string to be called or evaluated. The permalink will only be generated if the option evaluates to true. 54 | 55 | You can use `PermalinkFu.escape` to escape a string manually. 56 | 57 | 58 | ## Credits 59 | 60 | Originally extracted from [Mephisto](http://mephistoblog.com) by [technoweenie](http://github.com/technoweenie/permalink_fu/). 61 | 62 | Conditions added by [Pat Nakajima](http://github.com/nakajima/permalink_fu/). 63 | 64 | [Henrik Nyh](http://github.com/technoweenie/permalink_fu/) replaced `iconv` with `ActiveSupport::Multibyte`. 65 | -------------------------------------------------------------------------------- /vendor/plugins/permalink_fu/init.rb: -------------------------------------------------------------------------------- 1 | ActiveRecord::Base.send :include, PermalinkFu -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/README: -------------------------------------------------------------------------------- 1 | SimpleCaptcha 2 | 3 | Git mirror of simple_captcha v1. 4 | 5 | Website: http://expressica.com/simple_captcha/ 6 | Svn: svn://rubyforge.org/var/svn/expressica/plugins/simple_captcha 7 | 8 | Copyright (c) 2008 [Sur http://expressica.com] 9 | 10 | Author: Sur 11 | Contributors: http://vinsol.com/team, Kei Kusakari, nap -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/Rakefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'rake' 4 | require 'rake/testtask' 5 | require 'rake/rdoctask' 6 | 7 | desc 'Default: run unit tests.' 8 | task :default => :test 9 | 10 | desc 'Test the simple_captcha plugin.' 11 | Rake::TestTask.new(:test) do |t| 12 | t.libs << 'lib' 13 | t.pattern = 'test/**/*_test.rb' 14 | t.verbose = true 15 | end 16 | 17 | desc 'Generate documentation for the simple_captcha plugin.' 18 | Rake::RDocTask.new(:rdoc) do |rdoc| 19 | rdoc.rdoc_dir = 'rdoc' 20 | rdoc.title = 'SimpleCaptcha' 21 | rdoc.options << '--line-numbers' << '--inline-source' 22 | rdoc.rdoc_files.include('README') 23 | rdoc.rdoc_files.include('lib/**/*.rb') 24 | end 25 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/assets/migrate/create_simple_captcha_data.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | class CreateSimpleCaptchaData < ActiveRecord::Migration 4 | def self.up 5 | create_table :simple_captcha_data do |t| 6 | t.string :key, :limit => 40 7 | t.string :value, :limit => 6 8 | t.timestamps 9 | end 10 | end 11 | 12 | def self.down 13 | drop_table :simple_captcha_data 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/assets/migrate/create_simple_captcha_data_less_than_2.0.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | class CreateSimpleCaptchaData < ActiveRecord::Migration 4 | def self.up 5 | create_table :simple_captcha_data do |t| 6 | t.column :key, :string, :limit => 40 7 | t.column :value, :string, :limit => 6 8 | t.column :created_at, :datetime 9 | t.column :updated_at, :datetime 10 | end 11 | end 12 | 13 | def self.down 14 | drop_table :simple_captcha_data 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/assets/views/simple_captcha/_simple_captcha.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 27 | 28 |
29 | <%= @simple_captcha_options[:image] %> 30 | <%= @simple_captcha_options[:field] %> 31 | <%= @simple_captcha_options[:label] %> 32 |
-------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/init.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'simple_captcha_setup' 4 | require 'simple_captcha_config' 5 | require 'simple_captcha_image' 6 | require 'simple_captcha_action_view' 7 | require 'simple_captcha_action_controller' 8 | require 'simple_captcha_active_record' 9 | require 'simple_captcha_controller' 10 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/install.rb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_action_controller.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | module SimpleCaptcha #:nodoc 4 | module ControllerHelpers #:nodoc 5 | 6 | include ConfigTasks 7 | 8 | # This method is to validate the simple captcha in controller. 9 | # It means when the captcha is controller based i.e. :object has not been passed to the method show_simple_captcha. 10 | # 11 | # *Example* 12 | # 13 | # If you want to save an object say @user only if the captcha is validated then do like this in action... 14 | # 15 | # if simple_captcha_valid? 16 | # @user.save 17 | # else 18 | # flash[:notice] = "captcha did not match" 19 | # redirect_to :action => "myaction" 20 | # end 21 | def simple_captcha_valid? 22 | return true if RAILS_ENV == 'test' 23 | if params[:captcha] 24 | data = simple_captcha_value 25 | result = data == params[:captcha].delete(" ").upcase 26 | simple_captcha_passed! if result 27 | return result 28 | else 29 | return false 30 | end 31 | end 32 | 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_action_view.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | module SimpleCaptcha #:nodoc 4 | module ViewHelpers #:nodoc 5 | 6 | include ConfigTasks 7 | 8 | # Simple Captcha is a very simplified captcha. 9 | # 10 | # It can be used as a *Model* or a *Controller* based Captcha depending on what options 11 | # we are passing to the method show_simple_captcha. 12 | # 13 | # *show_simple_captcha* method will return the image, the label and the text box. 14 | # This method should be called from the view within your form as... 15 | # 16 | # <%= show_simple_captcha %> 17 | # 18 | # The available options to pass to this method are 19 | # * label 20 | # * image_syle 21 | # * object 22 | # * distortion 23 | # 24 | # Label: 25 | # 26 | # default label is "type the text from the image", it can be modified by passing :label as 27 | # 28 | # <%= show_simple_captcha(:label => "new captcha label") %>. 29 | # 30 | # Image Style: 31 | # 32 | # There are eight different styles of images available as... 33 | # * embosed_silver 34 | # * simply_red 35 | # * simply_green 36 | # * simply_blue 37 | # * distorted_black 38 | # * all_black 39 | # * charcoal_grey 40 | # * almost_invisible 41 | # 42 | # The default image is simply_blue and can be modified by passing any of the above style as... 43 | # 44 | # <%= show_simple_captcha(:image_style => "simply_red") %> 45 | # 46 | # The images can also be selected randomly by using *random* in the image_style as 47 | # 48 | # <%= show_simple_captcha(:image_style => "random") %> 49 | # 50 | # *Object* 51 | # 52 | # This option is needed to create a model based captcha. 53 | # If this option is not provided, the captcha will be controller based and 54 | # should be checked in controller's action just by calling the method simple_captcha_valid? 55 | # 56 | # To make a model based captcha give this option as... 57 | # 58 | # <%= show_simple_captcha(:object => "user") %> 59 | # and also call the method apply_simple_captcha in the model 60 | # this will consider "user" as the object of the model class. 61 | # 62 | # *Examples* 63 | # * controller based 64 | # <%= show_simple_captcha(:image_style => "embosed_silver", :label => "Human Authentication: type the text from image above") %> 65 | # * model based 66 | # <%= show_simple_captcha(:object => "person", :image_style => "simply_blue", :label => "Human Authentication: type the text from image above") %> 67 | # 68 | # Find more detailed examples with sample images here on my blog http://EXPRESSICA.com 69 | # 70 | # All Feedbacks/CommentS/Issues/Queries are welcome. 71 | def show_simple_captcha(options={}) 72 | options[:field_value] = set_simple_captcha_data(options[:code_type]) 73 | @simple_captcha_options = 74 | {:image => simple_captcha_image(options), 75 | :label => options[:label] || "", 76 | :field => simple_captcha_field(options)} 77 | render :partial => 'simple_captcha/simple_captcha' 78 | end 79 | 80 | private 81 | 82 | def simple_captcha_image(options={}) 83 | url = 84 | simple_captcha_url( 85 | :action => 'simple_captcha', 86 | :simple_captcha_key => simple_captcha_key, 87 | :image_style => options[:image_style] || '', 88 | :distortion => options[:distortion] || '', 89 | :time => Time.now.to_i) 90 | "simple_captcha.jpg" 91 | end 92 | 93 | def simple_captcha_field(options={}) 94 | options[:object] ? 95 | text_field(options[:object], :captcha, :value => '') + 96 | hidden_field(options[:object], :captcha_key, {:value => options[:field_value]}) : 97 | text_field_tag(:captcha) 98 | end 99 | 100 | def set_simple_captcha_data(code_type) 101 | key, value = simple_captcha_key, generate_simple_captcha_data(code_type) 102 | data = SimpleCaptchaData.get_data(key) 103 | data.value = value 104 | data.save 105 | key 106 | end 107 | 108 | def generate_simple_captcha_data(code) 109 | value = '' 110 | case code 111 | when 'numeric' 112 | 6.times{value << (48 + rand(10)).chr} 113 | else 114 | 6.times{value << (65 + rand(26)).chr} 115 | end 116 | return value 117 | end 118 | 119 | end 120 | end 121 | 122 | ActionView::Base.module_eval do 123 | include SimpleCaptcha::ViewHelpers 124 | end 125 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_active_record.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | module SimpleCaptcha #:nodoc 4 | module ModelHelpers #:nodoc 5 | 6 | # To implement model based simple captcha use this method in the model as... 7 | # 8 | # class User < ActiveRecord::Base 9 | # 10 | # apply_simple_captcha :message => "my customized message" 11 | # 12 | # end 13 | # 14 | # Customize the error message by using :message, the default message is "Captcha did not match". 15 | # As in the applications captcha is needed with a very few cases like signing up the new user, but 16 | # not every time you need to authenticate the captcha with @user.save. So as to maintain simplicity 17 | # here we have the explicit method to save the instace with captcha validation as... 18 | # 19 | # * to validate the instance 20 | # 21 | # @user.valid_with_captcha? # whene captcha validation is required. 22 | # 23 | # @user.valid? # when captcha validation is not required. 24 | # 25 | # * to save the instance 26 | # 27 | # @user.save_with_captcha # whene captcha validation is required. 28 | # 29 | # @user.save # when captcha validation is not required. 30 | module ClassMethods 31 | def apply_simple_captcha(options = {}) 32 | instance_variable_set(:@add_to_base, options[:add_to_base]) 33 | instance_variable_set(:@captcha_invalid_message, options[:message] || "Secret Code did not match with the Image") 34 | module_eval do 35 | include SimpleCaptcha::ConfigTasks 36 | attr_accessor :captcha, :captcha_key, :authenticate_with_captcha 37 | alias_method :valid_without_captcha?, :valid? 38 | alias_method :save_without_captcha, :save 39 | include SimpleCaptcha::ModelHelpers::InstanceMethods 40 | end 41 | end 42 | end 43 | 44 | module InstanceMethods 45 | def valid? 46 | return valid_without_captcha? if RAILS_ENV == 'test' 47 | if authenticate_with_captcha 48 | ret = valid_without_captcha? 49 | if captcha && captcha.upcase.delete(" ") == simple_captcha_value(captcha_key) 50 | ret = ret && true 51 | else 52 | ret = false 53 | self.class.instance_variable_get(:@add_to_base) == true ? 54 | self.errors.add_to_base(self.class.instance_variable_get(:@captcha_invalid_message)) : 55 | self.errors.add(:captcha, self.class.instance_variable_get(:@captcha_invalid_message)) 56 | end 57 | simple_captcha_passed!(captcha_key) if ret 58 | return ret 59 | else 60 | return valid_without_captcha? 61 | end 62 | end 63 | 64 | def valid_with_captcha? 65 | return valid_without_captcha? if RAILS_ENV == 'test' 66 | self.authenticate_with_captcha = true 67 | ret = self.valid? 68 | self.authenticate_with_captcha = false 69 | ret 70 | end 71 | 72 | def save_with_captcha 73 | self.authenticate_with_captcha = true 74 | ret = self.save_without_captcha 75 | self.authenticate_with_captcha = false 76 | ret 77 | end 78 | 79 | def save(check_validations=true) 80 | self.authenticate_with_captcha = false 81 | self.save_without_captcha(check_validations) 82 | end 83 | end 84 | end 85 | end 86 | 87 | ActiveRecord::Base.module_eval do 88 | extend SimpleCaptcha::ModelHelpers::ClassMethods 89 | end 90 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_config.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'digest/sha1' 4 | 5 | module SimpleCaptcha #:nodoc 6 | module ConfigTasks #:nodoc 7 | 8 | private 9 | 10 | def simple_captcha_image_path #:nodoc 11 | "#{RAILS_ROOT}/vendor/plugins/simple_captcha/assets/images/simple_captcha/" 12 | end 13 | 14 | def simple_captcha_key #:nodoc 15 | session[:simple_captcha] ||= Digest::SHA1.hexdigest(Time.now.to_s + session.session_id.to_s) 16 | end 17 | 18 | def simple_captcha_value(key = simple_captcha_key) #:nodoc 19 | SimpleCaptchaData.get_data(key).value rescue nil 20 | end 21 | 22 | def simple_captcha_passed!(key = simple_captcha_key) #:nodoc 23 | SimpleCaptchaData.remove_data(key) 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_controller.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | class SimpleCaptchaController < ActionController::Base 4 | 5 | include SimpleCaptcha::ImageHelpers 6 | 7 | def simple_captcha #:nodoc 8 | send_data( 9 | generate_simple_captcha_image( 10 | :image_style => params[:image_style], 11 | :distortion => params[:distortion], 12 | :simple_captcha_key => params[:simple_captcha_key]), 13 | :type => 'image/jpeg', 14 | :disposition => 'inline', 15 | :filename => 'simple_captcha.jpg') 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_data.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | class SimpleCaptchaData < ActiveRecord::Base 4 | set_table_name "simple_captcha_data" 5 | 6 | class << self 7 | def get_data(key) 8 | data = find_by_key(key) || new(:key => key) 9 | end 10 | 11 | def remove_data(key) 12 | clear_old_data 13 | data = find_by_key(key) 14 | data.destroy if data 15 | end 16 | 17 | def clear_old_data(time = 1.hour.ago) 18 | return unless Time === time 19 | destroy_all("updated_at < '#{time.to_s(:db)}'") 20 | end 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_image.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'rubygems' 4 | require 'RMagick' 5 | 6 | module SimpleCaptcha #:nodoc 7 | module ImageHelpers #:nodoc 8 | 9 | include ConfigTasks 10 | 11 | IMAGE_STYLES = [ 12 | 'embosed_silver', 13 | 'simply_red', 14 | 'simply_green', 15 | 'simply_blue', 16 | 'distorted_black', 17 | 'all_black', 18 | 'charcoal_grey', 19 | 'almost_invisible' 20 | ] 21 | 22 | DISTORTIONS = ['low', 'medium', 'high'] 23 | 24 | class << self 25 | def image_style(key='simply_blue') 26 | return IMAGE_STYLES[rand(IMAGE_STYLES.length)] if key=='random' 27 | IMAGE_STYLES.include?(key) ? key : 'simply_blue' 28 | end 29 | 30 | def distortion(key='low') 31 | key = 32 | key == 'random' ? 33 | DISTORTIONS[rand(DISTORTIONS.length)] : 34 | DISTORTIONS.include?(key) ? key : 'low' 35 | case key 36 | when 'low' then return [0 + rand(2), 80 + rand(20)] 37 | when 'medium' then return [2 + rand(2), 50 + rand(20)] 38 | when 'high' then return [4 + rand(2), 30 + rand(20)] 39 | end 40 | end 41 | end 42 | 43 | private 44 | 45 | def append_simple_captcha_code #:nodoc 46 | color = @simple_captcha_image_options[:color] 47 | text = Magick::Draw.new 48 | text.annotate(@image, 0, 0, 0, 5, simple_captcha_value(@simple_captcha_image_options[:simple_captcha_key])) do 49 | self.font_family = 'arial' 50 | self.pointsize = 22 51 | self.fill = color 52 | self.gravity = Magick::CenterGravity 53 | end 54 | end 55 | 56 | def set_simple_captcha_image_style #:nodoc 57 | amplitude, frequency = @simple_captcha_image_options[:distortion] 58 | case @simple_captcha_image_options[:image_style] 59 | when 'embosed_silver' 60 | append_simple_captcha_code 61 | @image = @image.wave(amplitude, frequency).shade(true, 20, 60) 62 | when 'simply_red' 63 | @simple_captcha_image_options[:color] = 'darkred' 64 | append_simple_captcha_code 65 | @image = @image.wave(amplitude, frequency) 66 | when 'simply_green' 67 | @simple_captcha_image_options[:color] = 'darkgreen' 68 | append_simple_captcha_code 69 | @image = @image.wave(amplitude, frequency) 70 | when 'simply_blue' 71 | append_simple_captcha_code 72 | @image = @image.wave(amplitude, frequency) 73 | when 'distorted_black' 74 | append_simple_captcha_code 75 | @image = @image.wave(amplitude, frequency).edge(10) 76 | when 'all_black' 77 | append_simple_captcha_code 78 | @image = @image.wave(amplitude, frequency).edge(2) 79 | when 'charcoal_grey' 80 | append_simple_captcha_code 81 | @image = @image.wave(amplitude, frequency).charcoal 82 | when 'almost_invisible' 83 | @simple_captcha_image_options[:color] = 'red' 84 | append_simple_captcha_code 85 | @image = @image.wave(amplitude, frequency).solarize 86 | else 87 | append_simple_captcha_code 88 | @image = @image.wave(amplitude, frequency) 89 | end 90 | end 91 | 92 | def generate_simple_captcha_image(options={}) #:nodoc 93 | @image = Magick::Image.new(110, 30) do 94 | self.background_color = 'white' 95 | self.format = 'JPG' 96 | end 97 | @simple_captcha_image_options = { 98 | :simple_captcha_key => options[:simple_captcha_key], 99 | :color => 'darkblue', 100 | :distortion => SimpleCaptcha::ImageHelpers.distortion(options[:distortion]), 101 | :image_style => SimpleCaptcha::ImageHelpers.image_style(options[:image_style]) 102 | } 103 | set_simple_captcha_image_style 104 | @image.implode(0.2).to_blob 105 | end 106 | 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/lib/simple_captcha_setup.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | 3 | module SimpleCaptcha #:nodoc 4 | module SetupTasks #:nodoc 5 | 6 | def self.do_setup(version = :new) 7 | @version = version 8 | 9 | begin 10 | puts "STEP 1" 11 | generate_migration 12 | write_migration_content 13 | copy_view_file 14 | puts "Followup Steps" 15 | puts "STEP 2 -- run the task 'rake db:migrate'" 16 | puts "STEP 3 -- edit the file config/routes.rb to add the route \"map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'\"" 17 | rescue StandardError => e 18 | p e 19 | end 20 | end 21 | 22 | private 23 | 24 | def self.generate_migration 25 | puts "===============================================================================" 26 | puts "ruby script/generate migration create_simple_captcha_data" 27 | puts %x{ruby script/generate migration create_simple_captcha_data} 28 | puts "================================DONE===========================================" 29 | end 30 | 31 | def self.migration_source_file 32 | @version == :old ? 33 | File.join(File.dirname(__FILE__), "../assets", "migrate", "create_simple_captcha_data_less_than_2.0.rb") : 34 | File.join(File.dirname(__FILE__), "../assets", "migrate", "create_simple_captcha_data.rb") 35 | end 36 | 37 | def self.write_migration_content 38 | copy_to_path = File.join(RAILS_ROOT, "db", "migrate") 39 | migration_filename = 40 | Dir.entries(copy_to_path).collect do |file| 41 | number, *name = file.split("_") 42 | file if name.join("_") == "create_simple_captcha_data.rb" 43 | end.compact.first 44 | migration_file = File.join(copy_to_path, migration_filename) 45 | File.open(migration_file, "wb"){|f| f.write(File.read(migration_source_file))} 46 | end 47 | 48 | def self.copy_view_file 49 | puts "Copying SimpleCaptcha view file." 50 | mkdir(File.join(RAILS_ROOT, "app/views/simple_captcha")) unless File.exist?(File.join(RAILS_ROOT, "app/views/simple_captcha")) 51 | view_file = @version == :old ? '_simple_captcha.rhtml' : '_simple_captcha.erb' 52 | FileUtils.cp_r( 53 | File.join(File.dirname(__FILE__), "../assets/views/simple_captcha/_simple_captcha.erb"), 54 | File.join(RAILS_ROOT, "app/views/simple_captcha/", view_file) 55 | ) 56 | puts "================================DONE===========================================" 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/tasks/simple_captcha_tasks.rake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'fileutils' 4 | 5 | namespace :simple_captcha do 6 | desc "Set up the plugin SimpleCaptcha for rails < 2.0" 7 | task :setup_old => :environment do 8 | SimpleCaptcha::SetupTasks.do_setup(:old) 9 | end 10 | 11 | desc "Set up the plugin SimpleCaptcha for rails >= 2.0" 12 | task :setup => :environment do 13 | SimpleCaptcha::SetupTasks.do_setup 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor/plugins/simple_captcha/test/simple_captcha_test.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008 [Sur http://expressica.com] 2 | 3 | require 'test/unit' 4 | 5 | class SimpleCaptchaTest < Test::Unit::TestCase 6 | # Replace this with your real tests. 7 | def test_this_plugin 8 | flunk 9 | end 10 | end 11 | --------------------------------------------------------------------------------