Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Split off wiki page gems. Also fix testing code.

  • Loading branch information...
commit 995c0b975bd45939abb030e19efdb15a44ce365f 1 parent 039f20b
@jamesu authored
Showing with 36 additions and 4,173 deletions.
  1. +3 −0  Gemfile
  2. +13 −0 Gemfile.lock
  3. +6 −11 app/controllers/wiki_pages_controller.rb
  4. +11 −11 app/models/wiki_page.rb
  5. +2 −2 app/models/wiki_page_user.rb
  6. +1 −0  test/test_helper.rb
  7. +0 −82 vendor/plugins/acts_as_versioned/CHANGELOG
  8. +0 −20 vendor/plugins/acts_as_versioned/MIT-LICENSE
  9. +0 −28 vendor/plugins/acts_as_versioned/README
  10. +0 −41 vendor/plugins/acts_as_versioned/RUNNING_UNIT_TESTS
  11. +0 −180 vendor/plugins/acts_as_versioned/Rakefile
  12. +0 −4 vendor/plugins/acts_as_versioned/VERSION.yml
  13. +0 −29 vendor/plugins/acts_as_versioned/acts_as_versioned.gemspec
  14. +0 −1  vendor/plugins/acts_as_versioned/init.rb
  15. +0 −486 vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb
  16. +0 −48 vendor/plugins/acts_as_versioned/test/abstract_unit.rb
  17. +0 −18 vendor/plugins/acts_as_versioned/test/database.yml
  18. +0 −6 vendor/plugins/acts_as_versioned/test/fixtures/authors.yml
  19. +0 −3  vendor/plugins/acts_as_versioned/test/fixtures/landmark.rb
  20. +0 −7 vendor/plugins/acts_as_versioned/test/fixtures/landmark_versions.yml
  21. +0 −7 vendor/plugins/acts_as_versioned/test/fixtures/landmarks.yml
  22. +0 −10 vendor/plugins/acts_as_versioned/test/fixtures/locked_pages.yml
  23. +0 −27 vendor/plugins/acts_as_versioned/test/fixtures/locked_pages_revisions.yml
  24. +0 −15 vendor/plugins/acts_as_versioned/test/fixtures/migrations/1_add_versioned_tables.rb
  25. +0 −43 vendor/plugins/acts_as_versioned/test/fixtures/page.rb
  26. +0 −16 vendor/plugins/acts_as_versioned/test/fixtures/page_versions.yml
  27. +0 −8 vendor/plugins/acts_as_versioned/test/fixtures/pages.yml
  28. +0 −6 vendor/plugins/acts_as_versioned/test/fixtures/widget.rb
  29. +0 −46 vendor/plugins/acts_as_versioned/test/migration_test.rb
  30. +0 −82 vendor/plugins/acts_as_versioned/test/schema.rb
  31. +0 −370 vendor/plugins/acts_as_versioned/test/versioned_test.rb
  32. +0 −172 vendor/plugins/friendly_id/History.txt
  33. +0 −19 vendor/plugins/friendly_id/MIT-LICENSE
  34. +0 −42 vendor/plugins/friendly_id/Manifest.txt
  35. +0 −384 vendor/plugins/friendly_id/README.rdoc
  36. +0 −46 vendor/plugins/friendly_id/Rakefile
  37. +0 −2  vendor/plugins/friendly_id/config/website.yml
  38. +0 −3  vendor/plugins/friendly_id/extras/README
  39. +0 −26 vendor/plugins/friendly_id/extras/template-gem.rb
  40. +0 −28 vendor/plugins/friendly_id/extras/template-plugin.rb
  41. +0 −28 vendor/plugins/friendly_id/generators/friendly_id/friendly_id_generator.rb
  42. +0 −18 vendor/plugins/friendly_id/generators/friendly_id/templates/create_slugs.rb
  43. +0 −12 vendor/plugins/friendly_id/generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb
  44. +0 −19 vendor/plugins/friendly_id/generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb
  45. +0 −1  vendor/plugins/friendly_id/init.rb
  46. +0 −75 vendor/plugins/friendly_id/lib/friendly_id.rb
  47. +0 −12 vendor/plugins/friendly_id/lib/friendly_id/helpers.rb
  48. +0 −33 vendor/plugins/friendly_id/lib/friendly_id/non_sluggable_class_methods.rb
  49. +0 −45 vendor/plugins/friendly_id/lib/friendly_id/non_sluggable_instance_methods.rb
  50. +0 −98 vendor/plugins/friendly_id/lib/friendly_id/slug.rb
  51. +0 −110 vendor/plugins/friendly_id/lib/friendly_id/sluggable_class_methods.rb
  52. +0 −145 vendor/plugins/friendly_id/lib/friendly_id/sluggable_instance_methods.rb
  53. +0 −56 vendor/plugins/friendly_id/lib/friendly_id/tasks.rb
  54. +0 −8 vendor/plugins/friendly_id/lib/friendly_id/version.rb
  55. +0 −25 vendor/plugins/friendly_id/lib/tasks/friendly_id.rake
  56. +0 −1  vendor/plugins/friendly_id/lib/tasks/friendly_id.rb
  57. +0 −112 vendor/plugins/friendly_id/test/cached_slug_test.rb
  58. +0 −94 vendor/plugins/friendly_id/test/contest.rb
  59. +0 −38 vendor/plugins/friendly_id/test/custom_slug_normalizer_test.rb
  60. +0 −2  vendor/plugins/friendly_id/test/models/book.rb
  61. +0 −4 vendor/plugins/friendly_id/test/models/city.rb
  62. +0 −4 vendor/plugins/friendly_id/test/models/country.rb
  63. +0 −3  vendor/plugins/friendly_id/test/models/district.rb
  64. +0 −3  vendor/plugins/friendly_id/test/models/event.rb
  65. +0 −4 vendor/plugins/friendly_id/test/models/legacy_thing.rb
  66. +0 −3  vendor/plugins/friendly_id/test/models/novel.rb
  67. +0 −6 vendor/plugins/friendly_id/test/models/person.rb
  68. +0 −6 vendor/plugins/friendly_id/test/models/post.rb
  69. +0 −6 vendor/plugins/friendly_id/test/models/thing.rb
  70. +0 −3  vendor/plugins/friendly_id/test/models/user.rb
  71. +0 −101 vendor/plugins/friendly_id/test/non_slugged_test.rb
  72. +0 −70 vendor/plugins/friendly_id/test/schema.rb
  73. +0 −56 vendor/plugins/friendly_id/test/scoped_model_test.rb
  74. +0 −106 vendor/plugins/friendly_id/test/slug_test.rb
  75. +0 −342 vendor/plugins/friendly_id/test/slugged_model_test.rb
  76. +0 −51 vendor/plugins/friendly_id/test/sti_test.rb
  77. +0 −106 vendor/plugins/friendly_id/test/tasks_test.rb
  78. +0 −38 vendor/plugins/friendly_id/test/test_helper.rb
View
3  Gemfile
@@ -11,7 +11,10 @@ gem 'dynamic_form'
gem 'will_paginate', '~> 3.0'
gem 'RedCloth'
gem 'icalendar'
+gem 'faker'
gem 'factory_girl'
+gem 'friendly_id', '~> 4.0.0.beta8'
+gem 'acts_as_versioned', :git => "git://github.com/firien/acts_as_versioned.git"
gem 'jquery-rails', '>= 1.0.12'
#group :test, :development do
View
13 Gemfile.lock
@@ -1,4 +1,11 @@
GIT
+ remote: git://github.com/firien/acts_as_versioned.git
+ revision: f7eaf9b32c030fe46585bc7984de622e7a02bd63
+ specs:
+ acts_as_versioned (0.6.0)
+ activerecord (>= 3.0.0)
+
+GIT
remote: git://github.com/teambox/choices.git
revision: 93d0cfb4e5fd4ae03b421b379a69ee00721f337b
specs:
@@ -50,6 +57,9 @@ GEM
execjs (1.2.0)
multi_json (~> 1.0)
factory_girl (1.3.3)
+ faker (0.9.5)
+ i18n (~> 0.4)
+ friendly_id (4.0.0.beta12)
haml (3.1.2)
hashie (1.0.0)
hike (1.1.0)
@@ -125,10 +135,13 @@ PLATFORMS
DEPENDENCIES
RedCloth
+ acts_as_versioned!
cancan
choices!
dynamic_form
factory_girl
+ faker
+ friendly_id (~> 4.0.0.beta8)
haml
icalendar
jquery-rails (>= 1.0.12)
View
17 app/controllers/wiki_pages_controller.rb
@@ -20,7 +20,6 @@ class WikiPagesController < ApplicationController
layout 'project_website'
before_filter :process_session
- before_filter :set_created_by, :only => [:create, :update]
before_filter :find_sidebar_page, :only => [:index, :show]
after_filter :user_track, :only => [:index, :show]
@@ -56,10 +55,10 @@ def show
end
def create
- @wiki_page = wiki_pages.new(params[:wiki_page])
+ @wiki_page = wiki_pages.new(params[:wiki_page].merge(:created_by => @logged_user))
if @wiki_page.save
- flash[:message] = I18n.t :success_creating_wiki_page, :scope => :wiki_engine
+ flash[:message] = I18n.t 'wiki_engine.success_creating_wiki_page'
redirect_to @wiki_page.main ? wiki_pages_path : wiki_page_path(:id => @wiki_page)
else
render :action => 'new'
@@ -70,8 +69,8 @@ def edit
end
def update
- if @wiki_page.update_attributes(params[:wiki_page])
- flash[:message] = I18n.t :success_updating_wiki_page, :scope => :wiki_engine
+ if @wiki_page.update_attributes(params[:wiki_page].merge(:created_by => @logged_user))
+ flash[:message] = I18n.t 'wiki_engine.success_updating_wiki_page'
redirect_to @wiki_page.main ? wiki_pages_path : wiki_page_path(:id => @wiki_page)
else
render :action => 'edit'
@@ -81,7 +80,7 @@ def update
def destroy
@wiki_page.destroy
- flash[:message] = I18n.t :success_deleting_wiki_page, :scope => :wiki_engine
+ flash[:message] = I18n.t 'wiki_engine.success_deleting_wiki_page'
redirect_to wiki_pages_path
end
@@ -106,7 +105,7 @@ def find_wiki_page
# Find main wiki page. This is by default used only for index action.
def find_main_wiki_page
- @wiki_page = wiki_pages.main.first
+ @wiki_page = wiki_pages.main(@active_project).first
end
# Find all wiki pages. This is by default used only for list action.
@@ -132,10 +131,6 @@ def check_delete_permissions
authorize! :delete, @wiki_page
end
- def set_created_by
- params[:wiki_page][:created_by] = @logged_user
- end
-
def wiki_pages
@active_project.wiki_pages
end
View
22 app/models/wiki_page.rb
@@ -1,10 +1,11 @@
class WikiPage < ActiveRecord::Base
+ extend FriendlyId
include Rails.application.routes.url_helpers
include WikiPageUser
before_save :set_main_page
acts_as_versioned :extend => WikiPageUser
- has_friendly_id :title, :use_slug => true, :strip_diacritics => true
+ friendly_id :title, :use => :slugged, :slug_column => :title
validates_presence_of :title
def title_from_id=(id)
@@ -12,8 +13,6 @@ def title_from_id=(id)
end
belongs_to :project
- # self.friendly_id_options[:scope] = :project
- self.friendly_id_options[:scope] = :scope_value
self.non_versioned_columns << :project_id
scope :main, lambda{ |project| where(:main => true, :project_id => project.id) }
@@ -22,36 +21,37 @@ def title_from_id=(id)
before_destroy :process_destroy
def scope_value
- self.project.id.to_s
+ project.id.to_s
end
def process_create
- Activity.new_log(self, self.created_by, :add)
+ Activity.new_log(self, created_by, :add)
end
def process_update_params
- Activity.new_log(self, self.created_by, :edit)
+ Activity.new_log(self, created_by, :edit)
end
def process_destroy
- Activity.new_log(self, self.created_by, :delete)
+ Activity.new_log(self, created_by, :delete)
end
def object_name
- self.title
+ title
end
def object_url(host = nil)
- url_for :only_path => host.nil?, :host => host, :controller => 'wiki_pages', :action => 'show', :id => self, :active_project => self.project_id
+ url_for :only_path => host.nil?, :host => host, :controller => 'wiki_pages', :action => 'show', :id => self, :active_project => project_id
end
protected
def main_page
- @main_page ||= self.class.main(project).first
+ @main_page ||= WikiPage.main(project).first
end
def set_main_page
- self.main_page.update_attribute :main, false if self.main && !self.main_was && self.main_page
+ main_page.update_attribute :main, false if main && !main_was && main_page
+ true
end
end
View
4 app/models/wiki_page_user.rb
@@ -4,10 +4,10 @@ def self.included(base)
end
def user
- self.created_by
+ created_by
end
def user_name
- user.display_name if self.user
+ user.display_name if user
end
end
View
1  test/test_helper.rb
@@ -1,6 +1,7 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
+require 'factories'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
View
82 vendor/plugins/acts_as_versioned/CHANGELOG
@@ -1,82 +0,0 @@
-*GIT* (version numbers are overrated)
-
-* (16 Jun 2008) Backwards Compatibility is overrated (big updates for rails 2.1)
-
- * Use ActiveRecord 2.1's dirty attribute checking instead [Asa Calow]
- * Remove last traces of #non_versioned_fields
- * Remove AR::Base.find_version and AR::Base.find_versions, rely on AR association proxies and named_scope
- * Remove #versions_count, rely on AR association counter caching.
- * Remove #versioned_attributes, basically the same as AR::Base.versioned_columns
-
-* (5 Oct 2006) Allow customization of #versions association options [Dan Peterson]
-
-*0.5.1*
-
-* (8 Aug 2006) Versioned models now belong to the unversioned model. @article_version.article.class => Article [Aslak Hellesoy]
-
-*0.5* # do versions even matter for plugins?
-
-* (21 Apr 2006) Added without_locking and without_revision methods.
-
- Foo.without_revision do
- @foo.update_attributes ...
- end
-
-*0.4*
-
-* (28 March 2006) Rename non_versioned_fields to non_versioned_columns (old one is kept for compatibility).
-* (28 March 2006) Made explicit documentation note that string column names are required for non_versioned_columns.
-
-*0.3.1*
-
-* (7 Jan 2006) explicitly set :foreign_key option for the versioned model's belongs_to assocation for STI [Caged]
-* (7 Jan 2006) added tests to prove has_many :through joins work
-
-*0.3*
-
-* (2 Jan 2006) added ability to share a mixin with versioned class
-* (2 Jan 2006) changed the dynamic version model to MyModel::Version
-
-*0.2.4*
-
-* (27 Nov 2005) added note about possible destructive behavior of if_changed? [Michael Schuerig]
-
-*0.2.3*
-
-* (12 Nov 2005) fixed bug with old behavior of #blank? [Michael Schuerig]
-* (12 Nov 2005) updated tests to use ActiveRecord Schema
-
-*0.2.2*
-
-* (3 Nov 2005) added documentation note to #acts_as_versioned [Martin Jul]
-
-*0.2.1*
-
-* (6 Oct 2005) renamed dirty? to changed? to keep it uniform. it was aliased to keep it backwards compatible.
-
-*0.2*
-
-* (6 Oct 2005) added find_versions and find_version class methods.
-
-* (6 Oct 2005) removed transaction from create_versioned_table().
- this way you can specify your own transaction around a group of operations.
-
-* (30 Sep 2005) fixed bug where find_versions() would order by 'version' twice. (found by Joe Clark)
-
-* (26 Sep 2005) added :sequence_name option to acts_as_versioned to set the sequence name on the versioned model
-
-*0.1.3* (18 Sep 2005)
-
-* First RubyForge release
-
-*0.1.2*
-
-* check if module is already included when acts_as_versioned is called
-
-*0.1.1*
-
-* Adding tests and rdocs
-
-*0.1*
-
-* Initial transfer from Rails ticket: http://dev.rubyonrails.com/ticket/1974
View
20 vendor/plugins/acts_as_versioned/MIT-LICENSE
@@ -1,20 +0,0 @@
-Copyright (c) 2005 Rick Olson
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
28 vendor/plugins/acts_as_versioned/README
@@ -1,28 +0,0 @@
-= acts_as_versioned
-
-This library adds simple versioning to an ActiveRecord module. ActiveRecord is required.
-
-== Resources
-
-Install
-
-* gem install acts_as_versioned
-
-Rubyforge project
-
-* http://rubyforge.org/projects/ar-versioned
-
-RDocs
-
-* http://ar-versioned.rubyforge.org
-
-Subversion
-
-* http://techno-weenie.net/svn/projects/acts_as_versioned
-
-Collaboa
-
-* http://collaboa.techno-weenie.net/repository/browse/acts_as_versioned
-
-Special thanks to Dreamer on ##rubyonrails for help in early testing. His ServerSideWiki (http://serversidewiki.com)
-was the first project to use acts_as_versioned <em>in the wild</em>.
View
41 vendor/plugins/acts_as_versioned/RUNNING_UNIT_TESTS
@@ -1,41 +0,0 @@
-== Creating the test database
-
-The default name for the test databases is "activerecord_versioned". If you
-want to use another database name then be sure to update the connection
-adapter setups you want to test with in test/connections/<your database>/connection.rb.
-When you have the database online, you can import the fixture tables with
-the test/fixtures/db_definitions/*.sql files.
-
-Make sure that you create database objects with the same user that you specified in i
-connection.rb otherwise (on Postgres, at least) tests for default values will fail.
-
-== Running with Rake
-
-The easiest way to run the unit tests is through Rake. The default task runs
-the entire test suite for all the adapters. You can also run the suite on just
-one adapter by using the tasks test_mysql_ruby, test_ruby_mysql, test_sqlite,
-or test_postresql. For more information, checkout the full array of rake tasks with "rake -T"
-
-Rake can be found at http://rake.rubyforge.org
-
-== Running by hand
-
-Unit tests are located in test directory. If you only want to run a single test suite,
-or don't want to bother with Rake, you can do so with something like:
-
- cd test; ruby -I "connections/native_mysql" base_test.rb
-
-That'll run the base suite using the MySQL-Ruby adapter. Change the adapter
-and test suite name as needed.
-
-== Faster tests
-
-If you are using a database that supports transactions, you can set the
-"AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures.
-This gives a very large speed boost. With rake:
-
- rake AR_TX_FIXTURES=yes
-
-Or, by hand:
-
- AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb
View
180 vendor/plugins/acts_as_versioned/Rakefile
@@ -1,180 +0,0 @@
-require 'rubygems'
-
-require 'rake/rdoctask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/testtask'
-require 'rake/contrib/rubyforgepublisher'
-
-PKG_NAME = 'acts_as_versioned'
-PKG_VERSION = '0.3.1'
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-PROD_HOST = "technoweenie@bidwell.textdrive.com"
-RUBY_FORGE_PROJECT = 'ar-versioned'
-RUBY_FORGE_USER = 'technoweenie'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the calculations plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the calculations plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "#{PKG_NAME} -- Simple versioning with active record models"
- rdoc.options << '--line-numbers --inline-source'
- rdoc.rdoc_files.include('README', 'CHANGELOG', 'RUNNING_UNIT_TESTS')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
-spec = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
- s.platform = Gem::Platform::RUBY
- s.summary = "Simple versioning with active record models"
- s.files = FileList["{lib,test}/**/*"].to_a + %w(README MIT-LICENSE CHANGELOG RUNNING_UNIT_TESTS)
- s.files.delete "acts_as_versioned_plugin.sqlite.db"
- s.files.delete "acts_as_versioned_plugin.sqlite3.db"
- s.files.delete "test/debug.log"
- s.require_path = 'lib'
- s.autorequire = 'acts_as_versioned'
- s.has_rdoc = true
- s.test_files = Dir['test/**/*_test.rb']
- s.add_dependency 'activerecord', '>= 1.10.1'
- s.add_dependency 'activesupport', '>= 1.1.1'
- s.author = "Rick Olson"
- s.email = "technoweenie@gmail.com"
- s.homepage = "http://techno-weenie.net"
-end
-
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.need_tar = true
-end
-
-desc "Publish the API documentation"
-task :pdoc => [:rdoc] do
- Rake::RubyForgePublisher.new(RUBY_FORGE_PROJECT, RUBY_FORGE_USER).upload
-end
-
-desc 'Publish the gem and API docs'
-task :publish => [:pdoc, :rubyforge_upload]
-
-desc "Publish the release files to RubyForge."
-task :rubyforge_upload => :package do
- files = %w(gem tgz).map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
-
- if RUBY_FORGE_PROJECT then
- require 'net/http'
- require 'open-uri'
-
- project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
- project_data = open(project_uri) { |data| data.read }
- group_id = project_data[/[?&]group_id=(\d+)/, 1]
- raise "Couldn't get group id" unless group_id
-
- # This echos password to shell which is a bit sucky
- if ENV["RUBY_FORGE_PASSWORD"]
- password = ENV["RUBY_FORGE_PASSWORD"]
- else
- print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
- password = STDIN.gets.chomp
- end
-
- login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
- data = [
- "login=1",
- "form_loginname=#{RUBY_FORGE_USER}",
- "form_pw=#{password}"
- ].join("&")
- http.post("/account/login.php", data)
- end
-
- cookie = login_response["set-cookie"]
- raise "Login failed" unless cookie
- headers = { "Cookie" => cookie }
-
- release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
- release_data = open(release_uri, headers) { |data| data.read }
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
- raise "Couldn't get package id" unless package_id
-
- first_file = true
- release_id = ""
-
- files.each do |filename|
- basename = File.basename(filename)
- file_ext = File.extname(filename)
- file_data = File.open(filename, "rb") { |file| file.read }
-
- puts "Releasing #{basename}..."
-
- release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
- release_date = Time.now.strftime("%Y-%m-%d %H:%M")
- type_map = {
- ".zip" => "3000",
- ".tgz" => "3110",
- ".gz" => "3110",
- ".gem" => "1400"
- }; type_map.default = "9999"
- type = type_map[file_ext]
- boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
-
- query_hash = if first_file then
- {
- "group_id" => group_id,
- "package_id" => package_id,
- "release_name" => PKG_FILE_NAME,
- "release_date" => release_date,
- "type_id" => type,
- "processor_id" => "8000", # Any
- "release_notes" => "",
- "release_changes" => "",
- "preformatted" => "1",
- "submit" => "1"
- }
- else
- {
- "group_id" => group_id,
- "release_id" => release_id,
- "package_id" => package_id,
- "step2" => "1",
- "type_id" => type,
- "processor_id" => "8000", # Any
- "submit" => "Add This File"
- }
- end
-
- query = "?" + query_hash.map do |(name, value)|
- [name, URI.encode(value)].join("=")
- end.join("&")
-
- data = [
- "--" + boundary,
- "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
- "Content-Type: application/octet-stream",
- "Content-Transfer-Encoding: binary",
- "", file_data, ""
- ].join("\x0D\x0A")
-
- release_headers = headers.merge(
- "Content-Type" => "multipart/form-data; boundary=#{boundary}"
- )
-
- target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
- http.post(target + query, data, release_headers)
- end
-
- if first_file then
- release_id = release_response.body[/release_id=(\d+)/, 1]
- raise("Couldn't get release id") unless release_id
- end
-
- first_file = false
- end
- end
-end
View
4 vendor/plugins/acts_as_versioned/VERSION.yml
@@ -1,4 +0,0 @@
----
-:patch: 2
-:major: 0
-:minor: 5
View
29 vendor/plugins/acts_as_versioned/acts_as_versioned.gemspec
@@ -1,29 +0,0 @@
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{acts_as_versioned}
- s.version = "0.5.2"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["technoweenie"]
- s.date = %q{2009-01-20}
- s.description = %q{TODO}
- s.email = %q{technoweenie@bidwell.textdrive.com}
- s.files = ["VERSION.yml", "lib/acts_as_versioned.rb", "test/abstract_unit.rb", "test/database.yml", "test/fixtures", "test/fixtures/authors.yml", "test/fixtures/landmark.rb", "test/fixtures/landmark_versions.yml", "test/fixtures/landmarks.yml", "test/fixtures/locked_pages.yml", "test/fixtures/locked_pages_revisions.yml", "test/fixtures/migrations", "test/fixtures/migrations/1_add_versioned_tables.rb", "test/fixtures/page.rb", "test/fixtures/page_versions.yml", "test/fixtures/pages.yml", "test/fixtures/widget.rb", "test/migration_test.rb", "test/schema.rb", "test/versioned_test.rb"]
- s.has_rdoc = true
- s.homepage = %q{http://github.com/technoweenie/acts_as_versioned}
- s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.1}
- s.summary = %q{TODO}
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
-end
View
1  vendor/plugins/acts_as_versioned/init.rb
@@ -1 +0,0 @@
-require 'acts_as_versioned'
View
486 vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb
@@ -1,486 +0,0 @@
-# Copyright (c) 2005 Rick Olson
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-module ActiveRecord #:nodoc:
- module Acts #:nodoc:
- # Specify this act if you want to save a copy of the row in a versioned table. This assumes there is a
- # versioned table ready and that your model has a version field. This works with optimistic locking if the lock_version
- # column is present as well.
- #
- # The class for the versioned model is derived the first time it is seen. Therefore, if you change your database schema you have to restart
- # your container for the changes to be reflected. In development mode this usually means restarting WEBrick.
- #
- # class Page < ActiveRecord::Base
- # # assumes pages_versions table
- # acts_as_versioned
- # end
- #
- # Example:
- #
- # page = Page.create(:title => 'hello world!')
- # page.version # => 1
- #
- # page.title = 'hello world'
- # page.save
- # page.version # => 2
- # page.versions.size # => 2
- #
- # page.revert_to(1) # using version number
- # page.title # => 'hello world!'
- #
- # page.revert_to(page.versions.last) # using versioned instance
- # page.title # => 'hello world'
- #
- # page.versions.earliest # efficient query to find the first version
- # page.versions.latest # efficient query to find the most recently created version
- #
- #
- # Simple Queries to page between versions
- #
- # page.versions.before(version)
- # page.versions.after(version)
- #
- # Access the previous/next versions from the versioned model itself
- #
- # version = page.versions.latest
- # version.previous # go back one version
- # version.next # go forward one version
- #
- # See ActiveRecord::Acts::Versioned::ClassMethods#acts_as_versioned for configuration options
- module Versioned
- CALLBACKS = [:set_new_version, :save_version, :save_version?]
- def self.included(base) # :nodoc:
- base.extend ClassMethods
- end
-
- module ClassMethods
- # == Configuration options
- #
- # * <tt>class_name</tt> - versioned model class name (default: PageVersion in the above example)
- # * <tt>table_name</tt> - versioned model table name (default: page_versions in the above example)
- # * <tt>foreign_key</tt> - foreign key used to relate the versioned model to the original model (default: page_id in the above example)
- # * <tt>inheritance_column</tt> - name of the column to save the model's inheritance_column value for STI. (default: versioned_type)
- # * <tt>version_column</tt> - name of the column in the model that keeps the version number (default: version)
- # * <tt>sequence_name</tt> - name of the custom sequence to be used by the versioned model.
- # * <tt>limit</tt> - number of revisions to keep, defaults to unlimited
- # * <tt>if</tt> - symbol of method to check before saving a new version. If this method returns false, a new version is not saved.
- # For finer control, pass either a Proc or modify Model#version_condition_met?
- #
- # acts_as_versioned :if => Proc.new { |auction| !auction.expired? }
- #
- # or...
- #
- # class Auction
- # def version_condition_met? # totally bypasses the <tt>:if</tt> option
- # !expired?
- # end
- # end
- #
- # * <tt>if_changed</tt> - Simple way of specifying attributes that are required to be changed before saving a model. This takes
- # either a symbol or array of symbols.
- #
- # * <tt>extend</tt> - Lets you specify a module to be mixed in both the original and versioned models. You can also just pass a block
- # to create an anonymous mixin:
- #
- # class Auction
- # acts_as_versioned do
- # def started?
- # !started_at.nil?
- # end
- # end
- # end
- #
- # or...
- #
- # module AuctionExtension
- # def started?
- # !started_at.nil?
- # end
- # end
- # class Auction
- # acts_as_versioned :extend => AuctionExtension
- # end
- #
- # Example code:
- #
- # @auction = Auction.find(1)
- # @auction.started?
- # @auction.versions.first.started?
- #
- # == Database Schema
- #
- # The model that you're versioning needs to have a 'version' attribute. The model is versioned
- # into a table called #{model}_versions where the model name is singlular. The _versions table should
- # contain all the fields you want versioned, the same version column, and a #{model}_id foreign key field.
- #
- # A lock_version field is also accepted if your model uses Optimistic Locking. If your table uses Single Table inheritance,
- # then that field is reflected in the versioned model as 'versioned_type' by default.
- #
- # Acts_as_versioned comes prepared with the ActiveRecord::Acts::Versioned::ActMethods::ClassMethods#create_versioned_table
- # method, perfect for a migration. It will also create the version column if the main model does not already have it.
- #
- # class AddVersions < ActiveRecord::Migration
- # def self.up
- # # create_versioned_table takes the same options hash
- # # that create_table does
- # Post.create_versioned_table
- # end
- #
- # def self.down
- # Post.drop_versioned_table
- # end
- # end
- #
- # == Changing What Fields Are Versioned
- #
- # By default, acts_as_versioned will version all but these fields:
- #
- # [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column]
- #
- # You can add or change those by modifying #non_versioned_columns. Note that this takes strings and not symbols.
- #
- # class Post < ActiveRecord::Base
- # acts_as_versioned
- # self.non_versioned_columns << 'comments_count'
- # end
- #
- def acts_as_versioned(options = {}, &extension)
- # don't allow multiple calls
- return if self.included_modules.include?(ActiveRecord::Acts::Versioned::ActMethods)
-
- send :include, ActiveRecord::Acts::Versioned::ActMethods
-
- cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, :versioned_inheritance_column,
- :version_column, :max_version_limit, :track_altered_attributes, :version_condition, :version_sequence_name, :non_versioned_columns,
- :version_association_options, :version_if_changed
-
- self.versioned_class_name = options[:class_name] || "Version"
- self.versioned_foreign_key = options[:foreign_key] || self.to_s.foreign_key
- self.versioned_table_name = options[:table_name] || "#{table_name_prefix}#{base_class.name.demodulize.underscore}_versions#{table_name_suffix}"
- self.versioned_inheritance_column = options[:inheritance_column] || "versioned_#{inheritance_column}"
- self.version_column = options[:version_column] || 'version'
- self.version_sequence_name = options[:sequence_name]
- self.max_version_limit = options[:limit].to_i
- self.version_condition = options[:if] || true
- self.non_versioned_columns = [self.primary_key, inheritance_column, self.version_column, 'lock_version', versioned_inheritance_column] + options[:non_versioned_columns].to_a.map(&:to_s)
- self.version_association_options = {
- :class_name => "#{self.to_s}::#{versioned_class_name}",
- :foreign_key => versioned_foreign_key,
- :dependent => :delete_all
- }.merge(options[:association_options] || {})
-
- if block_given?
- extension_module_name = "#{versioned_class_name}Extension"
- silence_warnings do
- self.const_set(extension_module_name, Module.new(&extension))
- end
-
- options[:extend] = self.const_get(extension_module_name)
- end
-
- class_eval <<-CLASS_METHODS
- has_many :versions, version_association_options do
- # finds earliest version of this record
- def earliest
- @earliest ||= find(:first, :order => '#{version_column}')
- end
-
- # find latest version of this record
- def latest
- @latest ||= find(:first, :order => '#{version_column} desc')
- end
- end
- before_save :set_new_version
- after_save :save_version
- after_save :clear_old_versions
-
- unless options[:if_changed].nil?
- self.track_altered_attributes = true
- options[:if_changed] = [options[:if_changed]] unless options[:if_changed].is_a?(Array)
- self.version_if_changed = options[:if_changed].map(&:to_s)
- end
-
- include options[:extend] if options[:extend].is_a?(Module)
- CLASS_METHODS
-
- # create the dynamic versioned model
- const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do
- def self.reloadable? ; false ; end
- # find first version before the given version
- def self.before(version)
- find :first, :order => 'version desc',
- :conditions => ["#{original_class.versioned_foreign_key} = ? and version < ?", version.send(original_class.versioned_foreign_key), version.version]
- end
-
- # find first version after the given version.
- def self.after(version)
- find :first, :order => 'version',
- :conditions => ["#{original_class.versioned_foreign_key} = ? and version > ?", version.send(original_class.versioned_foreign_key), version.version]
- end
-
- def previous
- self.class.before(self)
- end
-
- def next
- self.class.after(self)
- end
-
- def versions_count
- page.version
- end
- end
-
- versioned_class.cattr_accessor :original_class
- versioned_class.original_class = self
- versioned_class.set_table_name versioned_table_name
- versioned_class.belongs_to self.to_s.demodulize.underscore.to_sym,
- :class_name => "::#{self.to_s}",
- :foreign_key => versioned_foreign_key
- versioned_class.send :include, options[:extend] if options[:extend].is_a?(Module)
- versioned_class.set_sequence_name version_sequence_name if version_sequence_name
- end
- end
-
- module ActMethods
- def self.included(base) # :nodoc:
- base.extend ClassMethods
- end
-
- # Saves a version of the model in the versioned table. This is called in the after_save callback by default
- def save_version
- if @saving_version
- @saving_version = nil
- rev = self.class.versioned_class.new
- clone_versioned_model(self, rev)
- rev.send("#{self.class.version_column}=", send(self.class.version_column))
- rev.send("#{self.class.versioned_foreign_key}=", id)
- rev.save
- end
- end
-
- # Clears old revisions if a limit is set with the :limit option in <tt>acts_as_versioned</tt>.
- # Override this method to set your own criteria for clearing old versions.
- def clear_old_versions
- return if self.class.max_version_limit == 0
- excess_baggage = send(self.class.version_column).to_i - self.class.max_version_limit
- if excess_baggage > 0
- self.class.versioned_class.delete_all ["#{self.class.version_column} <= ? and #{self.class.versioned_foreign_key} = ?", excess_baggage, id]
- end
- end
-
- # Reverts a model to a given version. Takes either a version number or an instance of the versioned model
- def revert_to(version)
- if version.is_a?(self.class.versioned_class)
- return false unless version.send(self.class.versioned_foreign_key) == id and !version.new_record?
- else
- return false unless version = versions.send("find_by_#{self.class.version_column}", version)
- end
- self.clone_versioned_model(version, self)
- send("#{self.class.version_column}=", version.send(self.class.version_column))
- true
- end
-
- # Reverts a model to a given version and saves the model.
- # Takes either a version number or an instance of the versioned model
- def revert_to!(version)
- revert_to(version) ? save_without_revision : false
- end
-
- # Temporarily turns off Optimistic Locking while saving. Used when reverting so that a new version is not created.
- def save_without_revision
- save_without_revision!
- true
- rescue
- false
- end
-
- def save_without_revision!
- without_locking do
- without_revision do
- save!
- end
- end
- end
-
- def altered?
- track_altered_attributes ? (version_if_changed - changed).length < version_if_changed.length : changed?
- end
-
- # Clones a model. Used when saving a new version or reverting a model's version.
- def clone_versioned_model(orig_model, new_model)
- self.class.versioned_columns.each do |col|
- new_model.send("#{col.name}=", orig_model.send(col.name)) if orig_model.has_attribute?(col.name)
- end
-
- if orig_model.is_a?(self.class.versioned_class)
- new_model[new_model.class.inheritance_column] = orig_model[self.class.versioned_inheritance_column]
- elsif new_model.is_a?(self.class.versioned_class)
- new_model[self.class.versioned_inheritance_column] = orig_model[orig_model.class.inheritance_column]
- end
- end
-
- # Checks whether a new version shall be saved or not. Calls <tt>version_condition_met?</tt> and <tt>changed?</tt>.
- def save_version?
- version_condition_met? && altered?
- end
-
- # Checks condition set in the :if option to check whether a revision should be created or not. Override this for
- # custom version condition checking.
- def version_condition_met?
- case
- when version_condition.is_a?(Symbol)
- send(version_condition)
- when version_condition.respond_to?(:call) && (version_condition.arity == 1 || version_condition.arity == -1)
- version_condition.call(self)
- else
- version_condition
- end
- end
-
- # Executes the block with the versioning callbacks disabled.
- #
- # @foo.without_revision do
- # @foo.save
- # end
- #
- def without_revision(&block)
- self.class.without_revision(&block)
- end
-
- # Turns off optimistic locking for the duration of the block
- #
- # @foo.without_locking do
- # @foo.save
- # end
- #
- def without_locking(&block)
- self.class.without_locking(&block)
- end
-
- def empty_callback() end #:nodoc:
-
- protected
- # sets the new version before saving, unless you're using optimistic locking. In that case, let it take care of the version.
- def set_new_version
- @saving_version = new_record? || save_version?
- self.send("#{self.class.version_column}=", next_version) if new_record? || (!locking_enabled? && save_version?)
- end
-
- # Gets the next available version for the current record, or 1 for a new record
- def next_version
- (new_record? ? 0 : versions.calculate(:max, version_column).to_i) + 1
- end
-
- module ClassMethods
- # Returns an array of columns that are versioned. See non_versioned_columns
- def versioned_columns
- @versioned_columns ||= columns.select { |c| !non_versioned_columns.include?(c.name) }
- end
-
- # Returns an instance of the dynamic versioned model
- def versioned_class
- const_get versioned_class_name
- end
-
- # Rake migration task to create the versioned table using options passed to acts_as_versioned
- def create_versioned_table(create_table_options = {})
- # create version column in main table if it does not exist
- if !self.content_columns.find { |c| [version_column.to_s, 'lock_version'].include? c.name }
- self.connection.add_column table_name, version_column, :integer
- self.reset_column_information
- end
-
- return if connection.table_exists?(versioned_table_name)
-
- self.connection.create_table(versioned_table_name, create_table_options) do |t|
- t.column versioned_foreign_key, :integer
- t.column version_column, :integer
- end
-
- self.versioned_columns.each do |col|
- self.connection.add_column versioned_table_name, col.name, col.type,
- :limit => col.limit,
- :default => col.default,
- :scale => col.scale,
- :precision => col.precision
- end
-
- if type_col = self.columns_hash[inheritance_column]
- self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type,
- :limit => type_col.limit,
- :default => type_col.default,
- :scale => type_col.scale,
- :precision => type_col.precision
- end
-
- self.connection.add_index versioned_table_name, versioned_foreign_key
- end
-
- # Rake migration task to drop the versioned table
- def drop_versioned_table
- self.connection.drop_table versioned_table_name
- end
-
- # Executes the block with the versioning callbacks disabled.
- #
- # Foo.without_revision do
- # @foo.save
- # end
- #
- def without_revision(&block)
- class_eval do
- CALLBACKS.each do |attr_name|
- alias_method "orig_#{attr_name}".to_sym, attr_name
- alias_method attr_name, :empty_callback
- end
- end
- block.call
- ensure
- class_eval do
- CALLBACKS.each do |attr_name|
- alias_method attr_name, "orig_#{attr_name}".to_sym
- end
- end
- end
-
- # Turns off optimistic locking for the duration of the block
- #
- # Foo.without_locking do
- # @foo.save
- # end
- #
- def without_locking(&block)
- current = ActiveRecord::Base.lock_optimistically
- ActiveRecord::Base.lock_optimistically = false if current
- begin
- block.call
- ensure
- ActiveRecord::Base.lock_optimistically = true if current
- end
- end
- end
- end
- end
- end
-end
-
-ActiveRecord::Base.send :include, ActiveRecord::Acts::Versioned
View
48 vendor/plugins/acts_as_versioned/test/abstract_unit.rb
@@ -1,48 +0,0 @@
-$:.unshift(File.dirname(__FILE__) + '/../../../rails/activesupport/lib')
-$:.unshift(File.dirname(__FILE__) + '/../../../rails/activerecord/lib')
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-require 'test/unit'
-begin
- require 'active_support'
- require 'active_record'
- require 'active_record/fixtures'
-rescue LoadError
- require 'rubygems'
- retry
-end
-
-begin
- require 'ruby-debug'
- Debugger.start
-rescue LoadError
-end
-
-require 'acts_as_versioned'
-
-config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
-ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
-ActiveRecord::Base.configurations = {'test' => config[ENV['DB'] || 'sqlite3']}
-ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
-
-load(File.dirname(__FILE__) + "/schema.rb")
-
-# set up custom sequence on widget_versions for DBs that support sequences
-if ENV['DB'] == 'postgresql'
- ActiveRecord::Base.connection.execute "DROP SEQUENCE widgets_seq;" rescue nil
- ActiveRecord::Base.connection.remove_column :widget_versions, :id
- ActiveRecord::Base.connection.execute "CREATE SEQUENCE widgets_seq START 101;"
- ActiveRecord::Base.connection.execute "ALTER TABLE widget_versions ADD COLUMN id INTEGER PRIMARY KEY DEFAULT nextval('widgets_seq');"
-end
-
-Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
-$:.unshift(Test::Unit::TestCase.fixture_path)
-
-class Test::Unit::TestCase #:nodoc:
- # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
- self.use_transactional_fixtures = true
-
- # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
- self.use_instantiated_fixtures = false
-
- # Add more helper methods to be used by all tests here...
-end
View
18 vendor/plugins/acts_as_versioned/test/database.yml
@@ -1,18 +0,0 @@
-sqlite:
- :adapter: sqlite
- :dbfile: acts_as_versioned_plugin.sqlite.db
-sqlite3:
- :adapter: sqlite3
- :dbfile: acts_as_versioned_plugin.sqlite3.db
-postgresql:
- :adapter: postgresql
- :username: postgres
- :password: postgres
- :database: acts_as_versioned_plugin_test
- :min_messages: ERROR
-mysql:
- :adapter: mysql
- :host: localhost
- :username: rails
- :password:
- :database: acts_as_versioned_plugin_test
View
6 vendor/plugins/acts_as_versioned/test/fixtures/authors.yml
@@ -1,6 +0,0 @@
-caged:
- id: 1
- name: caged
-mly:
- id: 2
- name: mly
View
3  vendor/plugins/acts_as_versioned/test/fixtures/landmark.rb
@@ -1,3 +0,0 @@
-class Landmark < ActiveRecord::Base
- acts_as_versioned :if_changed => [ :name, :longitude, :latitude ]
-end
View
7 vendor/plugins/acts_as_versioned/test/fixtures/landmark_versions.yml
@@ -1,7 +0,0 @@
-washington:
- id: 1
- landmark_id: 1
- version: 1
- name: Washington, D.C.
- latitude: 38.895
- longitude: -77.036667
View
7 vendor/plugins/acts_as_versioned/test/fixtures/landmarks.yml
@@ -1,7 +0,0 @@
-washington:
- id: 1
- name: Washington, D.C.
- latitude: 38.895
- longitude: -77.036667
- doesnt_trigger_version: This is not important
- version: 1
View
10 vendor/plugins/acts_as_versioned/test/fixtures/locked_pages.yml
@@ -1,10 +0,0 @@
-welcome:
- id: 1
- title: Welcome to the weblog
- lock_version: 24
- type: LockedPage
-thinking:
- id: 2
- title: So I was thinking
- lock_version: 24
- type: SpecialLockedPage
View
27 vendor/plugins/acts_as_versioned/test/fixtures/locked_pages_revisions.yml
@@ -1,27 +0,0 @@
-welcome_1:
- id: 1
- page_id: 1
- title: Welcome to the weblg
- lock_version: 23
- version_type: LockedPage
-
-welcome_2:
- id: 2
- page_id: 1
- title: Welcome to the weblog
- lock_version: 24
- version_type: LockedPage
-
-thinking_1:
- id: 3
- page_id: 2
- title: So I was thinking!!!
- lock_version: 23
- version_type: SpecialLockedPage
-
-thinking_2:
- id: 4
- page_id: 2
- title: So I was thinking
- lock_version: 24
- version_type: SpecialLockedPage
View
15 vendor/plugins/acts_as_versioned/test/fixtures/migrations/1_add_versioned_tables.rb
@@ -1,15 +0,0 @@
-class AddVersionedTables < ActiveRecord::Migration
- def self.up
- create_table("things") do |t|
- t.column :title, :text
- t.column :price, :decimal, :precision => 7, :scale => 2
- t.column :type, :string
- end
- Thing.create_versioned_table
- end
-
- def self.down
- Thing.drop_versioned_table
- drop_table "things" rescue nil
- end
-end
View
43 vendor/plugins/acts_as_versioned/test/fixtures/page.rb
@@ -1,43 +0,0 @@
-class Page < ActiveRecord::Base
- belongs_to :author
- has_many :authors, :through => :versions, :order => 'name'
- belongs_to :revisor, :class_name => 'Author'
- has_many :revisors, :class_name => 'Author', :through => :versions, :order => 'name'
- acts_as_versioned :if => :feeling_good? do
- def self.included(base)
- base.cattr_accessor :feeling_good
- base.feeling_good = true
- base.belongs_to :author
- base.belongs_to :revisor, :class_name => 'Author'
- end
-
- def feeling_good?
- @@feeling_good == true
- end
- end
-end
-
-module LockedPageExtension
- def hello_world
- 'hello_world'
- end
-end
-
-class LockedPage < ActiveRecord::Base
- acts_as_versioned \
- :inheritance_column => :version_type,
- :foreign_key => :page_id,
- :table_name => :locked_pages_revisions,
- :class_name => 'LockedPageRevision',
- :version_column => :lock_version,
- :limit => 2,
- :if_changed => :title,
- :extend => LockedPageExtension
-end
-
-class SpecialLockedPage < LockedPage
-end
-
-class Author < ActiveRecord::Base
- has_many :pages
-end
View
16 vendor/plugins/acts_as_versioned/test/fixtures/page_versions.yml
@@ -1,16 +0,0 @@
-welcome_2:
- id: 1
- page_id: 1
- title: Welcome to the weblog
- body: Such a lovely day
- version: 24
- author_id: 1
- revisor_id: 1
-welcome_1:
- id: 2
- page_id: 1
- title: Welcome to the weblg
- body: Such a lovely day
- version: 23
- author_id: 2
- revisor_id: 2
View
8 vendor/plugins/acts_as_versioned/test/fixtures/pages.yml
@@ -1,8 +0,0 @@
-welcome:
- id: 1
- title: Welcome to the weblog
- body: Such a lovely day
- version: 24
- author_id: 1
- revisor_id: 1
- created_on: "2008-01-01 00:00:00"
View
6 vendor/plugins/acts_as_versioned/test/fixtures/widget.rb
@@ -1,6 +0,0 @@
-class Widget < ActiveRecord::Base
- acts_as_versioned :sequence_name => 'widgets_seq', :association_options => {
- :dependent => :nullify, :order => 'version desc'
- }
- non_versioned_columns << 'foo'
-end
View
46 vendor/plugins/acts_as_versioned/test/migration_test.rb
@@ -1,46 +0,0 @@
-require File.join(File.dirname(__FILE__), 'abstract_unit')
-
-if ActiveRecord::Base.connection.supports_migrations?
- class Thing < ActiveRecord::Base
- attr_accessor :version
- acts_as_versioned
- end
-
- class MigrationTest < Test::Unit::TestCase
- self.use_transactional_fixtures = false
- def teardown
- if ActiveRecord::Base.connection.respond_to?(:initialize_schema_information)
- ActiveRecord::Base.connection.initialize_schema_information
- ActiveRecord::Base.connection.update "UPDATE schema_info SET version = 0"
- else
- ActiveRecord::Base.connection.initialize_schema_migrations_table
- ActiveRecord::Base.connection.assume_migrated_upto_version(0)
- end
-
- Thing.connection.drop_table "things" rescue nil
- Thing.connection.drop_table "thing_versions" rescue nil
- Thing.reset_column_information
- end
-
- def test_versioned_migration
- assert_raises(ActiveRecord::StatementInvalid) { Thing.create :title => 'blah blah' }
- # take 'er up
- ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/')
- t = Thing.create :title => 'blah blah', :price => 123.45, :type => 'Thing'
- assert_equal 1, t.versions.size
-
- # check that the price column has remembered its value correctly
- assert_equal t.price, t.versions.first.price
- assert_equal t.title, t.versions.first.title
- assert_equal t[:type], t.versions.first[:type]
-
- # make sure that the precision of the price column has been preserved
- assert_equal 7, Thing::Version.columns.find{|c| c.name == "price"}.precision
- assert_equal 2, Thing::Version.columns.find{|c| c.name == "price"}.scale
-
- # now lets take 'er back down
- ActiveRecord::Migrator.down(File.dirname(__FILE__) + '/fixtures/migrations/')
- assert_raises(ActiveRecord::StatementInvalid) { Thing.create :title => 'blah blah' }
- end
- end
-end
View
82 vendor/plugins/acts_as_versioned/test/schema.rb
@@ -1,82 +0,0 @@
-ActiveRecord::Schema.define(:version => 0) do
- create_table :pages, :force => true do |t|
- t.column :version, :integer
- t.column :title, :string, :limit => 255
- t.column :body, :text
- t.column :created_on, :datetime
- t.column :updated_on, :datetime
- t.column :author_id, :integer
- t.column :revisor_id, :integer
- end
-
- create_table :page_versions, :force => true do |t|
- t.column :page_id, :integer
- t.column :version, :integer
- t.column :title, :string, :limit => 255
- t.column :body, :text
- t.column :created_on, :datetime
- t.column :updated_on, :datetime
- t.column :author_id, :integer
- t.column :revisor_id, :integer
- end
-
- add_index :page_versions, [:page_id, :version], :unique => true
-
- create_table :authors, :force => true do |t|
- t.column :page_id, :integer
- t.column :name, :string
- end
-
- create_table :locked_pages, :force => true do |t|
- t.column :lock_version, :integer
- t.column :title, :string, :limit => 255
- t.column :body, :text
- t.column :type, :string, :limit => 255
- end
-
- create_table :locked_pages_revisions, :force => true do |t|
- t.column :page_id, :integer
- t.column :lock_version, :integer
- t.column :title, :string, :limit => 255
- t.column :body, :text
- t.column :version_type, :string, :limit => 255
- t.column :updated_at, :datetime
- end
-
- add_index :locked_pages_revisions, [:page_id, :lock_version], :unique => true
-
- create_table :widgets, :force => true do |t|
- t.column :name, :string, :limit => 50
- t.column :foo, :string
- t.column :version, :integer
- t.column :updated_at, :datetime
- end
-
- create_table :widget_versions, :force => true do |t|
- t.column :widget_id, :integer
- t.column :name, :string, :limit => 50
- t.column :version, :integer
- t.column :updated_at, :datetime
- end
-
- add_index :widget_versions, [:widget_id, :version], :unique => true
-
- create_table :landmarks, :force => true do |t|
- t.column :name, :string
- t.column :latitude, :float
- t.column :longitude, :float
- t.column :doesnt_trigger_version,:string
- t.column :version, :integer
- end
-
- create_table :landmark_versions, :force => true do |t|
- t.column :landmark_id, :integer
- t.column :name, :string
- t.column :latitude, :float
- t.column :longitude, :float
- t.column :doesnt_trigger_version,:string
- t.column :version, :integer
- end
-
- add_index :landmark_versions, [:landmark_id, :version], :unique => true
-end
View
370 vendor/plugins/acts_as_versioned/test/versioned_test.rb
@@ -1,370 +0,0 @@
-require File.join(File.dirname(__FILE__), 'abstract_unit')
-require File.join(File.dirname(__FILE__), 'fixtures/page')
-require File.join(File.dirname(__FILE__), 'fixtures/widget')
-
-class VersionedTest < Test::Unit::TestCase
- fixtures :pages, :page_versions, :locked_pages, :locked_pages_revisions, :authors, :landmarks, :landmark_versions
- set_fixture_class :page_versions => Page::Version
-
- def test_saves_versioned_copy
- p = Page.create! :title => 'first title', :body => 'first body'
- assert !p.new_record?
- assert_equal 1, p.versions.size
- assert_equal 1, p.version
- assert_instance_of Page.versioned_class, p.versions.first
- end
-
- def test_saves_without_revision
- p = pages(:welcome)
- old_versions = p.versions.count
-
- p.save_without_revision
-
- p.without_revision do
- p.update_attributes :title => 'changed'
- end
-
- assert_equal old_versions, p.versions.count
- end
-
- def test_rollback_with_version_number
- p = pages(:welcome)
- assert_equal 24, p.version
- assert_equal 'Welcome to the weblog', p.title
-
- assert p.revert_to!(23), "Couldn't revert to 23"
- assert_equal 23, p.version
- assert_equal 'Welcome to the weblg', p.title
- end
-
- def test_versioned_class_name
- assert_equal 'Version', Page.versioned_class_name
- assert_equal 'LockedPageRevision', LockedPage.versioned_class_name
- end
-
- def test_versioned_class
- assert_equal Page::Version, Page.versioned_class
- assert_equal LockedPage::LockedPageRevision, LockedPage.versioned_class
- end
-
- def test_special_methods
- assert_nothing_raised { pages(:welcome).feeling_good? }
- assert_nothing_raised { pages(:welcome).versions.first.feeling_good? }
- assert_nothing_raised { locked_pages(:welcome).hello_world }
- assert_nothing_raised { locked_pages(:welcome).versions.first.hello_world }
- end
-
- def test_rollback_with_version_class
- p = pages(:welcome)
- assert_equal 24, p.version
- assert_equal 'Welcome to the weblog', p.title
-
- assert p.revert_to!(p.versions.find_by_version(23)), "Couldn't revert to 23"
- assert_equal 23, p.version
- assert_equal 'Welcome to the weblg', p.title
- end
-
- def test_rollback_fails_with_invalid_revision
- p = locked_pages(:welcome)
- assert !p.revert_to!(locked_pages(:thinking))
- end
-
- def test_saves_versioned_copy_with_options
- p = LockedPage.create! :title => 'first title'
- assert !p.new_record?
- assert_equal 1, p.versions.size
- assert_instance_of LockedPage.versioned_class, p.versions.first
- end
-
- def test_rollback_with_version_number_with_options
- p = locked_pages(:welcome)
- assert_equal 'Welcome to the weblog', p.title
- assert_equal 'LockedPage', p.versions.first.version_type
-
- assert p.revert_to!(p.versions.first.lock_version), "Couldn't revert to 23"
- assert_equal 'Welcome to the weblg', p.title
- assert_equal 'LockedPage', p.versions.first.version_type
- end
-
- def test_rollback_with_version_class_with_options
- p = locked_pages(:welcome)
- assert_equal 'Welcome to the weblog', p.title
- assert_equal 'LockedPage', p.versions.first.version_type
-
- assert p.revert_to!(p.versions.first), "Couldn't revert to 1"
- assert_equal 'Welcome to the weblg', p.title
- assert_equal 'LockedPage', p.versions.first.version_type
- end
-
- def test_saves_versioned_copy_with_sti
- p = SpecialLockedPage.create! :title => 'first title'
- assert !p.new_record?
- assert_equal 1, p.versions.size
- assert_instance_of LockedPage.versioned_class, p.versions.first
- assert_equal 'SpecialLockedPage', p.versions.first.version_type
- end
-
- def test_rollback_with_version_number_with_sti
- p = locked_pages(:thinking)
- assert_equal 'So I was thinking', p.title
-
- assert p.revert_to!(p.versions.first.lock_version), "Couldn't revert to 1"
- assert_equal 'So I was thinking!!!', p.title
- assert_equal 'SpecialLockedPage', p.versions.first.version_type
- end
-
- def test_lock_version_works_with_versioning
- p = locked_pages(:thinking)
- p2 = LockedPage.find(p.id)
-
- p.title = 'fresh title'
- p.save
- assert_equal 2, p.versions.size # limit!
-
- assert_raises(ActiveRecord::StaleObjectError) do
- p2.title = 'stale title'
- p2.save
- end
- end
-
- def test_version_if_condition
- p = Page.create! :title => "title"
- assert_equal 1, p.version
-
- Page.feeling_good = false
- p.save
- assert_equal 1, p.version
- Page.feeling_good = true
- end
-
- def test_version_if_condition2
- # set new if condition
- Page.class_eval do
- def new_feeling_good() title[0..0] == 'a'; end
- alias_method :old_feeling_good, :feeling_good?
- alias_method :feeling_good?, :new_feeling_good
- end
-
- p = Page.create! :title => "title"
- assert_equal 1, p.version # version does not increment
- assert_equal 1, p.versions.count
-
- p.update_attributes(:title => 'new title')
- assert_equal 1, p.version # version does not increment
- assert_equal 1, p.versions.count
-
- p.update_attributes(:title => 'a title')
- assert_equal 2, p.version
- assert_equal 2, p.versions.count
-
- # reset original if condition
- Page.class_eval { alias_method :feeling_good?, :old_feeling_good }
- end
-
- def test_version_if_condition_with_block
- # set new if condition
- old_condition = Page.version_condition
- Page.version_condition = Proc.new { |page| page.title[0..0] == 'b' }
-
- p = Page.create! :title => "title"
- assert_equal 1, p.version # version does not increment
- assert_equal 1, p.versions.count
-
- p.update_attributes(:title => 'a title')
- assert_equal 1, p.version # version does not increment
- assert_equal 1, p.versions.count
-
- p.update_attributes(:title => 'b title')
- assert_equal 2, p.version
- assert_equal 2, p.versions.count
-
- # reset original if condition
- Page.version_condition = old_condition
- end
-
- def test_version_no_limit
- p = Page.create! :title => "title", :body => 'first body'
- p.save
- p.save
- 5.times do |i|
- p.title = "title#{i}"
- p.save
- assert_equal "title#{i}", p.title
- assert_equal (i+2), p.version
- end
- end
-
- def test_version_max_limit
- p = LockedPage.create! :title => "title"
- p.update_attributes(:title => "title1")
- p.update_attributes(:title => "title2")
- 5.times do |i|
- p.title = "title#{i}"
- p.save
- assert_equal "title#{i}", p.title
- assert_equal (i+4), p.lock_version
- assert p.versions(true).size <= 2, "locked version can only store 2 versions"
- end
- end
-
- def test_track_altered_attributes_default_value
- assert !Page.track_altered_attributes
- assert LockedPage.track_altered_attributes
- assert SpecialLockedPage.track_altered_attributes
- end
-
- def test_track_altered_attributes
- p = LockedPage.create! :title => "title"
- assert_equal 1, p.lock_version
- assert_equal 1, p.versions(true).size
-
- p.body = 'whoa'
- assert !p.save_version?
- p.save
- assert_equal 2, p.lock_version # still increments version because of optimistic locking
- assert_equal 1, p.versions(true).size
-
- p.title = 'updated title'
- assert p.save_version?
- p.save
- assert_equal 3, p.lock_version
- assert_equal 1, p.versions(true).size # version 1 deleted
-
- p.title = 'updated title!'
- assert p.save_version?
- p.save
- assert_equal 4, p.lock_version
- assert_equal 2, p.versions(true).size # version 1 deleted
- end
-
- def test_find_versions
- assert_equal 1, locked_pages(:welcome).versions.find(:all, :conditions => ['title LIKE ?', '%weblog%']).size
- end
-
- def test_find_version
- assert_equal page_versions(:welcome_1), pages(:welcome).versions.find_by_version(23)
- end
-
- def test_with_sequence
- assert_equal 'widgets_seq', Widget.versioned_class.sequence_name
- 3.times { Widget.create! :name => 'new widget' }
- assert_equal 3, Widget.count
- assert_equal 3, Widget.versioned_class.count
- end
-
- def test_has_many_through
- assert_equal [authors(:caged), authors(:mly)], pages(:welcome).authors
- end
-
- def test_has_many_through_with_custom_association
- assert_equal [authors(:caged), authors(:mly)], pages(:welcome).revisors
- end
-
- def test_referential_integrity
- pages(:welcome).destroy
- assert_equal 0, Page.count
- assert_equal 0, Page::Version.count
- end
-
- def test_association_options
- association = Page.reflect_on_association(:versions)
- options = association.options
- assert_equal :delete_all, options[:dependent]
-
- association = Widget.reflect_on_association(:versions)
- options = association.options
- assert_equal :nullify, options[:dependent]
- assert_equal 'version desc', options[:order]
- assert_equal 'widget_id', options[:foreign_key]
-
- widget = Widget.create! :name => 'new widget'
- assert_equal 1, Widget.count
- assert_equal 1, Widget.versioned_class.count
- widget.destroy
- assert_equal 0, Widget.count
- assert_equal 1, Widget.versioned_class.count
- end
-
- def test_versioned_records_should_belong_to_parent
- page = pages(:welcome)
- page_version = page.versions.last
- assert_equal page, page_version.page
- end
-
- def test_unaltered_attributes
- landmarks(:washington).attributes = landmarks(:washington).attributes.except("id")
- assert !landmarks(:washington).changed?
- end
-
- def test_unchanged_string_attributes
- landmarks(:washington).attributes = landmarks(:washington).attributes.except("id").inject({}) { |params, (key, value)| params.update(key => value.to_s) }
- assert !landmarks(:washington).changed?
- end
-
- def test_should_find_earliest_version
- assert_equal page_versions(:welcome_1), pages(:welcome).versions.earliest
- end
-
- def test_should_find_latest_version
- assert_equal page_versions(:welcome_2), pages(:welcome).versions.latest
- end
-
- def test_should_find_previous_version
- assert_equal page_versions(:welcome_1), page_versions(:welcome_2).previous
- assert_equal page_versions(:welcome_1), pages(:welcome).versions.before(page_versions(:welcome_2))
- end
-
- def test_should_find_next_version
- assert_equal page_versions(:welcome_2), page_versions(:welcome_1).next
- assert_equal page_versions(:welcome_2), pages(:welcome).versions.after(page_versions(:welcome_1))
- end
-
- def test_should_find_version_count
- assert_equal 2, pages(:welcome).versions.size
- end
-
- def test_if_changed_creates_version_if_a_listed_column_is_changed
- landmarks(:washington).name = "Washington"
- assert landmarks(:washington).changed?
- assert landmarks(:washington).altered?
- end
-
- def test_if_changed_creates_version_if_all_listed_columns_are_changed
- landmarks(:washington).name = "Washington"
- landmarks(:washington).latitude = 1.0
- landmarks(:washington).longitude = 1.0
- assert landmarks(:washington).changed?
- assert landmarks(:washington).altered?
- end
-
- def test_if_changed_does_not_create_new_version_if_unlisted_column_is_changed
- landmarks(:washington).doesnt_trigger_version = "This should not trigger version"
- assert landmarks(:washington).changed?
- assert !landmarks(:washington).altered?
- end
-
- def test_without_locking_temporarily_disables_optimistic_locking
- enabled1 = false
- block_called = false
-
- ActiveRecord::Base.lock_optimistically = true
- LockedPage.without_locking do
- enabled1 = ActiveRecord::Base.lock_optimistically
- block_called = true
- end
- enabled2 = ActiveRecord::Base.lock_optimistically
-
- assert block_called
- assert !enabled1
- assert enabled2
- end
-
- def test_without_locking_reverts_optimistic_locking_settings_if_block_raises_exception
- assert_raises(RuntimeError) do
- LockedPage.without_locking do
- raise RuntimeError, "oh noes"
- end
- end
- assert ActiveRecord::Base.lock_optimistically
- end
-end
View
172 vendor/plugins/friendly_id/History.txt
@@ -1,172 +0,0 @@
-== 2.2.3 2009-11-12
-* 1 minor fix
- * Fixed typo in post-install message.
-
-== 2.2.3 2009-11-12
-
-* 4 minor enhancements:
- * Fixed some issues with gem load order under 1.8.x (closes GH Issue #20)
- * Made sure friendly_id generator makes a lib/tasks directory (Josh Nichols)
- * Finders now accept instances of ActiveRecord::Base, matching AR's behavior (Josh Nichols)
- * SlugGenerationError now raise when a blank value is passed to strip_diacritics
-
-== 2.2.2 2009-10-26
-
-* 1 minor enhancement:
- * Fixed Rake tasks creating duplicate slugs and not properly clearing cached slugs (closes GH issues #14 and #15)
-
-== 2.2.1 2009-10-23
-
-* 2 minor enhancements:
- * slug cache now properly caches the slug sequence (closes GH issue #10)
- * attr_protected is now only invoked on the cached_slug column if attr_accessible has not already been invoked. (closes GH issue #11)
-
-== 2.2.0 2009-10-19
-
-* 1 major enhancement:
- * Added slug caching, offers huge performance boost (Bruno Michel)
-
-* 2 minor enhancements:
- * Handle Unicode string length correctly (Mikhail Shirkov)
- * Remove alias_method_chain in favor of super (Diego Carrion)
-
-== 2.1.4 2009-09-01
-
-* 3 minor enhancements:
- * Fixed upgrade generator not installing rake tasks (Harry Love)
- * Fixed handling of very large id's (Nathan Phelps)
- * Fixed long index name on migration (Rob Ingram)
-
-== 2.1.3 2009-06-03
-
-* 1 minor enhancement:
- * Always call #to_s on slug_text to allow objects such as DateTimes to be used for the friendly_id text. (reported by Jon Ng)
-
-== 2.1.2 2009-05-21
-
-* 2 minor enhancements:
- * Non-slugged models now validate the friendly_id on save as well as create (Joe Van Dyk).
- * Replaced Shoulda with Contest.
-
-== 2.1.1 2009-03-25
-
-* 2 minor enhancements:
- * Fixed bug with find_some; if a record has old slugs, find_some will no longer return
-multiple copies of that record when finding by numerical ID. (Steve Luscher)
- * Fixed bug with find_some: you can now find_some with an array of numerical IDs without
-an error being thrown. (Steve Luscher)
-
-== 2.1.0 2009-03-25
-
-* 2 major enhancements:
- * Ruby 1.9 compatibility.
- * Removed dependency on ancient Unicode gem.
-
-== 2.0.4 2009-02-12
-
-* 1 major enhancment:
- * You can now pass in your own custom slug generation blocks while setting up friendly_id.
-
-== 2.0.3 2009-02-11
-
-* 1 minor enhancment:
- * Fixed to_param returning an empty string for non-slugged models with a null friendly_id.
-
-== 2.0.2 2009-02-09
-
-* 2 major enhancements:
- * Made FriendlyId depend only on ActiveRecord. It should now be possible to
- use FriendlyId with Camping or any other codebase that uses AR.
- * Overhauled creaky testing setup and switched to Shoulda.
-
-* 1 minor enhancment:
- * Made reserved words work for non-slugged models.
-
-== 2.0.1 2009-01-19
-
-* 1 minor enhancements:
- * Fix infinite redirect bug when using .has_better_id? in your controllers (Sean Abrahams)
-
-
-== 2.0.0 2009-01-03
-
-* 5 major enhancements:
- * Support for scoped slugs (Norman Clarke)
- * Support for UTF-8 friendly_ids (Norman Clarke)
- * Can now be installed via Ruby Gems, or as a Rails plugin (Norman Clarke)
- * Improved handling of non-unique slugs (Norman Clarke and Adrian Mugnolo)
-* 2 minor enhancements:
- * Shoulda macro (Josh Nichols)
- * Various small bugfixes, cleanups and refactorings
-
-== 2008-12-01
-
-* Fixed bug that may return invalid records having similar id/names and using MySQL. (Emilio Tagua)
-* Fixed slug generation to increment only numeric extension without modifying the name on duplicated slugs. (Emilio Tagua)
-
-== 2008-10-31
-
-* Fixed compatibility with Rails 2.0.x. (Norman Clarke)
-* friendly_id::make_slugs update records in chunks of 1000 to avoid running out of memory with large datasets. (Tim Kadom)
-* Fixed logic error with slug name collisions. Thanks to Tim Kadom for reporting this bug.
-
-== 2008-10-22
-
-* Reverted use of UTF8Handler - was causing errors for some people (Bence Nagy)
-* Corrected find in case if a friendly_id begins with number (Bence Nagy)
-* Added ability to reserve words from slugs (Adam Cigánek)
-
-== 2008-10-09
-
-* Moved "require"" for iconv to init.rb (Florian Aßmann)
-* Removed "require" for Unicode, use Rails' handler instead (Florian Aßmann)
-* Replaced some magic numbers with constants (Florian Aßmann)
-* Don't overwrite find, alias_method_chain find_one and find_some instead (Florian Aßmann)
-* Slugs behave more like ids now (Florian Aßmann)
-* Can find by mixture of ids and slugs (Florian Aßmann)
-* Reformatted code and comments (Florian Aßmann)
-* Added support for Edge Rails' Inflector::parameterize (Norman Clarke)
-
-== 2008-08-25
-
-* Moved strip_diacritics into Slug for easier reuse/better organization.
-* Put class methods inside class << self block. (Norman Clarke)
-
-* Small change to allow friendly_id to work better with STI. (David Ramalho)
-
-== 2008-07-14
-
-* Improved slug generation for friendly id's with apostrophes. (Alistair Holt)
-* Added support for namespaced models in Rakefile. (David Ramalho)
-
-== 2008-06-23
-
-* Cached most recent slug to improve performance (Emilio Tagua).
-
-== 2008-06-10
-
-* Added ability to find friendly_ids by array (Emilio Tagua)
-
-== 2008-05-15
-
-* Made friendly_id raise an error if slug method returns a blank value.
-
-== 2008-05-12
-
-* Added experimental Github gemspec.
-
-== 2008-04-18
-
-* Improved slug name collision avoidance.
-
-== 2008-03-13
-
-* Added :dependent => :destroy to slug relation, as suggested by Emilio Tagua.
-* Fixed error when renaming a slugged item back to a previously used name.
-* Incorporated documentation changes suggested by Jesse Crouch and Chris Nolan.
-
-== 2008-02-07
-
-* Applied patches from blog commenter "suntzu" to fix problem with model values were being overwritten.
-* Applied patch from Dan Blue to make friendly_id no longer ignore options on ActiveRecordBase#find.
-* Added call to options.assert_valid_keys in has_friendly_id. Thanks to W. Andrew Loe III for pointing out that this was missing.
View
19 vendor/plugins/friendly_id/MIT-LICENSE
@@ -1,19 +0,0 @@
-Copyright (c) 2008 Norman Clarke, Adrian Mugnolo and Emilio Tagua.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
View
42 vendor/plugins/friendly_id/Manifest.txt
@@ -1,42 +0,0 @@
-History.txt
-MIT-LICENSE
-README.rdoc
-Rakefile
-generators/friendly_id/friendly_id_generator.rb
-generators/friendly_id/templates/create_slugs.rb
-generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb
-generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb
-init.rb
-lib/friendly_id.rb
-lib/friendly_id/helpers.rb
-lib/friendly_id/non_sluggable_class_methods.rb
-lib/friendly_id/non_sluggable_instance_methods.rb
-lib/friendly_id/slug.rb
-lib/friendly_id/sluggable_class_methods.rb
-lib/friendly_id/sluggable_instance_methods.rb
-lib/friendly_id/tasks.rb
-lib/friendly_id/version.rb
-lib/tasks/friendly_id.rake
-lib/tasks/friendly_id.rb
-test/cached_slug_test.rb
-test/contest.rb
-test/custom_slug_normalizer_test.rb
-test/models/book.rb
-test/models/city.rb
-test/models/country.rb
-test/models/district.rb
-test/models/event.rb
-test/models/legacy_thing.rb
-test/models/novel.rb
-test/models/person.rb
-test/models/post.rb
-test/models/thing.rb
-test/models/user.rb
-test/non_slugged_test.rb
-test/schema.rb
-test/scoped_model_test.rb
-test/slug_test.rb
-test/slugged_model_test.rb
-test/sti_test.rb
-test/tasks_test.rb
-test/test_helper.rb
View
384 vendor/plugins/friendly_id/README.rdoc
@@ -1,384 +0,0 @@
-= FriendlyId
-
-FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for
-Ruby on Rails. It allows you to create pretty URL's and work with
-human-friendly strings as if they were numeric ids for ActiveRecord models.
-
-Using FriendlyId, it's easy to make your application use URL's like:
-
- http://example.com/states/washington
-
-instead of:
-
- http://example.com/states/4323454
-
-Want to find out more? Read on. The {most recent version of the FriendlyId
-RDocs}[http://friendly-id.rubyforge.org] can always be found on
-Rubyforge[http://www.rubyforge.org].
-
-=== Why?
-
-* Text-based id's look better
-* They make URL's easier to remember.
-* They give no hint about the number of records in your database.
-* They are better for search engine optimization.
-
-=== But...
-
-* They can change, breaking your URL's and your SEO.
-* It can be tricky to ensure they're always unique.
-* They can become a pain to manage in large Rails applications.
-* They can conflict with your application's namespace.
-
-FriendlyId tries to offer you the all the advantages, and avoid or soften the
-potential impact of the disadvantages.
-
-== Typical Uses
-
-=== User names ("non-slugged" models)
-
-Usually users have unique user names stored in a column with a unique
-constraint or index. In this case, all you need to do is add this to your
-model:
-
- has_friendly_id :login
-
-and you can then write code like this:
-
- @member = Member.find("joe") # the old Member.find(1) still works, too.
- @member.to_param # returns "joe"
- redirect_to @member # The URL would be /members/joe
-
-=== Blog posts ("slugged" models)
-
-Blog posts generally have titles which are distinctive but not necessarily
-unique. In this and similar cases, FriendlyId provides a Slug model separate
-from your Post model. The Slug model handles duplicate friendly_ids, as well
-as versioning.
-
-Your model code would look something like this:
-
- has_friendly_id :title, :use_slug => true
-
-and you can then write code like this:
-
- @post = Post.find("new-version-released") # Post.find(1) still works, too
- @post.to_param # returns "new-version-released"
- redirect_to @post # The URL would be /posts/new-version-released
-
-Now in your controllers, if you want to prevent people from accessing your
-models by numeric id, you can detect whether they were found by the
-friendly_id:
-
- @post = Post.find(params[:id])
- raise "some error" if !@post.found_using_friendly_id?
-
-or, you can 301 redirect if the model was found by the numeric id if you don't
-care about numeric access, but want the SEO value of the friendly_id:
-
- @post = Post.find(params[:id])
- redirect_to @post, :status => 301 if @post.has_better_id?
-
-The "has_better_id?" method returns true if the model was found with the
-numeric id, or with an outdated slug.
-
-== Extra Features
-
-=== Slug Versioning
-
-FriendlyId will record changes to slugs so that you can tell when the model is
-found with an older slug, or by the numeric id. This can be useful if you want
-to do a 301 redirect to your updated URL.
-
- class PostsController < ApplicationController
-
- before_filter ensure_current_post_url, :only => :show
-
- ...
-
- def ensure_current_post_url
- redirect_to @post, :status => :moved_permanently if @post.has_better_id?
- end
-
- end
-
-This is particularly useful when implementing FrindlyId on an existing
-website that already has many URL's with the old numeric id listed on search
-engines. When the search engine spiders crawl your site, they will
-eventually pick up the new, more SEO-friendly URL's.
-
-=== Non-unique Slug Names
-
-FriendlyId will append a arbitrary number to the end of the id to keep it
-unique if necessary:
-
- /posts/new-version-released
- /posts/new-version-released--2
- /posts/new-version-released--3
- ...
- etc.