blueprints 0.2.2 → 0.2.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/lib/blueprints.rb +15 -8
- metadata +2 -2
data/lib/blueprints.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'activesupport'
|
1
2
|
require File.join(File.dirname(__FILE__), 'blueprints/plan')
|
2
3
|
require File.join(File.dirname(__FILE__), 'blueprints/file_context')
|
3
4
|
require File.join(File.dirname(__FILE__), 'blueprints/helper')
|
4
5
|
require File.join(File.dirname(__FILE__), 'blueprints/errors')
|
5
|
-
require File.join(File.dirname(__FILE__), 'blueprints/ar_extensions')
|
6
|
+
require File.join(File.dirname(__FILE__), 'blueprints/ar_extensions') if defined?(ActiveRecord)
|
6
7
|
if defined? Spec or $0 =~ /script.spec$/
|
7
8
|
require File.join(File.dirname(__FILE__), 'blueprints/rspec_extensions')
|
8
9
|
else
|
@@ -26,14 +27,18 @@ module Blueprints
|
|
26
27
|
def self.setup(current_context)
|
27
28
|
Plan.setup
|
28
29
|
Plan.copy_ivars(current_context)
|
29
|
-
ActiveRecord
|
30
|
-
|
31
|
-
|
30
|
+
if defined?(ActiveRecord)
|
31
|
+
ActiveRecord::Base.connection.increment_open_transactions
|
32
|
+
ActiveRecord::Base.connection.transaction_joinable = false
|
33
|
+
ActiveRecord::Base.connection.begin_db_transaction
|
34
|
+
end
|
32
35
|
end
|
33
36
|
|
34
37
|
def self.teardown
|
35
|
-
ActiveRecord
|
36
|
-
|
38
|
+
if defined?(ActiveRecord)
|
39
|
+
ActiveRecord::Base.connection.rollback_db_transaction
|
40
|
+
ActiveRecord::Base.connection.decrement_open_transactions
|
41
|
+
end
|
37
42
|
end
|
38
43
|
|
39
44
|
def self.load(options = {})
|
@@ -63,8 +68,10 @@ module Blueprints
|
|
63
68
|
end
|
64
69
|
|
65
70
|
def self.delete_tables(*args)
|
66
|
-
|
67
|
-
|
71
|
+
if defined?(ActiveRecord)
|
72
|
+
args = tables if args.blank?
|
73
|
+
args.each { |t| ActiveRecord::Base.connection.delete(@@delete_sql % t) }
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
def self.tables
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueprints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrius Chamentauskas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-10 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|