From 66cddad4ad583fac7671cc5e658d0a6c63c5e0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szajbe?= Date: Thu, 2 Apr 2009 22:02:03 +0200 Subject: [PATCH 01/15] Now it's possible to pass additional attributes to TimelineEvent. --- README.rdoc | 2 ++ lib/timeline_fu/fires.rb | 9 ++++++--- test/fires_test.rb | 7 +++++++ test/test_helper.rb | 21 +++++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.rdoc b/README.rdoc index 496f29f..5a7f59e 100644 --- a/README.rdoc +++ b/README.rdoc @@ -43,6 +43,8 @@ The rest all fit neatly in an options hash. - :subject is automatically set to self, which is good most of the time. You can however override it if you need to, using :subject. - :secondary_subject can let you specify something else that's related to the event. A comment to a blog post would be a good example. - :if => symbol or proc/lambda lets you put conditions on when a TimelineEvent is created. It's passed right to the after_xxx ActiveRecord event hook, so it's has the same behavior. +- any other parameter is treated as TimelineEvent's attribute + - This is useful if you add a custom field to timeline_events table Here's another example: diff --git a/lib/timeline_fu/fires.rb b/lib/timeline_fu/fires.rb index 2bf71c3..9156930 100644 --- a/lib/timeline_fu/fires.rb +++ b/lib/timeline_fu/fires.rb @@ -16,9 +16,12 @@ def fires(event_type, opts) opts[:subject] = :self unless opts.has_key?(:subject) - method_name = :"fire_#{event_type}_after_#{opts[:on]}" + on = opts.delete(:on) + _if = opts.delete(:if) + + method_name = :"fire_#{event_type}_after_#{on}" define_method(method_name) do - create_options = [:actor, :subject, :secondary_subject].inject({}) do |memo, sym| + create_options = opts.keys.inject({}) do |memo, sym| if opts[sym] if opts[sym].respond_to?(:call) memo[sym] = opts[sym].call(self) @@ -35,7 +38,7 @@ def fires(event_type, opts) TimelineEvent.create!(create_options) end - send(:"after_#{opts[:on]}", method_name, :if => opts[:if]) + send(:"after_#{on}", method_name, :if => _if) end end end diff --git a/test/fires_test.rb b/test/fires_test.rb index 3be36f6..c1f7ae1 100644 --- a/test/fires_test.rb +++ b/test/fires_test.rb @@ -75,4 +75,11 @@ def test_should_set_secondary_subject_to_self_when_requested :event_type => 'comment_deleted') @comment.destroy end + + def test_should_set_additional_attributes_when_present + @site = Site.create(:name => 'foo.com') + @article = Article.new(:body => 'cool article!', :author => @james, :site => @site) + TimelineEvent.expects(:create!).with(:actor => @james, :subject => @article, :event_type => 'article_created', :site => @site) + @article.save + end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 4312d2e..8f62885 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -27,6 +27,15 @@ t.integer :list_id, :author_id t.string :body end + + create_table :sites do |t| + t.string :name + end + + create_table :articles do |t| + t.integer :site_id + t.string :body + end end class Person < ActiveRecord::Base @@ -64,6 +73,18 @@ class Comment < ActiveRecord::Base :secondary_subject => :self end +class Site < ActiveRecord::Base +end + +class Article < ActiveRecord::Base + belongs_to :author, :class_name => "Person" + belongs_to :site + + fires :article_created, :actor => :author, + :on => :create, + :site => :site +end + TimelineEvent = Class.new class Test::Unit::TestCase From ea463c0352a0349cd81c1cad5d328f20ba8ddcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szajbe?= Date: Mon, 31 Aug 2009 16:27:08 +0200 Subject: [PATCH 02/15] fires method now handles :unless option. --- lib/timeline_fu/fires.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/timeline_fu/fires.rb b/lib/timeline_fu/fires.rb index 9156930..876409c 100644 --- a/lib/timeline_fu/fires.rb +++ b/lib/timeline_fu/fires.rb @@ -18,6 +18,7 @@ def fires(event_type, opts) on = opts.delete(:on) _if = opts.delete(:if) + _unless = opts.delete(:unless) method_name = :"fire_#{event_type}_after_#{on}" define_method(method_name) do @@ -38,7 +39,7 @@ def fires(event_type, opts) TimelineEvent.create!(create_options) end - send(:"after_#{on}", method_name, :if => _if) + send(:"after_#{on}", method_name, :if => _if, :unless => _unless) end end end From b82388e81cecc194f0a91266017d47477954d0a4 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Wed, 12 Oct 2011 18:06:09 +0200 Subject: [PATCH 03/15] Add support for specifying an alternate timeline class per model. --- README.rdoc | 1 + VERSION.yml | 2 +- lib/timeline_fu/fires.rb | 3 ++- test/fires_test.rb | 6 ++++++ test/test_helper.rb | 18 ++++++++++++++++-- timeline_fu.gemspec | 2 +- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.rdoc b/README.rdoc index 5a7f59e..c519cf5 100644 --- a/README.rdoc +++ b/README.rdoc @@ -43,6 +43,7 @@ The rest all fit neatly in an options hash. - :subject is automatically set to self, which is good most of the time. You can however override it if you need to, using :subject. - :secondary_subject can let you specify something else that's related to the event. A comment to a blog post would be a good example. - :if => symbol or proc/lambda lets you put conditions on when a TimelineEvent is created. It's passed right to the after_xxx ActiveRecord event hook, so it's has the same behavior. +- :timeline_class_name => string specifying the event class name you'd like you use. Defaults to "TimelineEvent". - any other parameter is treated as TimelineEvent's attribute - This is useful if you add a custom field to timeline_events table diff --git a/VERSION.yml b/VERSION.yml index 3b60975..69abff6 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- :major: 0 :minor: 4 -:patch: 1 +:patch: 2 diff --git a/lib/timeline_fu/fires.rb b/lib/timeline_fu/fires.rb index 876409c..7bf2db6 100644 --- a/lib/timeline_fu/fires.rb +++ b/lib/timeline_fu/fires.rb @@ -19,6 +19,7 @@ def fires(event_type, opts) on = opts.delete(:on) _if = opts.delete(:if) _unless = opts.delete(:unless) + event_class_name = opts.delete(:timeline_class_name) || "TimelineEvent" method_name = :"fire_#{event_type}_after_#{on}" define_method(method_name) do @@ -36,7 +37,7 @@ def fires(event_type, opts) end create_options[:event_type] = event_type.to_s - TimelineEvent.create!(create_options) + event_class_name.classify.constantize.create!(create_options) end send(:"after_#{on}", method_name, :if => _if, :unless => _unless) diff --git a/test/fires_test.rb b/test/fires_test.rb index c1f7ae1..2ae0bf3 100644 --- a/test/fires_test.rb +++ b/test/fires_test.rb @@ -82,4 +82,10 @@ def test_should_set_additional_attributes_when_present TimelineEvent.expects(:create!).with(:actor => @james, :subject => @article, :event_type => 'article_created', :site => @site) @article.save end + + def test_should_use_specified_class_when_present + @company = Company.new(:owner => @james, :name => 'A great company!') + CompanyEvent.expects(:create!).with(:actor => @james, :subject => @company, :event_type => 'company_created') + @company.save + end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 8f62885..a64f566 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ require 'rubygems' -require 'activerecord' -require 'mocha' +require 'active_record' require 'test/unit' +require 'mocha' require 'logger' require File.dirname(__FILE__)+'/../lib/timeline_fu' @@ -36,6 +36,11 @@ t.integer :site_id t.string :body end + + create_table :companies do |t| + t.integer :owner_id + t.string :name + end end class Person < ActiveRecord::Base @@ -85,6 +90,15 @@ class Article < ActiveRecord::Base :site => :site end +class Company < ActiveRecord::Base + belongs_to :owner, :class_name => "Person" + + fires :company_created, :actor => :owner, + :on => :create, + :timeline_class_name => "CompanyEvent" +end + +CompanyEvent = Class.new TimelineEvent = Class.new class Test::Unit::TestCase diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 7b84709..61ccd66 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{timeline_fu} - s.version = "0.4.1" + s.version = "0.4.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] From 4e67efcfc806a5bcfb00272738d2a4fffeaae467 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Wed, 12 Oct 2011 19:28:34 +0200 Subject: [PATCH 04/15] Allow specifying multiple event classes for a single event. --- VERSION.yml | 2 +- lib/timeline_fu/fires.rb | 7 +++++-- test/fires_test.rb | 10 +++++++++- test/test_helper.rb | 11 ++++++++--- timeline_fu.gemspec | 2 +- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/VERSION.yml b/VERSION.yml index 69abff6..4ba9bc1 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- :major: 0 :minor: 4 -:patch: 2 +:patch: 3 diff --git a/lib/timeline_fu/fires.rb b/lib/timeline_fu/fires.rb index 7bf2db6..75b01d9 100644 --- a/lib/timeline_fu/fires.rb +++ b/lib/timeline_fu/fires.rb @@ -19,7 +19,8 @@ def fires(event_type, opts) on = opts.delete(:on) _if = opts.delete(:if) _unless = opts.delete(:unless) - event_class_name = opts.delete(:timeline_class_name) || "TimelineEvent" + + event_class_names = Array(opts.delete(:event_class_name) || "TimelineEvent") method_name = :"fire_#{event_type}_after_#{on}" define_method(method_name) do @@ -37,7 +38,9 @@ def fires(event_type, opts) end create_options[:event_type] = event_type.to_s - event_class_name.classify.constantize.create!(create_options) + event_class_names.each do |class_name| + class_name.classify.constantize.create!(create_options) + end end send(:"after_#{on}", method_name, :if => _if, :unless => _unless) diff --git a/test/fires_test.rb b/test/fires_test.rb index 2ae0bf3..1646964 100644 --- a/test/fires_test.rb +++ b/test/fires_test.rb @@ -83,9 +83,17 @@ def test_should_set_additional_attributes_when_present @article.save end - def test_should_use_specified_class_when_present + def test_should_use_specified_event_class_when_present @company = Company.new(:owner => @james, :name => 'A great company!') CompanyEvent.expects(:create!).with(:actor => @james, :subject => @company, :event_type => 'company_created') @company.save end + + def test_should_support_specifying_multiple_event_classes + CompanyEvent.stubs(:create!) + @company = Company.create(:owner => @james, :name => 'A great company!') + CompanyEvent.expects(:create!).with(:actor => @james, :subject => @company, :event_type => 'company_updated') + IRSEvent.expects(:create!).with(:actor => @james, :subject => @company, :event_type => 'company_updated') + @company.save + end end diff --git a/test/test_helper.rb b/test/test_helper.rb index a64f566..1992bbc 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -93,11 +93,16 @@ class Article < ActiveRecord::Base class Company < ActiveRecord::Base belongs_to :owner, :class_name => "Person" - fires :company_created, :actor => :owner, - :on => :create, - :timeline_class_name => "CompanyEvent" + fires :company_created, :actor => :owner, + :on => :create, + :event_class_name => "CompanyEvent" + + fires :company_updated, :actor => :owner, + :on => :update, + :event_class_name => ["CompanyEvent", "IRSEvent"] end +IRSEvent = Class.new CompanyEvent = Class.new TimelineEvent = Class.new diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 61ccd66..8a93e4d 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{timeline_fu} - s.version = "0.4.2" + s.version = "0.4.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] From 0b6ca009c6125150e4577fa31ac7d170cdb2fadd Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:22:52 +0200 Subject: [PATCH 05/15] DRY up handling of version. --- VERSION.yml | 4 ---- lib/timeline_fu/version.rb | 3 +++ timeline_fu.gemspec | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 VERSION.yml create mode 100644 lib/timeline_fu/version.rb diff --git a/VERSION.yml b/VERSION.yml deleted file mode 100644 index 4ba9bc1..0000000 --- a/VERSION.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -:major: 0 -:minor: 4 -:patch: 3 diff --git a/lib/timeline_fu/version.rb b/lib/timeline_fu/version.rb new file mode 100644 index 0000000..cfaffb2 --- /dev/null +++ b/lib/timeline_fu/version.rb @@ -0,0 +1,3 @@ +module TimelineFu + VERSION = "0.4.3" +end diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 8a93e4d..e7d6dc5 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -1,8 +1,10 @@ # -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "timeline_fu/version" Gem::Specification.new do |s| s.name = %q{timeline_fu} - s.version = "0.4.3" + s.version = TimelineFu::VERSION s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] From 20c6e3b551b52e20dc377406ffa5fd814c799a7f Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:25:00 +0200 Subject: [PATCH 06/15] Replace jeweler by bundler's built-in gem tasks. --- Rakefile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Rakefile b/Rakefile index c2c65aa..45af313 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ require 'rake' require 'rake/testtask' require 'rake/rdoctask' +require 'bundler/gem_tasks' desc 'Default: run unit tests.' task :default => :test @@ -12,20 +13,6 @@ Rake::TestTask.new(:test) do |t| t.verbose = true end -begin - require 'jeweler' - Jeweler::Tasks.new do |s| - s.name = "timeline_fu" - s.summary = %Q{Easily build timelines, much like GitHub's news feed} - s.email = "james@giraffesoft.ca" - s.homepage = "http://github.com/giraffesoft/timeline_fu" - s.description = "Easily build timelines, much like GitHub's news feed" - s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] - end -rescue LoadError - puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" -end - desc 'Generate documentation for the timeline_fu plugin.' Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' From 0c1b8050d51e52871f1b68aa7b7e3b17401e5a79 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:29:06 +0200 Subject: [PATCH 07/15] Clean up gemspec and use git to get lists of files. --- timeline_fu.gemspec | 59 +++++++++------------------------------------ 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index e7d6dc5..5744f53 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -3,55 +3,20 @@ $:.push File.expand_path("../lib", __FILE__) require "timeline_fu/version" Gem::Specification.new do |s| - s.name = %q{timeline_fu} + s.name = "timeline_fu" s.version = TimelineFu::VERSION - - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] - s.date = %q{2011-06-23} - s.description = %q{Easily build timelines, much like GitHub's news feed} - s.email = %q{james@giraffesoft.ca} - s.extra_rdoc_files = [ - "README.rdoc" - ] - s.files = [ - ".gitignore", - "MIT-LICENSE", - "README.rdoc", - "Rakefile", - "VERSION.yml", - "generators/timeline_fu/USAGE", - "generators/timeline_fu/templates/migration.rb", - "generators/timeline_fu/templates/model.rb", - "generators/timeline_fu/timeline_fu_generator.rb", - "init.rb", - "lib/timeline_fu.rb", - "lib/timeline_fu/fires.rb", - "lib/timeline_fu/macros.rb", - "lib/timeline_fu/matchers.rb", - "shoulda_macros/timeline_fu_shoulda.rb", - "test/fires_test.rb", - "test/test_helper.rb", - "timeline_fu.gemspec" - ] - s.has_rdoc = true - s.homepage = %q{http://github.com/giraffesoft/timeline_fu} - s.rdoc_options = ["--charset=UTF-8"] - s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.1} - s.summary = %q{Easily build timelines, much like GitHub's news feed} - s.test_files = [ - "test/fires_test.rb", - "test/test_helper.rb" - ] + s.email = "james@giraffesoft.ca" + s.homepage = "http://github.com/giraffesoft/timeline_fu" + s.summary = "Easily build timelines, much like GitHub's news feed" + s.description = "Easily build timelines, much like GitHub's news feed" - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 2 + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - else - end - else - end + s.has_rdoc = true + s.extra_rdoc_files = ["README.rdoc"] + s.rdoc_options = ["--charset=UTF-8"] end From 6cea9584e6e10f7d92df5c0afd73797565eaafac Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:36:45 +0200 Subject: [PATCH 08/15] Add dependencies to .gemspec and Gemfile. --- .gitignore | 3 ++- Gemfile | 3 +++ timeline_fu.gemspec | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Gemfile diff --git a/.gitignore b/.gitignore index edaf6dc..7f53af3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.DS_Store +Gemfile.lock pkg -.DS_Store \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c80ee36 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "http://rubygems.org" + +gemspec diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 5744f53..1fdb858 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -19,4 +19,10 @@ Gem::Specification.new do |s| s.has_rdoc = true s.extra_rdoc_files = ["README.rdoc"] s.rdoc_options = ["--charset=UTF-8"] + + s.add_runtime_dependency "activerecord" + + s.add_development_dependency "logger" + s.add_development_dependency "mocha" + s.add_development_dependency "sqlite3" end From 62e0f79e1c7bd620c25c7b3910a1cb6d6f3936bb Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:37:07 +0200 Subject: [PATCH 09/15] Make TimelineFu::Fires autoload. --- lib/timeline_fu.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/timeline_fu.rb b/lib/timeline_fu.rb index 125e179..268980e 100644 --- a/lib/timeline_fu.rb +++ b/lib/timeline_fu.rb @@ -1,6 +1,5 @@ -require 'timeline_fu/fires' - -module TimelineFu +module TimelineFu + autoload :Fires, "timeline_fu/fires" end -ActiveRecord::Base.send :include, TimelineFu::Fires +ActiveRecord::Base.send(:include, TimelineFu::Fires) From d75e939db7f3f1e5ddfc9f3af93c5e31c6ed00b6 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:45:42 +0200 Subject: [PATCH 10/15] Move active_record require into gem, since it depends on it. --- lib/timeline_fu.rb | 2 ++ test/test_helper.rb | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/timeline_fu.rb b/lib/timeline_fu.rb index 268980e..99bfb42 100644 --- a/lib/timeline_fu.rb +++ b/lib/timeline_fu.rb @@ -1,3 +1,5 @@ +require "active_record" + module TimelineFu autoload :Fires, "timeline_fu/fires" end diff --git a/test/test_helper.rb b/test/test_helper.rb index 1992bbc..4ddc3a6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,4 @@ require 'rubygems' -require 'active_record' require 'test/unit' require 'mocha' require 'logger' From 0ee3a404f9664583b46d2890cc8cd4549b3e7426 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 12:48:31 +0200 Subject: [PATCH 11/15] Use LOAD_PATH the same way in tests as we do in the gemspec. --- test/test_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 4ddc3a6..5eee0f7 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,8 @@ require 'mocha' require 'logger' -require File.dirname(__FILE__)+'/../lib/timeline_fu' +$:.push File.expand_path("../lib", __FILE__) +require "timeline_fu" ActiveRecord::Base.configurations = {'sqlite3' => {:adapter => 'sqlite3', :database => ':memory:'}} ActiveRecord::Base.establish_connection('sqlite3') From 57297f8edc25f7b3771b00fb637eeceee7438ef8 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 13:02:14 +0200 Subject: [PATCH 12/15] Run tests against latest 2.3.x, 3.0.x, 3.1.x of ActiveRecord. --- .gitignore | 1 + Appraisals | 11 +++++++++++ Rakefile | 7 +++++-- gemfiles/activerecord23.gemfile | 7 +++++++ gemfiles/activerecord30.gemfile | 7 +++++++ gemfiles/activerecord31.gemfile | 7 +++++++ timeline_fu.gemspec | 1 + 7 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Appraisals create mode 100644 gemfiles/activerecord23.gemfile create mode 100644 gemfiles/activerecord30.gemfile create mode 100644 gemfiles/activerecord31.gemfile diff --git a/.gitignore b/.gitignore index 7f53af3..0c76dce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store Gemfile.lock +gemfiles/*.gemfile.lock pkg diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..28bb8f0 --- /dev/null +++ b/Appraisals @@ -0,0 +1,11 @@ +appraise "activerecord23" do + gem "activerecord", "~> 2.3.14" +end + +appraise "activerecord30" do + gem "activerecord", "~> 3.0.10" +end + +appraise "activerecord31" do + gem "activerecord", "~> 3.1.1" +end diff --git a/Rakefile b/Rakefile index 45af313..65484cb 100644 --- a/Rakefile +++ b/Rakefile @@ -2,9 +2,12 @@ require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'bundler/gem_tasks' +require 'appraisal' -desc 'Default: run unit tests.' -task :default => :test +desc 'Default: run unit tests against all supported versions of ActiveRecord' +task :default => ["appraisal:install"] do |t| + exec("rake appraisal test") +end desc 'Test the timeline_fu plugin.' Rake::TestTask.new(:test) do |t| diff --git a/gemfiles/activerecord23.gemfile b/gemfiles/activerecord23.gemfile new file mode 100644 index 0000000..cbeb2ff --- /dev/null +++ b/gemfiles/activerecord23.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "activerecord", "~> 2.3.14" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/activerecord30.gemfile b/gemfiles/activerecord30.gemfile new file mode 100644 index 0000000..e7cf3ad --- /dev/null +++ b/gemfiles/activerecord30.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "activerecord", "~> 3.0.10" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/activerecord31.gemfile b/gemfiles/activerecord31.gemfile new file mode 100644 index 0000000..336cfbb --- /dev/null +++ b/gemfiles/activerecord31.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "activerecord", "~> 3.1.1" + +gemspec :path=>"../" \ No newline at end of file diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 1fdb858..9839b09 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency "activerecord" + s.add_development_dependency "appraisal" s.add_development_dependency "logger" s.add_development_dependency "mocha" s.add_development_dependency "sqlite3" From 2930362270b42459f6599465f9740b871f74525b Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 13:09:04 +0200 Subject: [PATCH 13/15] Fix documentation for :event_class_name --- README.rdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index c519cf5..f83d036 100644 --- a/README.rdoc +++ b/README.rdoc @@ -43,7 +43,8 @@ The rest all fit neatly in an options hash. - :subject is automatically set to self, which is good most of the time. You can however override it if you need to, using :subject. - :secondary_subject can let you specify something else that's related to the event. A comment to a blog post would be a good example. - :if => symbol or proc/lambda lets you put conditions on when a TimelineEvent is created. It's passed right to the after_xxx ActiveRecord event hook, so it's has the same behavior. -- :timeline_class_name => string specifying the event class name you'd like you use. Defaults to "TimelineEvent". +- :event_class_name => string specifying the event class name (or an array of them) you'd like you use. Defaults to "TimelineEvent". + - If you specify more than one event class name, an object for each will be created in the appropriate callbacks. - any other parameter is treated as TimelineEvent's attribute - This is useful if you add a custom field to timeline_events table From 2be77b1d24d315ea5968f0d1a35f13b61d16e2e0 Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 13:09:16 +0200 Subject: [PATCH 14/15] Change homepage to correct one. --- timeline_fu.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec index 9839b09..6cec7c1 100644 --- a/timeline_fu.gemspec +++ b/timeline_fu.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.version = TimelineFu::VERSION s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"] s.email = "james@giraffesoft.ca" - s.homepage = "http://github.com/giraffesoft/timeline_fu" + s.homepage = "https://github.com/jamesgolick/timeline_fu" s.summary = "Easily build timelines, much like GitHub's news feed" s.description = "Easily build timelines, much like GitHub's news feed" From 727eb7e1bcf4435d080ea215176b04a9368f5f8a Mon Sep 17 00:00:00 2001 From: Vladimir Andrijevik Date: Fri, 14 Oct 2011 15:00:08 +0200 Subject: [PATCH 15/15] Update version to 0.4.4. timeline_fu should be much easier to develop against now. --- lib/timeline_fu/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/timeline_fu/version.rb b/lib/timeline_fu/version.rb index cfaffb2..8a73f9c 100644 --- a/lib/timeline_fu/version.rb +++ b/lib/timeline_fu/version.rb @@ -1,3 +1,3 @@ module TimelineFu - VERSION = "0.4.3" + VERSION = "0.4.4" end