specjour 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -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
- create_db_and_schema
10
+ Rake::Task['db:test:load'].invoke
10
11
  else
11
- ActiveRecord::Base.connection.tables.each do |table|
12
- ActiveRecord::Base.connection.delete "delete from #{table}"
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
- def create_db_and_schema
18
- load 'Rakefile'
19
- Rake::Task['db:create'].invoke
20
- Rake::Task['db:schema:load'].invoke
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
@@ -10,12 +10,8 @@ module Specjour
10
10
  @batch_size = 25
11
11
  end
12
12
 
13
- def project_path=(name)
14
- @project_path = name
15
- end
16
-
17
13
  def project_path
18
- @project_path ||= File.join("/tmp", project_name)
14
+ File.join("/tmp", project_name)
19
15
  end
20
16
 
21
17
  def dispatch
data/lib/specjour.rb CHANGED
@@ -18,5 +18,5 @@ module Specjour
18
18
  autoload :RsyncDaemon, 'specjour/rsync_daemon'
19
19
  autoload :Worker, 'specjour/worker'
20
20
 
21
- VERSION = "0.1.2".freeze
21
+ VERSION = "0.1.3".freeze
22
22
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sandro Turriate