mongoid_rails_migrations 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8775f1eec59ab5b9b48253d924c225ef8f4a381e25e70b8666f1f5439a8db3d7
4
- data.tar.gz: 896306d933de2c622e4ff3465801b300c16287a027edbb70c6881277c4643c41
3
+ metadata.gz: 42339e4043e1ab4647e09def69fbc4d2fc674486da3113a83d461696d50d1b0c
4
+ data.tar.gz: ec3472e01a1071ced5db4da967c6c6b1627a4d9219b8abda84b19871514766fa
5
5
  SHA512:
6
- metadata.gz: bf0e7d1b3827d1c2af5c1c5f564a84a038dc750f7d1834198e7bf9b7e9eba9c6e5d60924c56e799eb23a71c3c972c19bd6f3796a2196d38b6c6f35646990dc51
7
- data.tar.gz: e4bad977cedcba39cc704c2ee23a765827a02834a6f45bbc65b52421a2b968f7fb174db82aeccd4b15e778c671a0232dfd65d21d185cb1348387470a04659eb4
6
+ metadata.gz: 84b7956dcac388376845c973fd0c1744c396fa38bff504257c361bfdda9b6c00b618000f418fb2d20f0c6ffae9a3a1a6649d0ec9728c3639bef583252ad1f620
7
+ data.tar.gz: 54a713f8b7d3c3280e5b83a6233ffa8eecbef7254d20a55b08c705b85342511191fad0e9bd8fcf0162dd8e8ab3ff6b1fca296e58fbe9a779a436f06b1a18b61f
@@ -61,7 +61,7 @@ module Mongoid #:nodoc
61
61
  #
62
62
  class Migration
63
63
  @@verbose = true
64
- cattr_accessor :verbose, :after_migrate
64
+ cattr_accessor :verbose, :after_migrate, :buffer_output
65
65
 
66
66
  class << self
67
67
  def up_with_benchmarks #:nodoc:
@@ -90,7 +90,8 @@ module Mongoid #:nodoc
90
90
  end
91
91
 
92
92
  begin
93
- @@after_migrate.call(@buffer_output, name, direction) if @@after_migrate
93
+ @@after_migrate.call(@@buffer_output, name, direction, false) if @@after_migrate
94
+ @@buffer_output = nil
94
95
  rescue => e
95
96
  say("Error in after_migrate hook: #{e}")
96
97
  end
@@ -117,8 +118,8 @@ module Mongoid #:nodoc
117
118
  end
118
119
 
119
120
  def write(text="")
120
- @buffer_output ||= ""
121
- @buffer_output += text + "\n"
121
+ @@buffer_output ||= ""
122
+ @@buffer_output += text + "\n"
122
123
  puts(text) if verbose
123
124
  end
124
125
 
@@ -332,6 +333,13 @@ module Mongoid #:nodoc
332
333
  migration.migrate(@direction)
333
334
  record_version_state_after_migrating(migration.version)
334
335
  rescue => e
336
+ output = Migration.buffer_output + "An error has occurred, #{migration.version} and all later migrations canceled:\n\n#{e}\n#{e.backtrace.join("\n")}"
337
+ begin
338
+ Migration.after_migrate.call(output, migration.name, @direction, true) if Migration.after_migrate
339
+ Migration.buffer_output = nil
340
+ rescue => error
341
+ puts("Error in after_migrate hook: #{error}")
342
+ end
335
343
  raise StandardError, "An error has occurred, #{migration.version} and all later migrations canceled:\n\n#{e}", e.backtrace
336
344
  end
337
345
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidRailsMigrations #:nodoc:
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_rails_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Da Costa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler