fixturize 0.1.1 → 0.1.2
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.
- checksums.yaml +8 -8
- data/lib/fixturize.rb +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjdkZmY2MzI1ZWY2YjE2YjU4MzdlNWUwNWMwMjg3YzU3N2JmZjA0OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWY2NTBiZDQ3MTY4MjQ5ZTA3ZmIzMmQ3MjY5NGM5MTY5NjI2NjAwOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTlmNDM5MjI4Nzc1ZDU3OWVkN2E5M2MwN2QwYWZiMzI1NjcyZGZkOGRiMWI0
|
10
|
+
MDMzM2FhMzFhYjA2ZGRhYWM3NjViYWIzMTdjYTdkYTAzODIwMTVjMmUzMjg5
|
11
|
+
MzJmYzIwODM1Njc1NWZmNTE1OGJkZWY1MzZjY2I3ZWQ3NDliYWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzVjMGI4NTg4NGU4OGE1NjVjYzNiODQyMTQ0ZTM3OTYwZDJlMmYyOTQ0N2U0
|
14
|
+
MDZjNDUzMDVhNWJhNGY5MWY2NzY2MDhkMGJlMTlmN2FlMTUzODkyYjQwMmRm
|
15
|
+
ZmY2Zjk0ZDNhM2QyMmY2YjYxN2UyMWExOTU4NDA2MzgwMDg4N2I=
|
data/lib/fixturize.rb
CHANGED
@@ -31,7 +31,7 @@ class Fixturize
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def collection_name
|
34
|
-
"
|
34
|
+
"fixturize_#{database_version}_"
|
35
35
|
end
|
36
36
|
|
37
37
|
def collection
|
@@ -44,14 +44,14 @@ class Fixturize
|
|
44
44
|
|
45
45
|
def clear_cache!
|
46
46
|
database.collections.each do |c|
|
47
|
-
if c.name == /
|
47
|
+
if c.name == /fixturize_/
|
48
48
|
c.drop
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def instrument_database(collection_name, method_name, *args)
|
54
|
-
collection.
|
54
|
+
collection.insert_aliased_from_fixturize({
|
55
55
|
:type => INSTRUMENT_DATABASE,
|
56
56
|
:name => current_instrumentation,
|
57
57
|
:collection_name => collection_name.to_s,
|
@@ -146,12 +146,12 @@ class Fixturize
|
|
146
146
|
def install!(&block)
|
147
147
|
METHODS_FOR_INSTRUMENTATION.each do |method_name|
|
148
148
|
Mongo::Collection.class_eval <<-HERE, __FILE__, __LINE__
|
149
|
-
unless instance_methods.include?(:#{method_name}
|
150
|
-
alias_method :#{method_name}
|
149
|
+
unless instance_methods.include?(:#{method_name}_aliased_from_fixturize)
|
150
|
+
alias_method :#{method_name}_aliased_from_fixturize, :#{method_name}
|
151
151
|
|
152
152
|
def #{method_name}(*args, &block)
|
153
153
|
Fixturize.instrument_database(@name, :#{method_name}, *args, &block)
|
154
|
-
#{method_name}
|
154
|
+
#{method_name}_aliased_from_fixturize(*args, &block)
|
155
155
|
end
|
156
156
|
end
|
157
157
|
HERE
|
@@ -169,9 +169,9 @@ class Fixturize
|
|
169
169
|
def uninstall!
|
170
170
|
METHODS_FOR_INSTRUMENTATION.each do |method_name|
|
171
171
|
Mongo::Collection.class_eval <<-HERE, __FILE__, __LINE__
|
172
|
-
if instance_methods.include?(:#{method_name}
|
173
|
-
alias_method :#{method_name}, :#{method_name}
|
174
|
-
remove_method :#{method_name}
|
172
|
+
if instance_methods.include?(:#{method_name}_aliased_from_fixturize)
|
173
|
+
alias_method :#{method_name}, :#{method_name}_aliased_from_fixturize
|
174
|
+
remove_method :#{method_name}_aliased_from_fixturize
|
175
175
|
end
|
176
176
|
HERE
|
177
177
|
end
|