nexus_seed 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ede781f7498b8d79e89ba01e734f0eb7f3b9987c9de94857c01e9f79573a62e
4
- data.tar.gz: 43399bcb81187aa51ede565a7930eb0dc1174b7c583baf937f0c80c78ea1a455
3
+ metadata.gz: 936025124e216f8a89748901685b47b16924ef8e36309700d76f8a065416fc27
4
+ data.tar.gz: a753c4960123ccc4cbbf7e29e839a93c9c27bbe2b8f2735aae49f7d744e36cf4
5
5
  SHA512:
6
- metadata.gz: a1c417eac2eb4927117526ca68e801ed482f7b97bca7919791b7bf21c263de69eac04ca55a75c86af88bbc306a73aeadf5cf61cf3b2bfd4ba65a7adfbd57f3fd
7
- data.tar.gz: 062b17fc35c6c0973f8fc0ed274f22604239c1f05927be0f1704d32e868d00ceac2a3fd1672c6beb6f9b5bcf92c696a7c26864bb0c99c503bf1da85349fcf101
6
+ metadata.gz: f1dd0fa68eed7eb2449fd1abcdead0b51d087ffbc782dd900c889925a55d4d59a614cd00703e60a8846d4fd1b0d6f21a1fbe348ad2f6e5a1432193e8171e4e92
7
+ data.tar.gz: 188afd7d7cf54e8a7590fc72d37d6e437a4e80abe3bf0ef86f36ea9611ca0d56f26d116fc8b4123830a062caad4c99aac1217615543e1acbf4284dcb2b067414
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ module NexusSeed
3
+ class Base < ActiveRecord::Base
4
+ def self.transaction(**options, &block)
5
+ super
6
+
7
+ NexusSeed::Builder.seed_report
8
+
9
+ if ENV['destroy_seeds']
10
+ NexusSeed::Builder.destroy_seeds
11
+ end
12
+ end
13
+ end
14
+ end
@@ -47,12 +47,14 @@ module NexusSeed
47
47
  end
48
48
 
49
49
  def self.destroy_seeds
50
- count = 0
51
- @seeds.reverse.each do |seed|
52
- count += 1
53
- seed.destroy
50
+ if Rails.env.test? || Rails.env.development?
51
+ count = 0
52
+ @seeds.reverse.each do |seed|
53
+ count += 1
54
+ seed.destroy
55
+ end
56
+ @logger.info("Destroyed #{count} seeds (including dependants). All seeds deleted.")
54
57
  end
55
- @logger.info("Destroyed #{count} seeds (including dependants). All seeds deleted.")
56
58
  end
57
59
 
58
60
  def self.pre_seed_counts
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module NexusSeed
3
- # Leave this as 0.2.3 in order for CI process to replace with the tagged version.
4
- VERSION = '0.2.3'
3
+ # Leave this as 0.2.4 in order for CI process to replace with the tagged version.
4
+ VERSION = '0.2.4'
5
5
  end
data/lib/nexus_seed.rb CHANGED
@@ -3,6 +3,7 @@ require 'nexus_seed'
3
3
  require 'nexus_seed/builder/base'
4
4
  Dir["/app/db/nexus_seed/builders/*.rb"].each { |file| require file }
5
5
  require 'nexus_seed/builder'
6
+ require 'nexus_seed/base'
6
7
 
7
8
  module NexusSeed
8
9
  # defaults
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_seed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnathon Harris
@@ -36,6 +36,7 @@ files:
36
36
  - Gemfile
37
37
  - README.md
38
38
  - lib/nexus_seed.rb
39
+ - lib/nexus_seed/base.rb
39
40
  - lib/nexus_seed/builder.rb
40
41
  - lib/nexus_seed/builder/base.rb
41
42
  - lib/nexus_seed/version.rb