Class: SocialStream::MigrationFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/social_stream/migration_finder.rb

Overview

Searches for migrations in a gem and requires them. Example:

MigrationFinder.new 'acts-as-taggable-on',
                    ["generators", "acts_as_taggable_on", "migration", "templates", "active_record", "migration"]
ActsAsTaggableOnMigration.up

Instance Method Summary collapse

Constructor Details

#initialize(gem, path) ⇒ MigrationFinder

Returns a new instance of MigrationFinder.



9
10
11
12
13
14
15
16
# File 'lib/social_stream/migration_finder.rb', line 9

def initialize gem, path
  finder = Gem::GemPathSearcher.new
  taggable_spec = finder.find(gem)
  taggable_migration = finder.matching_files(taggable_spec,
                                             File.join(*path)).first

  require taggable_migration
end