base/lib/social_stream/migrations/base.rb in social_stream-0.11.8 vs base/lib/social_stream/migrations/base.rb in social_stream-0.12.0

- old
+ new

@@ -1,14 +1,10 @@ -require 'social_stream/migrations/finder' - module SocialStream module Migrations class Base def initialize - find_old_migration 'acts-as-taggable-on', - ["generators", "acts_as_taggable_on", "migration", "templates", "active_record", "migration"] - + require_old_migration 'acts-as-taggable-on', 'lib/generators/acts_as_taggable_on/migration/templates/active_record/migration' @mailboxer_migration = find_migration 'mailboxer' @base_migration = find_migration 'social_stream-base' end def up @@ -41,15 +37,22 @@ end protected def find_migration(gem) - path = Gem::GemPathSearcher.new.find(gem).full_gem_path - File.join([path,'db', 'migrate']) + File.join([get_full_gem_path(gem)], 'db/migrate') end - def find_old_migration(gem, path) - SocialStream::Migrations::Finder.new gem, path + def require_old_migration(gem,file_path) + require File.join([get_full_gem_path(gem),file_path]) + end + + def get_full_gem_path(gem) + if (Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')) + return Gem::Specification.find_by_name(gem).full_gem_path + else + return Gem::GemPathSearcher.new.find(gem).full_gem_path + end end end end end