diff --git a/.gitignore b/.gitignore index 90a3f75..28f7b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ public/photo_album_photo_images/ public/photo_album_photo_images/* public/uploads/*/* themes/* +config/deploy.rb diff --git a/config/deploy.rb b/config/deploy.rb.example similarity index 100% rename from config/deploy.rb rename to config/deploy.rb.example diff --git a/config/environment.rb b/config/environment.rb index d6d93ea..2a6c3e2 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -40,7 +40,7 @@ # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. # :all can be used as a placeholder for all plugins not explicitly named - config.plugins = [ :version_fu, :all ] + config.plugins = [ :all ] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) diff --git a/config/routes.rb b/config/routes.rb index b6e2afa..ff3a16e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,7 @@ map.from_plugin :ansuz_theme_repository map.from_plugin :ansuz_theme_installer map.from_plugin :ansuz_scrollable_content + map.from_plugin :ansuz_testimonials map.resources :users map.resources :tags diff --git a/vendor/plugins/ansuz_blog/app/models/blog_post.rb b/vendor/plugins/ansuz_blog/app/models/blog_post.rb index c242321..bd5570f 100644 --- a/vendor/plugins/ansuz_blog/app/models/blog_post.rb +++ b/vendor/plugins/ansuz_blog/app/models/blog_post.rb @@ -2,6 +2,7 @@ class Ansuz class JAdams class BlogPost < ActiveRecord::Base acts_as_taggable + belongs_to :author, :class => "User", :foreign_key => 'created_by' has_many :blog_comments, :class_name => "Ansuz::JAdams::BlogComment", :order => "created_at DESC" def edit_path diff --git a/vendor/plugins/ansuz_testimonials/README b/vendor/plugins/ansuz_testimonials/README new file mode 100644 index 0000000..b485439 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/README @@ -0,0 +1,4 @@ +AnsuzTestimonials +=================== + +This plugin provides the ability to keep a database of testimonials, and display them in a theme as well as provide a resource for them diff --git a/vendor/plugins/ansuz_testimonials/Rakefile b/vendor/plugins/ansuz_testimonials/Rakefile new file mode 100644 index 0000000..5e0d3e4 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/Rakefile @@ -0,0 +1,22 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +desc 'Default: run unit tests.' +task :default => :test + +desc 'Test the ansuz_content_section plugin.' +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +desc 'Generate documentation for the ansuz_content_section plugin.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'AnsuzContentSection' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('lib/**/*.rb') +end diff --git a/vendor/plugins/ansuz_testimonials/app/controllers/admin/testimonials_controller.rb b/vendor/plugins/ansuz_testimonials/app/controllers/admin/testimonials_controller.rb new file mode 100644 index 0000000..3678cea --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/controllers/admin/testimonials_controller.rb @@ -0,0 +1,56 @@ +class Admin::TestimonialsController < Admin::BaseController + unloadable # This is required if you subclass a controller provided by the base rails app + + layout 'admin' + before_filter :load_testimonial, :only => [:show, :edit, :update] + before_filter :load_new_testimonial, :only => [:new, :create] + before_filter :load_testimonials, :only => [:index] + + protected + def load_testimonial + @testimonial = Ansuz::JAdams::Testimonial.find(params[:id]) + end + + def load_new_testimonial + @testimonial = Ansuz::JAdams::Testimonial.new(params[:testimonial]) + end + + def load_testimonials + @testimonials = Ansuz::JAdams::Testimonial.find(:all) + end + public + def new + end + + def create + if @testimonial.save + flash[:notice] = "Testimonial was created successfully." + redirect_to admin_testimonials_path + else + flash.now[:error] = "There was a problem creating the testimonial." + render :action => 'new' + end + end + + def show + end + + def edit + end + + def update + if @testimonial.update_attributes(params[:testimonial]) + flash[:notice] = "Testimonial has been updated." + redirect_to admin_testimonials_path + else + flash.now[:error] = "There was a problem updating the Testimonial. Please try again." + render :action => 'edit' + end + end + + def destroy + @testimonial.destroy + flash[:notice] = "Testimonial was deleted." + redirect_to admin_testimonials_path + end +end diff --git a/vendor/plugins/ansuz_testimonials/app/controllers/testimonials_controller.rb b/vendor/plugins/ansuz_testimonials/app/controllers/testimonials_controller.rb new file mode 100644 index 0000000..4714778 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/controllers/testimonials_controller.rb @@ -0,0 +1,18 @@ +class TestimonialsController < ApplicationController + unloadable # This is required if you subclass a controller provided by the base rails app + + before_filter :load_testimonials, :only => [:index] + + protected + def load_testimonials + @testimonials = Ansuz::JAdams::Testimonial.find(:all) + end + + public + + def index + respond_to do |format| + format.html{ render } + end + end +end diff --git a/vendor/plugins/ansuz_testimonials/app/models/testimonial.rb b/vendor/plugins/ansuz_testimonials/app/models/testimonial.rb new file mode 100644 index 0000000..36ba60d --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/models/testimonial.rb @@ -0,0 +1,6 @@ +class Ansuz + class JAdams + class Testimonial < ActiveRecord::Base + end + end +end diff --git a/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/_form.html.erb b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/_form.html.erb new file mode 100644 index 0000000..0832b2d --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/_form.html.erb @@ -0,0 +1,2 @@ +Content: <%= f.text_area(:content) -%>
+Attributed To: <%= f.text_field(:attributed_to) -%>
diff --git a/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/edit.html.erb b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/edit.html.erb new file mode 100644 index 0000000..ea573ac --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/edit.html.erb @@ -0,0 +1,8 @@ +<%= title "Edit Ansuz Theme: #{@ansuz_theme}" -%> +<% content_for :sidebar do -%> + <%= link_to "All Ansuz Themes", admin_ansuz_themes_path -%> +<% end -%> +<% form_for :ansuz_theme, :url => admin_ansuz_theme_path(@ansuz_theme), :html => { :method => :put } do |f| -%> + <%= render :partial => 'form', :locals => { :f => f } -%> + <%= submit_tag("Update Ansuz Theme") -%> or <%= link_to "Cancel", admin_ansuz_themes_path -%> +<% end -%> diff --git a/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/index.html.erb b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/index.html.erb new file mode 100644 index 0000000..009eac9 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/index.html.erb @@ -0,0 +1,27 @@ +<%= title "Testimonials" -%> +<% content_for :sidebar do -%> + <%= link_to "New Testimonial", new_admin_testimonial_path -%>
+<% end -%> + + + + + + + + + + <% @testimonials.each do |testimonial| -%> + '> + + + + + <% end -%> + +
ContentAttributed ToActions
<%= testimonial.content -%><%= link_to testimonial.attributed_to, edit_admin_testimonial_path(testimonial) -%> +
    +
  • <%= link_to "Edit", edit_admin_testimonial_path(testimonial) -%>
  • +
  • <%= link_to "Delete", admin_testimonial_path(testimonial), :method => :delete, :confirm => "Are you sure you want to delete this testimonial?" -%>
  • +
+
diff --git a/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/new.html.erb b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/new.html.erb new file mode 100644 index 0000000..d992fd7 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/admin/testimonials/new.html.erb @@ -0,0 +1,8 @@ +<%= title "New Testimonial" -%> +<% content_for :sidebar do -%> + <%= link_to "All Testimonials", admin_testimonials_path -%> +<% end -%> +<% form_for :testimonial, :url => admin_testimonials_path do |f| -%> + <%= render :partial => 'form', :locals => { :f => f } -%> + <%= submit_tag("Create Testimonial") -%> or <%= link_to "Cancel", admin_testimonials_path -%> +<% end -%> diff --git a/vendor/plugins/ansuz_testimonials/app/views/testimonials/_testimonial.html.erb b/vendor/plugins/ansuz_testimonials/app/views/testimonials/_testimonial.html.erb new file mode 100644 index 0000000..a701bd7 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/testimonials/_testimonial.html.erb @@ -0,0 +1,4 @@ +
+
<%=h testimonial.content -%>
+
<%= testimonial.attributed_to -%>
+
diff --git a/vendor/plugins/ansuz_testimonials/app/views/testimonials/index.html.erb b/vendor/plugins/ansuz_testimonials/app/views/testimonials/index.html.erb new file mode 100644 index 0000000..5edaeb2 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/app/views/testimonials/index.html.erb @@ -0,0 +1,2 @@ +

Testimonials

+<%= render :partial => 'testimonials/testimonial', :collection => @testimonials -%> diff --git a/vendor/plugins/ansuz_testimonials/db/migrate/001_create_testimonials.rb b/vendor/plugins/ansuz_testimonials/db/migrate/001_create_testimonials.rb new file mode 100644 index 0000000..f4e9fc5 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/db/migrate/001_create_testimonials.rb @@ -0,0 +1,13 @@ +class CreateTestimonials < ActiveRecord::Migration + def self.up + create_table "testimonials", :force => true do |t| + t.text "content" + t.string "attributed_to" + t.timestamps + end + end + + def self.end + drop_table "testimonials" + end +end diff --git a/vendor/plugins/ansuz_testimonials/init.rb b/vendor/plugins/ansuz_testimonials/init.rb new file mode 100644 index 0000000..38eb879 --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/init.rb @@ -0,0 +1,3 @@ +# Include hook code here +require 'testimonial' +Ansuz::PluginManagerInstance.register_admin_plugin_nav('Testimonials', '/admin/testimonials') diff --git a/vendor/plugins/ansuz_testimonials/routes.rb b/vendor/plugins/ansuz_testimonials/routes.rb new file mode 100644 index 0000000..d5d64bd --- /dev/null +++ b/vendor/plugins/ansuz_testimonials/routes.rb @@ -0,0 +1,4 @@ +namespace :admin do |admin| + admin.resources :testimonials +end +resources :testimonials diff --git a/vendor/plugins/ansuz_theme_installer/app/models/menu_entry.rb b/vendor/plugins/ansuz_theme_installer/app/models/menu_entry.rb deleted file mode 100644 index 47c096e..0000000 --- a/vendor/plugins/ansuz_theme_installer/app/models/menu_entry.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Ansuz - class JAdams - class MenuEntry < ActiveRecord::Base - acts_as_tree :order => 'position' - def self.root_entries - Ansuz::JAdams::MenuEntry.find(:all, :conditions => "parent_id IS NULL", :order => 'position') - end - end - end -end diff --git a/vendor/plugins/ansuz_theme_repository/app/models/menu_entry.rb b/vendor/plugins/ansuz_theme_repository/app/models/menu_entry.rb deleted file mode 100644 index 47c096e..0000000 --- a/vendor/plugins/ansuz_theme_repository/app/models/menu_entry.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Ansuz - class JAdams - class MenuEntry < ActiveRecord::Base - acts_as_tree :order => 'position' - def self.root_entries - Ansuz::JAdams::MenuEntry.find(:all, :conditions => "parent_id IS NULL", :order => 'position') - end - end - end -end diff --git a/vendor/plugins/savage_beast/app/models/forum.rb b/vendor/plugins/savage_beast/app/models/forum.rb index 2028739..626f23f 100644 --- a/vendor/plugins/savage_beast/app/models/forum.rb +++ b/vendor/plugins/savage_beast/app/models/forum.rb @@ -17,7 +17,7 @@ class Forum < ActiveRecord::Base has_many :posts, :order => "#{Post.table_name}.created_at DESC", :dependent => :delete_all has_one :recent_post, :order => "#{Post.table_name}.created_at DESC", :class_name => 'Post' - format_attribute :description + #format_attribute :description # retrieves forums ordered by position def self.find_ordered(options = {}) diff --git a/vendor/plugins/savage_beast/app/models/post.rb b/vendor/plugins/savage_beast/app/models/post.rb index 769240e..e6e5856 100644 --- a/vendor/plugins/savage_beast/app/models/post.rb +++ b/vendor/plugins/savage_beast/app/models/post.rb @@ -5,7 +5,7 @@ def self.per_page() 25 end belongs_to :user belongs_to :topic - format_attribute :body + #format_attribute :body before_create { |r| r.forum_id = r.topic.forum_id } after_create :update_cached_fields after_destroy :update_cached_fields diff --git a/vendor/plugins/version_fu/.gitignore b/vendor/plugins/version_fu/.gitignore deleted file mode 100644 index e8a76fe..0000000 --- a/vendor/plugins/version_fu/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -test/*.log -*.db \ No newline at end of file diff --git a/vendor/plugins/version_fu/MIT-LICENSE b/vendor/plugins/version_fu/MIT-LICENSE deleted file mode 100644 index ab71df8..0000000 --- a/vendor/plugins/version_fu/MIT-LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -== version_fu -Copyright (c) 2008 Jordan McKible - -== acts_as_versioned -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. \ No newline at end of file diff --git a/vendor/plugins/version_fu/README.rdoc b/vendor/plugins/version_fu/README.rdoc deleted file mode 100644 index c58ce9f..0000000 --- a/vendor/plugins/version_fu/README.rdoc +++ /dev/null @@ -1,109 +0,0 @@ -= version_fu - -version_fu is a ActveRecord versioning plugin that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails. - - -== Installation - - ./script/plugin install git://github.com/jmckible/version_fu.git - - -== Usage - -Let's say I have a pages table: - - class Page < ActiveRecord::Base - # attributes: id, type, title, body, created_at, updated_at, creator_id, author_id - end - -I want to track any changes made. First step will be to make a new page_versions table: - - class CreatePageVersions < ActiveRecord::Migration - def self.up - create_table :page_versions do |t| - t.integer :page_id, :version, :author_id - t.string :title - t.text :body - t.timestamps - end - end - - def self.down - drop_table :page_versions - end - end - -In this case, the author_id column represents the last person to edit the page. We want to track this attribute with every version. However, the creator_id is the person who created the page. The will never change, so it's not part of the versioned table. - -Don't forget to add a version column to your pages table. Have it default to 1 just to be safe (although the plugin should account for this): - - class AddVersionToPages < ActiveRecord::Migration - def self.up - add_column :pages, :version, :integer, :default=>1 - end - def self.down - remove_column :pages, :version - end - end - -Of course if you're adding this plugin to a table with existing data, you'll probably want to instantiate some initial versions to start with. - -Alright, so now that the database tables are in place, we can fire up version_fu. It's quite simple: - - class Page < ActiveRecord::Base - version_fu - end - -Thats it. - - -== Configuration - -You can pass a few configuration options if need be. If you stick with the defaults above, you can skip all this. - - class Page < ActiveRecord::Base - version_fu :class_name=>'Version', :foreign_key=>'page_id', :table_name=>'page_versions', :version_column=>'version' - end - -* :class_name - The name of the versioned class. It will be a submodule of the versioning class - e.g. Page::Version - -* :foreign_key - The column in the versioned table associated with the versioning class - -* :table_name - The name of the versioned table - -* :version_column - The name of the version column - - -== Extensions - -Now that you've got some versions, it would be nice to use ActiveRecord associations on it. For example, Page.first.versions.latest.author wouldn't currently work because the Page::Version class doesn't know about the author method. The version_fu call does all you to pass a block which is executed by the versioned class. There is just one gotcha for associations: - - class Page < ActiveRecord::Base - version_fu do - belongs_to :author, :class_name=>'::Author' - end - end - -Don't forget the class name, or you'll get a warning - -== When to Version - -By default a new version will be saved whenever a versioned column is changed. However, you can control this at a more fine grained level. Just override the create_new_version? method. For example, let's say you only want to save a new version if both the page title and body changed. Taking advantage of the dirty attribute methods, you could do something like this: - - class Page < ActiveRecord::Base - version_fu do - belongs_to :author, :class_name=>'::Author' - end - def create_new_version? - title_changed? && body_changed? - end - end - - -== Author - -* version_fu was created by Jordan McKible http://jordan.mckible.com - -* Available on GitHub at http://github.com/jmckible/version_fu/tree/master - -* acts_as_versioned by Rick Olson http://github.com/technoweenie/acts_as_versioned/tree/master \ No newline at end of file diff --git a/vendor/plugins/version_fu/RUNNING_UNIT_TESTS b/vendor/plugins/version_fu/RUNNING_UNIT_TESTS deleted file mode 100644 index fde085e..0000000 --- a/vendor/plugins/version_fu/RUNNING_UNIT_TESTS +++ /dev/null @@ -1,8 +0,0 @@ -This plugin should be inside a Rails project in the vendor/plugins/version_fu folder. - -The project should also have Rails froze in vendor/rails - -You'll probably want to test with sqlite3, so make sure you have the sqlite3-ruby gem installed - -Inside the vendor/plugins/version_fu directory, run the test suite with: - $ ruby test/version_fu_test.rb \ No newline at end of file diff --git a/vendor/plugins/version_fu/init.rb b/vendor/plugins/version_fu/init.rb deleted file mode 100644 index 29a7a76..0000000 --- a/vendor/plugins/version_fu/init.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'version_fu' -ActiveRecord::Base.class_eval { include VersionFu } \ No newline at end of file diff --git a/vendor/plugins/version_fu/lib/version_fu.rb b/vendor/plugins/version_fu/lib/version_fu.rb deleted file mode 100644 index c7fea83..0000000 --- a/vendor/plugins/version_fu/lib/version_fu.rb +++ /dev/null @@ -1,123 +0,0 @@ -module VersionFu - def self.included(base) - base.extend ClassMethods - end - - module ClassMethods - def version_fu(options={}, &block) - return if self.included_modules.include? VersionFu::InstanceMethods - __send__ :include, VersionFu::InstanceMethods - - cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, - :version_column, :versioned_columns - - 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.version_column = options[:version_column] || 'version' - - # Setup versions association - class_eval do - has_many :versions, :class_name => "#{self.to_s}::#{versioned_class_name}", - :foreign_key => versioned_foreign_key, - :dependent => :destroy do - def latest - find :first, :order=>'version desc' - end - end - - before_save :check_for_new_version - end - - # Versioned Model - const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do - # 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 - end - - # Housekeeping on versioned class - versioned_class.cattr_accessor :original_class - versioned_class.original_class = self - versioned_class.set_table_name versioned_table_name - - # Version parent association - versioned_class.belongs_to self.to_s.demodulize.underscore.to_sym, - :class_name => "::#{self.to_s}", - :foreign_key => versioned_foreign_key - - # Block extension - versioned_class.class_eval &block if block_given? - - # Finally setup which columns to version - self.versioned_columns = versioned_class.new.attributes.keys - - [versioned_class.primary_key, versioned_foreign_key, version_column, 'created_at', 'updated_at'] - end - - def versioned_class - const_get versioned_class_name - end - end - - - module InstanceMethods - def find_version(number) - versions.find :first, :conditions=>{:version=>number} - end - - def load_version(version) - new = self.find_version(version) - if new.nil? - return false - end - self.attributes = self.versioned_colums.inject({}){|group, name| group[name] = new.read_attribute(name); group} - - end - - def load_version!(version) - self.load_version(version) - self.save - end - - def load_version?(version) - !self.find_version(version).nil? - end - - def check_for_new_version - instatiate_revision if create_new_version? - true # Never halt save - end - - # This the method to override if you want to have more control over when to version - def create_new_version? - # Any versioned column changed? - self.class.versioned_columns.detect {|a| __send__ "#{a}_changed?"} - end - - def instatiate_revision - new_version = versions.build - versioned_columns.each do |attribute| - new_version.__send__ "#{attribute}=", __send__(attribute) - end - version_number = new_record? ? 1 : version + 1 - new_version.version = version_number - self.version = version_number - end - end -end diff --git a/vendor/plugins/version_fu/test/database.yml b/vendor/plugins/version_fu/test/database.yml deleted file mode 100644 index 14c2e57..0000000 --- a/vendor/plugins/version_fu/test/database.yml +++ /dev/null @@ -1,18 +0,0 @@ -sqlite: - :adapter: sqlite - :dbfile: version_fu_plugin.sqlite.db -sqlite3: - :adapter: sqlite3 - :dbfile: version_fu_plugin.sqlite3.db -postgresql: - :adapter: postgresql - :username: postgres - :password: postgres - :database: version_fu_plugin_test - :min_messages: ERROR -mysql: - :adapter: mysql - :host: localhost - :username: root - :password: - :database: version_fu_plugin_test \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/author.rb b/vendor/plugins/version_fu/test/fixtures/author.rb deleted file mode 100644 index c4d13a1..0000000 --- a/vendor/plugins/version_fu/test/fixtures/author.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Author < ActiveRecord::Base - - version_fu - def create_new_version? - first_name_change && last_name_changed? - end - - def name - "#{first_name} #{last_name}" - end - - def hello_world(n=1) - "Hello World #{n}" - end - -end \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/author_versions.yml b/vendor/plugins/version_fu/test/fixtures/author_versions.yml deleted file mode 100644 index b94e6e7..0000000 --- a/vendor/plugins/version_fu/test/fixtures/author_versions.yml +++ /dev/null @@ -1,27 +0,0 @@ -larry_1: - id: 1 - version: 1 - author_id: 1 - first_name: Larry - last_name: Appleton - -sara_1: - id: 2 - version: 1 - author_id: 2 - first_name: Sara - last_name: Maiden - -sara_2: - id: 4 - version: 2 - author_id: 2 - first_name: Sara - last_name: Smiles - -peter_1: - id: 3 - version: 1 - author_id: 3 - first_name: Peter - last_name: Parker \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/authors.yml b/vendor/plugins/version_fu/test/fixtures/authors.yml deleted file mode 100644 index 5d58047..0000000 --- a/vendor/plugins/version_fu/test/fixtures/authors.yml +++ /dev/null @@ -1,17 +0,0 @@ -larry: - id: 1 - version: 1 - first_name: Larry - last_name: Appleton - -sara: - id: 2 - version: 2 - first_name: Sara - last_name: Smiles - -peter: - id: 3 - version: 1 - first_name: Peter - last_name: Parker \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/page.rb b/vendor/plugins/version_fu/test/fixtures/page.rb deleted file mode 100644 index fe10190..0000000 --- a/vendor/plugins/version_fu/test/fixtures/page.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Page < ActiveRecord::Base - version_fu do - belongs_to :author, :class_name=>'::Author' - end - - belongs_to :author - belongs_to :creator, :class_name=>'Author' -end \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/page_versions.yml b/vendor/plugins/version_fu/test/fixtures/page_versions.yml deleted file mode 100644 index 4da3384..0000000 --- a/vendor/plugins/version_fu/test/fixtures/page_versions.yml +++ /dev/null @@ -1,19 +0,0 @@ -welcome_1: - id: 1 - page_id: 1 - version: 1 - title: Welcome - body: Initial body - created_at: <%= 1.hour.ago.to_s :db %> - updated_at: <%= 1.hour.ago.to_s :db %> - author_id: 1 - -welcome_2: - id: 2 - page_id: 1 - version: 2 - title: Version 2 - body: two - created_at: <%= 30.minutes.ago.to_s :db %> - updated_at: <%= 30.minutes.ago.to_s :db %> - author_id: 2 \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/fixtures/pages.yml b/vendor/plugins/version_fu/test/fixtures/pages.yml deleted file mode 100644 index 174804d..0000000 --- a/vendor/plugins/version_fu/test/fixtures/pages.yml +++ /dev/null @@ -1,10 +0,0 @@ -welcome: - id: 1 - type: Page - version: 2 - title: Version 2 - body: two - created_at: <%= 1.hour.ago.to_s :db %> - updated_at: <%= 1.hour.ago.to_s :db %> - creator_id: 1 - author_id: 2 \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/schema.rb b/vendor/plugins/version_fu/test/schema.rb deleted file mode 100644 index 2568d65..0000000 --- a/vendor/plugins/version_fu/test/schema.rb +++ /dev/null @@ -1,37 +0,0 @@ -ActiveRecord::Schema.define(:version=>0) do - - create_table :authors, :force=>true do |t| - t.column :version, :integer - t.column :first_name, :string, :limit=>255 - t.column :last_name, :string, :limit=>255 - end - - create_table :author_versions, :force=>true do |t| - t.column :author_id, :integer - t.column :version, :integer - t.column :first_name, :string, :limit=>255 - t.column :last_name, :string, :limit=>255 - end - - create_table :pages, :force=>true do |t| - t.column :type, :string - t.column :version, :integer - t.column :title, :string, :limit=>255 - t.column :body, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :creator_id, :integer - t.column :author_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_at, :datetime - t.column :updated_at, :datetime - t.column :author_id, :integer - end - -end \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/test_helper.rb b/vendor/plugins/version_fu/test/test_helper.rb deleted file mode 100644 index 6de0347..0000000 --- a/vendor/plugins/version_fu/test/test_helper.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'test/unit' -require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb')) -require 'rubygems' -require 'active_record/fixtures' - -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") - -Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/" -$:.unshift(Test::Unit::TestCase.fixture_path) - -class Test::Unit::TestCase - self.use_transactional_fixtures = true - self.use_instantiated_fixtures = false -end \ No newline at end of file diff --git a/vendor/plugins/version_fu/test/version_fu_test.rb b/vendor/plugins/version_fu/test/version_fu_test.rb deleted file mode 100644 index 8d4c91f..0000000 --- a/vendor/plugins/version_fu/test/version_fu_test.rb +++ /dev/null @@ -1,140 +0,0 @@ -require File.join(File.dirname(__FILE__), 'test_helper') -require File.join(File.dirname(__FILE__), 'fixtures/author') -require File.join(File.dirname(__FILE__), 'fixtures/page') - -class VersionFuTest < Test::Unit::TestCase - fixtures :pages, :page_versions, :authors, :author_versions - set_fixture_class :page_versions => Page::Version - set_fixture_class :author_versions => Author::Version - - ############################################################################# - # A S S O C I A T I O N S # - ############################################################################# - def test_parent_has_many_version - assert_equal page_versions(:welcome_1, :welcome_2), pages(:welcome).versions - end - - def test_version_belongs_to_parent - assert_equal pages(:welcome), page_versions(:welcome_1).page - end - - ############################################################################# - # A T T R I B U T E S # - ############################################################################# - def test_should_version_proper_attributes - assert_equal ['title', 'body', 'author_id'], Page.new.versioned_columns - end - - def test_should_not_version_non_existing_column - assert !Page.new.versioned_columns.include?(:creator_id) - end - - ############################################################################# - # C R E A T E # - ############################################################################# - def test_should_save_version_on_create - old_count = Page.count - old_version_count = Page::Version.count - page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry) - assert_equal old_count + 1, Page.count - assert_equal old_version_count + 1, Page::Version.count - end - - def test_wire_up_association_on_create - page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry) - assert_equal Page::Version.find(:first, :order=>'id desc'), page.versions.first - end - - def test_begin_version_numbering_at_one - page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry) - assert_equal 1, page.version - assert_equal 1, page.versions.first.version - end - - def test_assigns_attributes_on_create - page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry) - version = page.versions.first - assert_equal 'New', version.title - assert_equal 'body', version.body - assert_equal authors(:larry).id, version.author_id - end - - ############################################################################# - # U P D A T E # - ############################################################################# - def test_should_save_version_on_update - old_count = Page::Version.count - page = pages(:welcome) - page.update_attributes :title=>'New title', :body=>'new body', :author=>authors(:sara) - assert_equal old_count + 1, Page::Version.count - end - - def test_should_increment_version_number - page = pages(:welcome) - old_count = page.version - page.update_attributes :title=>'New title', :body=>'new body', :author=>authors(:sara) - assert_equal old_count + 1, page.reload.version - end - - def test_update_version_attributes - page = pages(:welcome) - page.update_attributes :title=>'Latest', :body=>'newest', :author=>authors(:peter) - version = page.reload.versions.latest - assert_equal 'Latest', version.title - assert_equal 'newest', version.body - assert_equal authors(:peter).id, version.author_id - end - - ############################################################################# - # S K I P V E R S I O N I N G # - ############################################################################# - def test_do_not_create_version_if_nothing_changed - old_count = Page::Version.count - pages(:welcome).save - assert_equal old_count, Page::Version.count - end - - def test_do_not_create_version_if_untracked_attribute_changed - old_count = Page::Version.count - pages(:welcome).update_attributes :author=>authors(:sara) - assert_equal old_count, Page::Version.count - end - - def test_do_not_create_version_if_custom_version_check - old_count = Author::Version.count - authors(:larry).update_attributes :last_name=>'Lessig' - assert_equal old_count, Author::Version.count - end - - def test_still_save_if_no_new_version_with_custom_version_check - authors(:larry).update_attributes :last_name=>'Lessig' - assert_equal 'Lessig', authors(:larry).reload.last_name - end - - ############################################################################# - # F I N D # - ############################################################################# - def test_find_version_given_number - assert_equal page_versions(:welcome_1), pages(:welcome).find_version(1) - assert_equal page_versions(:welcome_2), pages(:welcome).find_version(2) - end - - def test_find_latest_version - assert_equal page_versions(:welcome_2), pages(:welcome).versions.latest - end - - def test_find_previous_version - assert_equal page_versions(:welcome_1), page_versions(:welcome_2).previous - end - - def test_find_next_version - assert_equal page_versions(:welcome_2), page_versions(:welcome_1).next - end - - ############################################################################# - # B L O C K E X T E N S I O N # - ############################################################################# - def test_should_take_a_block_containing_ar_extention - assert_equal authors(:larry), page_versions(:welcome_1).author - end -end \ No newline at end of file