specjour 0.1.2 → 0.1.3
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.
- data/VERSION +1 -1
- data/lib/specjour/db_scrub.rb +17 -7
- data/lib/specjour/manager.rb +1 -5
- data/lib/specjour.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/specjour/db_scrub.rb
CHANGED
@@ -3,21 +3,31 @@ module Specjour
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def scrub
|
6
|
+
load 'Rakefile'
|
6
7
|
begin
|
7
8
|
ActiveRecord::Base.connection
|
8
9
|
rescue # assume the database doesn't exist
|
9
|
-
|
10
|
+
Rake::Task['db:test:load'].invoke
|
10
11
|
else
|
11
|
-
|
12
|
-
|
12
|
+
if pending_migrations?
|
13
|
+
Rake::Task['db:migrate'].invoke
|
13
14
|
end
|
15
|
+
|
16
|
+
purge_tables
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
protected
|
21
|
+
|
22
|
+
def purge_tables
|
23
|
+
tables = ActiveRecord::Base.connection.tables - ['schema_migrations']
|
24
|
+
tables.each do |table|
|
25
|
+
ActiveRecord::Base.connection.delete "delete from #{table}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def pending_migrations?
|
30
|
+
ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations.any?
|
21
31
|
end
|
22
32
|
end
|
23
33
|
end
|
data/lib/specjour/manager.rb
CHANGED
data/lib/specjour.rb
CHANGED