seed_packet 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: b0f36635b9246f77e0bf9b0e81332c6693f0d8c9
4
- data.tar.gz: 3b2e0580487b2b04544b4ac7a9b6b46fd0af6d73
3
+ metadata.gz: 9cf9766d9096b986348b2f3fa2a830c3f3ddb335
4
+ data.tar.gz: 6ed6a558c913478870a79064c01ccc27a419d931
5
5
  SHA512:
6
- metadata.gz: 0ea34103646d2a3196b9055128b649df0b6bc7b1b11b61d9c6f543ac361c1ec96fe0343ef2674f7ebd93281683186c1191d21a8087bf528cb4aad8ad2406f348
7
- data.tar.gz: aaecc201f3a378958fab1cc9fdf29f2ee4a137959384011d531c17e3156a5c63cb4459eebce5ba7e13791ed2153793db3b34b02c417876c6f52b73d33008bb51
6
+ metadata.gz: 1d14926434f9b55deeba61f86df0147cf37a924d84322d82ba15c2965eed349583a1278debbc60314cfd3517b5f860bd0683957f8d4f917b3f866f27bb5e5d4f
7
+ data.tar.gz: a629c18b25d2ac6090d8239244981954d665ed71c3b16bdbc3f9268b0a94decaeb12aff3ae698512ed2ef3ce9b0e9369853d8d8654b5659a84798a0bf2676dc9
@@ -13,5 +13,9 @@ class Environment
13
13
  def samples_allowed?
14
14
  !%w{production test}.include?(environment)
15
15
  end
16
+
17
+ def scrubbing_allowed?
18
+ %w{development test}.include?(environment)
19
+ end
16
20
  end
17
21
  end
@@ -1,3 +1,3 @@
1
1
  module SeedPacket
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/seed_packet.rb CHANGED
@@ -23,6 +23,12 @@ module SeedPacket
23
23
  end
24
24
  end
25
25
 
26
+ def scrub
27
+ if environment.scrubbing_allowed?
28
+ yield
29
+ end
30
+ end
31
+
26
32
  private
27
33
 
28
34
  def sow_seeds(factory, options = {})
@@ -1,26 +1,24 @@
1
- namespace :seed_packet do
1
+ namespace :db do
2
2
  desc 'Reset the database and load seed data'
3
- task reset_and_seed: ['db:reset', 'default']
3
+ task reset_and_seed: ['db:reset', 'db:seed']
4
4
 
5
5
  desc 'Remigrate the database and load seed data'
6
- task remigrate_and_seed: ['db:migrate:reset', 'default']
6
+ task remigrate_and_seed: ['db:migrate:reset', 'db:seed']
7
7
 
8
8
  desc 'Provide a base load of randomly generated (but valid) data for development.'
9
- task default: 'prepare' do
10
- Rake::Task['seed_packet:seed'].invoke
11
- Rake::Task['seed_packet:sample'].invoke
12
- end
13
-
14
9
  task seed: 'prepare' do
15
10
  MyApp::Database::Seed.new(environment: Rails.env).seed
11
+ MyApp::Database::Sample.new(environment: Rails.env).sample
16
12
  end
17
13
 
18
- task sample: 'prepare' do
19
- MyApp::Database::Sample.new(environment: Rails.env).sample
14
+ desc 'Scrub data from a production database load'
15
+ task scrub: 'prepare' do
16
+ MyApp::Database::Scrub.new(environment: Rails.env).scrub
20
17
  end
21
18
 
22
19
  task prepare: :environment do
23
20
  require File.expand_path('../../../../db/seed.rb', __FILE__)
24
21
  require File.expand_path('../../../../db/sample.rb', __FILE__)
22
+ require File.expand_path('../../../../db/scrub.rb', __FILE__)
25
23
  end
26
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_packet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-01 00:00:00.000000000 Z
11
+ date: 2014-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: