Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extract MigrationFinder

  • Loading branch information...
commit 9537e4b25584df16a57de80fa664bc71ff2a1bb1 1 parent 005df44
@atd atd authored
Showing with 22 additions and 12 deletions.
  1. +19 −0 lib/social_stream/migration_finder.rb
  2. +3 −12 spec/support/migrations.rb
View
19 lib/social_stream/migration_finder.rb
@@ -0,0 +1,19 @@
+module SocialStream
+ # 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
+class MigrationFinder
+ 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
+end
+
+end
View
15 spec/support/migrations.rb
@@ -1,19 +1,10 @@
-class MigrationFinder
- 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
-end
+require 'social_stream/migration_finder'
# acts-as-taggable-on
-MigrationFinder.new 'acts-as-taggable-on',
+SocialStream::MigrationFinder.new 'acts-as-taggable-on',
["generators", "acts_as_taggable_on", "migration", "templates", "active_record", "migration"]
# Mailboxer
-MigrationFinder.new 'mailboxer',
+SocialStream::MigrationFinder.new 'mailboxer',
['generators', 'mailboxer', 'templates', 'migration']
Please sign in to comment.
Something went wrong with that request. Please try again.