no_more_pending_migrations 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require 'rails'
2
+
3
+ module NoMorePendingMigrations
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ load "no_more_pending_migrations/tasks.rake"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ # assumes that there is an existing task named db:abort_if_pending_migrations
2
+
3
+ abort_task = Rake::Task['db:abort_if_pending_migrations']
4
+ abort_task.clear_actions # clear the default behaviour
5
+
6
+ abort_task.enhance do
7
+ pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
8
+
9
+ if pending_migrations.any?
10
+ puts "You have #{pending_migrations.size} pending migrations:"
11
+ pending_migrations.each do |pending_migration|
12
+ puts ' %4d %s' % [pending_migration.version, pending_migration.name]
13
+ end
14
+ puts
15
+ puts "Let's run these migrations!"
16
+ puts
17
+
18
+ Rake::Task['db:migrate'].invoke
19
+ end
20
+ end
21
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no_more_pending_migrations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jesse Storimer
@@ -29,6 +29,8 @@ extensions: []
29
29
  extra_rdoc_files: []
30
30
 
31
31
  files:
32
+ - lib/no_more_pending_migrations/railtie.rb
33
+ - lib/no_more_pending_migrations/tasks.rake
32
34
  - lib/no_more_pending_migrations.rb
33
35
  has_rdoc: true
34
36
  homepage: https://github.com/jstorimer/no_more_pending_migrations