fixturize 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fixturize.rb +15 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0299c63c604bc88ee804e3b6abb16791eae3f112
4
- data.tar.gz: 77b77b4951ea6e27682752a5e75a1b530e371afe
3
+ metadata.gz: 62a329addf4e8f7170727de9a13ab77ee939b9bc
4
+ data.tar.gz: 40a7a2359de3a3d267ef131d074b7590617b3fb0
5
5
  SHA512:
6
- metadata.gz: f1126e68b45320ec0561d101acb2c3f8a76b1a04699197f064c25c3a886449ac74a3e4a5251ab771a3b82d4d24ee9b25e11bdbfcc13d0d9c7e7fc9b0251ae59f
7
- data.tar.gz: f25ffcb8c3d7738371d80e2b5b0ae11b99902fec82507e729db11a7586ae270c41b10ee2c4fa2e4759ba238c67ae3af8035635e0ab997c9b0db6cc51098cbc5a
6
+ metadata.gz: 9e7266619c26ad5aa91133cc4a9cc36b122fd5e6ca32ae6eff409bb10f915d6415e03f4af44f2820cfe40b0bec22c90f57d7c6bf6448e609a56a82ca89ac52d2
7
+ data.tar.gz: 5d6d1e8780c85e4eb84dce7036f9074c5498a5f31e677858b15c820bd2476b76e10f0a5b844db193e08741afbdf3b5ade0e54ed876b28fd75a946eef32dd1d24
data/lib/fixturize.rb CHANGED
@@ -82,7 +82,7 @@ class Fixturize
82
82
  def index!
83
83
  return unless enabled?
84
84
 
85
- collection.ensure_index({ :name => Mongo::ASCENDING, :type => Mongo::ASCENDING })
85
+ collection.ensure_index({ :name => Mongo::ASCENDING, :type => Mongo::ASCENDING, :timestamp => Mongo::ASCENDING })
86
86
  end
87
87
 
88
88
  def fixture_name(name = nil, &block)
@@ -113,9 +113,12 @@ class Fixturize
113
113
  return yield if !enabled?
114
114
 
115
115
  name = fixture_name(name, &block)
116
-
117
116
  self.current_instrumentation = name
118
- db_instrumentations = collection.find({ :name => name, :type => INSTRUMENT_DATABASE }).to_a
117
+
118
+ db_instrumentations = collection.
119
+ find({ :name => name, :type => INSTRUMENT_DATABASE }).
120
+ sort({ :timestamp => Mongo::ASCENDING }).
121
+ to_a
119
122
 
120
123
  if db_instrumentations.any?
121
124
  uninstall!
@@ -124,7 +127,10 @@ class Fixturize
124
127
  load_data_from(instrumentation)
125
128
  end
126
129
 
127
- ivar_instrumentations = collection.find({ :name => name, :type => INSTRUMENT_IVARS }).to_a
130
+ ivar_instrumentations = collection.
131
+ find({ :name => name, :type => INSTRUMENT_IVARS }).
132
+ sort({ :timestamp => Mongo::ASCENDING }).
133
+ to_a
128
134
 
129
135
  if ivar_instrumentations.any?
130
136
  ivar_instrumentations.each do |instrumentation|
@@ -142,7 +148,9 @@ class Fixturize
142
148
  :name => current_instrumentation,
143
149
  :collection_name => collection_name.to_s,
144
150
  :method_name => method_name.to_s,
145
- :args => BSON::Binary.new(Marshal.dump(args))
151
+ :args => BSON::Binary.new(Marshal.dump(args)),
152
+ :timestamp => Time.now.to_f
153
+ # :json_args => args.to_json,
146
154
  })
147
155
  end
148
156
 
@@ -159,7 +167,8 @@ class Fixturize
159
167
  :name => current_instrumentation,
160
168
  :ivar => ivar,
161
169
  :model => obj.class.to_s,
162
- :id => obj.id
170
+ :id => obj.id,
171
+ :timestamp => Time.now.to_f
163
172
  })
164
173
  end
165
174
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixturize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Taylor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-23 00:00:00.000000000 Z
12
+ date: 2015-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: method_source