couch_potato 0.6.0 → 0.7.0.pre.1
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/.gitignore +0 -1
- data/.travis.yml +9 -1
- data/CHANGES.md +12 -0
- data/Gemfile.lock +29 -23
- data/MIT-LICENSE.txt +1 -1
- data/README.md +68 -38
- data/Rakefile +19 -60
- data/active_support_3_0.lock +4 -0
- data/active_support_3_1.lock +4 -0
- data/active_support_3_2 +4 -0
- data/active_support_3_2.lock +55 -0
- data/couch_potato.gemspec +1 -0
- data/lib/couch_potato/database.rb +55 -27
- data/lib/couch_potato/persistence/active_model_compliance.rb +6 -2
- data/lib/couch_potato/persistence/callbacks.rb +0 -1
- data/lib/couch_potato/persistence/dirty_attributes.rb +8 -17
- data/lib/couch_potato/persistence/json.rb +3 -2
- data/lib/couch_potato/persistence/properties.rb +19 -8
- data/lib/couch_potato/persistence/simple_property.rb +1 -3
- data/lib/couch_potato/persistence/type_caster.rb +7 -2
- data/lib/couch_potato/persistence.rb +27 -13
- data/lib/couch_potato/railtie.rb +1 -1
- data/lib/couch_potato/rspec/matchers/list_as_matcher.rb +12 -12
- data/lib/couch_potato/rspec/matchers/map_to_matcher.rb +8 -8
- data/lib/couch_potato/rspec/matchers/reduce_to_matcher.rb +10 -10
- data/lib/couch_potato/rspec/matchers.rb +8 -7
- data/lib/couch_potato/validation.rb +15 -11
- data/lib/couch_potato/version.rb +1 -1
- data/lib/couch_potato/view/base_view_spec.rb +14 -12
- data/lib/couch_potato/view/model_view_spec.rb +134 -39
- data/lib/couch_potato/view/properties_view_spec.rb +11 -7
- data/lib/couch_potato/view/view_query.rb +10 -9
- data/lib/couch_potato.rb +25 -10
- data/spec/callbacks_spec.rb +88 -0
- data/spec/create_spec.rb +22 -4
- data/spec/default_property_spec.rb +6 -0
- data/spec/property_spec.rb +81 -44
- data/spec/railtie_spec.rb +20 -18
- data/spec/spec_helper.rb +19 -1
- data/spec/unit/active_model_compliance_spec.rb +17 -11
- data/spec/unit/attributes_spec.rb +33 -10
- data/spec/unit/base_view_spec_spec.rb +19 -5
- data/spec/unit/couch_potato_spec.rb +1 -20
- data/spec/unit/create_spec.rb +2 -2
- data/spec/unit/database_spec.rb +113 -47
- data/spec/unit/dirty_attributes_spec.rb +19 -19
- data/spec/unit/model_view_spec_spec.rb +78 -1
- data/spec/unit/properties_view_spec_spec.rb +18 -5
- data/spec/unit/validation_spec.rb +1 -55
- data/spec/unit/view_query_spec.rb +48 -26
- data/spec/{custom_view_spec.rb → views_spec.rb} +59 -17
- metadata +88 -90
- data/.rvmrc +0 -1
- data/lib/core_ext/object.rb +0 -5
- data/lib/core_ext/string.rb +0 -12
- data/lib/core_ext/symbol.rb +0 -15
- data/lib/couch_potato/validation/with_active_model.rb +0 -27
- data/lib/couch_potato/validation/with_validatable.rb +0 -41
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.9.2
|
3
|
+
- 1.9.3
|
3
4
|
- 1.8.7
|
4
5
|
- ree
|
5
|
-
|
6
|
+
gemfile:
|
7
|
+
- active_support_3_0
|
8
|
+
- active_support_3_1
|
9
|
+
- active_support_3_2
|
10
|
+
before_script:
|
11
|
+
- sudo sh -c 'echo "[native_query_servers]" >> /etc/couchdb/local.ini'
|
12
|
+
- sudo sh -c 'echo "erlang = {couch_native_process, start_link, []}" >> /etc/couchdb/local.ini'
|
13
|
+
- sudo /etc/init.d/couchdb restart
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## Changes
|
2
2
|
|
3
|
+
### 0.7.0
|
4
|
+
|
5
|
+
* ActiveSupport/Rails 3.2 compatibility (Alexander Lang)
|
6
|
+
* removed Object#try, String#blank? as they are part of ActiveSupport - ActiveSupport's try behaves differently than the couch potato implementation so this change might break your app (now calling a non-existant method on a non-nil raises a NoMethodError, before it did not) (Alexander Lang)
|
7
|
+
* bulk document loading (Matthias Jakel)
|
8
|
+
* multi db support (Peter Schröder)
|
9
|
+
* hash-style access to attributes (Peter Schröder)
|
10
|
+
* support for properties of type Array, e.g. :type => [User] (Peter Schröder)
|
11
|
+
* improve compatibility with state_machine (Alexander Lang)
|
12
|
+
* allow false as default value for properties (Matthias Jakel)
|
13
|
+
* support for Erlang views (Alexander Lang)
|
14
|
+
|
3
15
|
### 0.6.0
|
4
16
|
|
5
17
|
* ActiveSupport/Rails 3.1 compatibility (Maximilian Mack)
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
couch_potato (0.
|
4
|
+
couch_potato (0.6.0)
|
5
5
|
activemodel
|
6
6
|
couchrest (>= 1.0.1)
|
7
|
-
json
|
7
|
+
json (~> 1.6.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activemodel (3.
|
13
|
-
activesupport (= 3.
|
14
|
-
builder (~>
|
15
|
-
i18n (~> 0.
|
16
|
-
activesupport (3.
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
activemodel (3.1.1)
|
13
|
+
activesupport (= 3.1.1)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
i18n (~> 0.6)
|
16
|
+
activesupport (3.1.1)
|
17
|
+
multi_json (~> 1.0)
|
18
|
+
builder (3.0.0)
|
19
|
+
couchrest (1.1.2)
|
20
20
|
mime-types (~> 1.15)
|
21
|
+
multi_json (~> 1.0.0)
|
21
22
|
rest-client (~> 1.6.1)
|
22
|
-
diff-lcs (1.1.
|
23
|
-
i18n (0.
|
24
|
-
json (1.
|
23
|
+
diff-lcs (1.1.3)
|
24
|
+
i18n (0.6.0)
|
25
|
+
json (1.6.1)
|
26
|
+
libv8 (3.3.10.4)
|
25
27
|
mime-types (1.16)
|
26
|
-
|
27
|
-
|
28
|
+
multi_json (1.0.3)
|
29
|
+
rake (0.9.2)
|
30
|
+
rest-client (1.6.7)
|
28
31
|
mime-types (>= 1.16)
|
29
|
-
rspec (2.
|
30
|
-
rspec-core (~> 2.
|
31
|
-
rspec-expectations (~> 2.
|
32
|
-
rspec-mocks (~> 2.
|
33
|
-
rspec-core (2.
|
34
|
-
rspec-expectations (2.
|
32
|
+
rspec (2.6.0)
|
33
|
+
rspec-core (~> 2.6.0)
|
34
|
+
rspec-expectations (~> 2.6.0)
|
35
|
+
rspec-mocks (~> 2.6.0)
|
36
|
+
rspec-core (2.6.4)
|
37
|
+
rspec-expectations (2.6.0)
|
35
38
|
diff-lcs (~> 1.1.2)
|
36
|
-
rspec-mocks (2.
|
39
|
+
rspec-mocks (2.6.0)
|
40
|
+
therubyracer (0.10.1)
|
41
|
+
libv8 (~> 3.3.10)
|
37
42
|
timecop (0.3.5)
|
38
|
-
tzinfo (0.3.
|
43
|
+
tzinfo (0.3.30)
|
39
44
|
|
40
45
|
PLATFORMS
|
41
46
|
ruby
|
@@ -44,5 +49,6 @@ DEPENDENCIES
|
|
44
49
|
couch_potato!
|
45
50
|
rake
|
46
51
|
rspec (>= 2.0)
|
52
|
+
therubyracer
|
47
53
|
timecop
|
48
54
|
tzinfo
|
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
... is a persistence layer written in ruby for CouchDB.
|
4
4
|
|
5
|
+
[](http://travis-ci.org/langalex/couch_potato)
|
6
|
+
|
5
7
|
### Mission
|
6
8
|
|
7
9
|
The goal of Couch Potato is to create a minimal framework in order to store and retrieve Ruby objects to/from CouchDB and create and query views.
|
@@ -43,15 +45,15 @@ After that you configure the name of the database:
|
|
43
45
|
The server URL will default to http://localhost:5984/ unless specified:
|
44
46
|
|
45
47
|
CouchPotato::Config.database_name = "http://example.com:5984/name_of_the_db"
|
46
|
-
|
48
|
+
|
47
49
|
Or with authentication
|
48
|
-
|
50
|
+
|
49
51
|
CouchPotato::Config.database_name = "http://username:password@example.com:5984/name_of_the_db"
|
50
|
-
|
51
|
-
Optionally you can configure which framework you want to use for validations (either validatable or ActiveModel (default))
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
Optionally you can configure the default language for design documents (:javascript (default) or :erlang).
|
54
|
+
|
55
|
+
CouchPotato::Config.default_language = :javascript | :erlang
|
56
|
+
|
55
57
|
Another switch allows you to store each CouchDB view in its own design document. Otherwise views are grouped by model.
|
56
58
|
|
57
59
|
CouchPotato::Config.split_design_documents_per_view = true
|
@@ -61,8 +63,8 @@ Another switch allows you to store each CouchDB view in its own design document.
|
|
61
63
|
Create a config/couchdb.yml:
|
62
64
|
|
63
65
|
default: &default
|
64
|
-
validation_framework: :active_model # optional
|
65
66
|
split_design_documents_per_view: true # optional
|
67
|
+
default_language: :erlang # optional
|
66
68
|
|
67
69
|
development:
|
68
70
|
<<: *default
|
@@ -80,7 +82,7 @@ Add to your _config/environment.rb_:
|
|
80
82
|
|
81
83
|
config.gem 'couch_potato', :source => 'http://gemcutter.org'
|
82
84
|
config.frameworks -= [:active_record] # if you switch completely
|
83
|
-
|
85
|
+
|
84
86
|
#### Rails 3.x
|
85
87
|
|
86
88
|
Add to your _Gemfile_:
|
@@ -126,8 +128,8 @@ Properties can be typed:
|
|
126
128
|
|
127
129
|
property :address, :type => Address
|
128
130
|
end
|
129
|
-
|
130
|
-
In this case Address also implements CouchPotato::Persistence which means its JSON representation will be added to the user document.
|
131
|
+
|
132
|
+
In this case Address also implements CouchPotato::Persistence which means its JSON representation will be added to the user document.
|
131
133
|
Couch Potato also has support for the basic types (right now Fixnum, Date, Time and :boolean are supported):
|
132
134
|
|
133
135
|
class User
|
@@ -138,7 +140,7 @@ Couch Potato also has support for the basic types (right now Fixnum, Date, Time
|
|
138
140
|
end
|
139
141
|
|
140
142
|
With this in place when you set the user's age as a String (e.g. using an hTML form) it will be converted into a Fixnum automatically.
|
141
|
-
|
143
|
+
|
142
144
|
|
143
145
|
Properties can have a default value:
|
144
146
|
|
@@ -157,6 +159,11 @@ You can of course also retrieve your instance:
|
|
157
159
|
|
158
160
|
CouchPotato.database.load_document "id_of_the_user_document" # => <#User 0x3075>
|
159
161
|
|
162
|
+
#### Operations on multiple documents
|
163
|
+
|
164
|
+
You can also load a bunch of documents with one request.
|
165
|
+
|
166
|
+
CouchPotato.database.load ['user1', 'user2', 'user3'] # => [<#User 0x3075>, <#User 0x3076>, <#User 0x3077>]
|
160
167
|
|
161
168
|
#### Properties
|
162
169
|
|
@@ -178,6 +185,12 @@ If you want to have properties that don't map to any JSON type, i.e. other than
|
|
178
185
|
|
179
186
|
The date_of_birth property is now automatically serialized to JSON and back when storing/retrieving objects.
|
180
187
|
|
188
|
+
If you want to store an Array of objects, just pass the definiton as an Array of Dates:
|
189
|
+
|
190
|
+
class User
|
191
|
+
property :birthdays, :type => [Date]
|
192
|
+
end
|
193
|
+
|
181
194
|
#### Dirty tracking
|
182
195
|
|
183
196
|
CouchPotato tracks the dirty state of attributes in the same way ActiveRecord does:
|
@@ -208,8 +221,6 @@ Couch Potato by default uses ActiveModel for validation
|
|
208
221
|
user = User.new
|
209
222
|
user.valid? # => false
|
210
223
|
user.errors[:name] # => ['can't be blank']
|
211
|
-
|
212
|
-
If you want you can use [Validatable](http://validatable.rubyforge.org/) by setting `CouchPotato::Config.validation(http://validatable.rubyforge.org/)\_framework = :validatable`
|
213
224
|
|
214
225
|
#### Finding stuff / views / lists
|
215
226
|
|
@@ -240,6 +251,16 @@ Composite keys are also possible:
|
|
240
251
|
view :all, :key => [:created_at, :name]
|
241
252
|
end
|
242
253
|
|
254
|
+
You can let Couch Potato generate these map/reduce functions in Erlang, which reslts in much faster view generation:
|
255
|
+
|
256
|
+
class User
|
257
|
+
property :name
|
258
|
+
|
259
|
+
view :all, :key => [:created_at, :name], :language => :erlang
|
260
|
+
end
|
261
|
+
|
262
|
+
So far only very simple views like the above work with Erlang.
|
263
|
+
|
243
264
|
You can also pass conditions as a JavaScript string:
|
244
265
|
|
245
266
|
class User
|
@@ -261,12 +282,12 @@ If you have larger structures and you only want to load some attributes you can
|
|
261
282
|
|
262
283
|
CouchPotato.database.view(User.everyone).first.name # => "joe"
|
263
284
|
CouchPotato.database.view(User.everyone).first.bio # => nil
|
264
|
-
|
285
|
+
|
265
286
|
CouchPotato.database.first(User.everyone).name # => "joe" # convenience function, returns nil if nothing found
|
266
287
|
CouchPotato.database.first!(User.everyone) # would raise CouchPotato::NotFound if nothing was found
|
267
288
|
|
268
289
|
If you want Rails to automatically show a 404 page when `CouchPotato::NotFound` is raised add this to your `ApplicationController`:
|
269
|
-
|
290
|
+
|
270
291
|
rescue_from CouchPotato::NotFound do
|
271
292
|
render(:file => 'public/404.html', :status => :not_found, :layout => false)
|
272
293
|
end
|
@@ -303,11 +324,11 @@ Defining a list works similarly to views:
|
|
303
324
|
|
304
325
|
class User
|
305
326
|
include CouchPotato::Persistence
|
306
|
-
|
327
|
+
|
307
328
|
property :first_name
|
308
329
|
view :with_full_name, key: first_namne, list: :add_last_name
|
309
330
|
view :all, key: :first_name
|
310
|
-
|
331
|
+
|
311
332
|
list :add_last_name, <<-JS
|
312
333
|
function(head, req) {
|
313
334
|
var row;
|
@@ -320,10 +341,10 @@ Defining a list works similarly to views:
|
|
320
341
|
}
|
321
342
|
JS
|
322
343
|
end
|
323
|
-
|
344
|
+
|
324
345
|
CouchPotato.database.save User.new(first_name: 'joe')
|
325
346
|
CouchPotato.database.view(User.with_full_name).first.name # => 'joe doe'
|
326
|
-
|
347
|
+
|
327
348
|
You can also pass in the list at query time:
|
328
349
|
|
329
350
|
CouchPotato.database.view(User.all(list: :add_last_name))
|
@@ -356,16 +377,26 @@ There is basic attachment support: if you want to store any attachments set the
|
|
356
377
|
class User
|
357
378
|
include CouchPotato::Persistence
|
358
379
|
end
|
359
|
-
|
380
|
+
|
360
381
|
data = File.read('some_file.text') # or from upload
|
361
382
|
user = User.new
|
362
383
|
user._attachments = {'photo' => {'data' => data, 'content_type' => 'image/png'}}
|
363
|
-
|
384
|
+
|
364
385
|
When saving this object an attachment with the name _photo_ will be uploaded into CouchDB. It will be available under the url of the user object + _/photo_. When loading the user at a later time you still have access to the _content_type_ and additionally to the _length_ of the attachment:
|
365
386
|
|
366
387
|
user_reloaded = CouchPotato.database.load user.id
|
367
388
|
user_reloaded._attachments['photo'] # => {'content_type' => 'image/png', 'length' => 37861}
|
368
389
|
|
390
|
+
#### Multi DB Support
|
391
|
+
|
392
|
+
Couch Potato supports accessing multiple CouchDBs:
|
393
|
+
|
394
|
+
CouchPotato.with_database('couch_customer') do |couch|
|
395
|
+
couch.save @customer
|
396
|
+
end
|
397
|
+
|
398
|
+
Unless configured otherwise this would save the customer model to _http://127.0.0.1:5984/couch_customer_.
|
399
|
+
|
369
400
|
#### Testing
|
370
401
|
|
371
402
|
To make testing easier and faster database logic has been put into its own class, which you can replace and stub out in whatever way you want:
|
@@ -392,13 +423,13 @@ For stubbing out the database couch potato offers some helpers:
|
|
392
423
|
class Comment
|
393
424
|
view :by_commenter_id, :key => :commenter_id
|
394
425
|
end
|
395
|
-
|
426
|
+
|
396
427
|
# RSpec
|
397
428
|
require 'couch_potato/rspec'
|
398
|
-
|
429
|
+
|
399
430
|
db = stub_db # stubs CouchPotato.database
|
400
431
|
db.stub_view(Comment, :by_commenter_id).with('23').and_return([:comment1, :comment2])
|
401
|
-
|
432
|
+
|
402
433
|
CouchPotato.database.view(Comment.by_commenter_id('23)) # => [:comment1, :comment2]
|
403
434
|
CouchPotato.database.first(Comment.by_commenter_id('23)) # => :comment1
|
404
435
|
|
@@ -406,30 +437,29 @@ For stubbing out the database couch potato offers some helpers:
|
|
406
437
|
|
407
438
|
Couch Potato provides custom RSpec matchers for testing the map and reduce functions of your views. For example you can do this:
|
408
439
|
|
409
|
-
|
440
|
+
class User
|
410
441
|
include CouchPotato::Persistence
|
411
|
-
|
442
|
+
|
443
|
+
property :name
|
444
|
+
property :age, :type => Fixnum
|
445
|
+
|
412
446
|
view :by_name, :key => :name
|
413
|
-
view :by_age,
|
447
|
+
view :by_age, :key => :age
|
414
448
|
end
|
415
|
-
|
449
|
+
|
416
450
|
#RSpec
|
417
451
|
require 'couch_potato/rspec'
|
418
|
-
|
419
|
-
describe User, '
|
452
|
+
|
453
|
+
describe User, 'views' do
|
420
454
|
it "should map users to their name" do
|
421
|
-
User.by_name.should map(User.new(:name => 'bill', :age => 23)).to(['bill',
|
455
|
+
User.by_name.should map(User.new(:name => 'bill', :age => 23)).to(['bill', 1])
|
422
456
|
end
|
423
|
-
|
457
|
+
|
424
458
|
it "should reduce the users to the sum of their age" do
|
425
|
-
User.by_age.should reduce([], [
|
426
|
-
end
|
427
|
-
|
428
|
-
it "should rereduce" do
|
429
|
-
User.by_age.should rereduce([], [[23], [22]]).to(45)
|
459
|
+
User.by_age.should reduce([], [23, 22]).to(45)
|
430
460
|
end
|
431
461
|
end
|
432
|
-
|
462
|
+
|
433
463
|
This will actually run your map/reduce functions in a JavaScript interpreter, passing the arguments as JSON and converting the results back to Ruby. For more examples see the [spec](http://github.com/langalex/couch_potato/blob/master/spec/unit/rspec_matchers_spec.rb).
|
434
464
|
|
435
465
|
In order for this to work you must have the `js` executable in your PATH. This is usually part of the _spidermonkey_ package/port. (On MacPorts that's _spidemonkey_, on Linux it could be one of _libjs_, _libmozjs_ or _libspidermonkey_). When you installed CouchDB via your packet manager Spidermonkey should already be there.
|
data/Rakefile
CHANGED
@@ -3,82 +3,41 @@ Bundler::GemHelper.install_tasks
|
|
3
3
|
|
4
4
|
require 'rake'
|
5
5
|
require "rspec/core/rake_task"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require 'validatable'
|
11
|
-
|
12
|
-
ENV['VALIDATION_FRAMEWORK'] = 'validatable'
|
13
|
-
puts "Running task with Validatable validation framework."
|
14
|
-
yield block
|
15
|
-
rescue LoadError
|
16
|
-
STDERR.puts "WARNING: Validatable not available, skipping task."
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def with_active_model(&block)
|
21
|
-
begin
|
22
|
-
require 'active_model'
|
23
|
-
|
24
|
-
ENV['VALIDATION_FRAMEWORK'] = 'active_model'
|
25
|
-
puts "Running task with ActiveModel validation framework."
|
26
|
-
yield block
|
27
|
-
rescue LoadError
|
28
|
-
STDERR.puts "WARNING: ActiveModel not available, skipping task."
|
29
|
-
end
|
6
|
+
begin
|
7
|
+
require 'rdoc/task'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rake/rdoctask'
|
30
10
|
end
|
31
11
|
|
32
12
|
task :default => :spec
|
33
13
|
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
task :spec_functional_active_model do
|
39
|
-
with_active_model { Rake::Task['spec_functional_default'].execute }
|
40
|
-
end
|
41
|
-
|
42
|
-
task :spec_unit_validatable do
|
43
|
-
with_validatable { Rake::Task['spec_unit_default'].execute }
|
44
|
-
end
|
45
|
-
|
46
|
-
task :spec_unit_active_model do
|
47
|
-
with_active_model { Rake::Task['spec_unit_default'].execute }
|
48
|
-
end
|
49
|
-
|
50
|
-
desc "Run functional specs with default validation framework, override with VALIDATION_FRAMEWORK"
|
51
|
-
RSpec::Core::RakeTask.new(:spec_functional_default) do |spec|
|
14
|
+
desc "Run functional specs"
|
15
|
+
RSpec::Core::RakeTask.new(:spec_functional) do |spec|
|
52
16
|
spec.pattern = 'spec/*_spec.rb'
|
53
17
|
spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
54
18
|
end
|
55
19
|
|
56
|
-
desc "Run unit specs
|
57
|
-
RSpec::Core::RakeTask.new(:
|
20
|
+
desc "Run unit specs"
|
21
|
+
RSpec::Core::RakeTask.new(:spec_unit) do |spec|
|
58
22
|
spec.pattern = 'spec/unit/*_spec.rb'
|
59
23
|
spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
60
24
|
end
|
61
25
|
|
62
|
-
desc "Run functional specs with all validation frameworks"
|
63
|
-
task :spec_functional => [:spec_functional_validatable, :spec_functional_active_model] do
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "Run unit specs with all validation frameworks"
|
67
|
-
task :spec_unit => [:spec_unit_validatable, :spec_unit_active_model] do
|
68
|
-
end
|
69
|
-
|
70
26
|
desc "Run all specs"
|
71
27
|
task :spec do
|
72
|
-
['
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
28
|
+
if ENV['TRAVIS'] # travis handles the environments for us
|
29
|
+
Rake::Task[:spec_unit].execute
|
30
|
+
Rake::Task[:spec_functional].execute
|
31
|
+
else
|
32
|
+
['3_0', '3_1', '3_2'].each do |version|
|
33
|
+
Bundler.with_clean_env do
|
34
|
+
puts "Running tests with ActiveSupport #{version.sub('_', '.')}"
|
35
|
+
sh "env BUNDLE_GEMFILE=active_support_#{version} bundle install"
|
36
|
+
sh "env BUNDLE_GEMFILE=active_support_#{version} bundle exec rake spec_unit spec_functional"
|
37
|
+
end
|
80
38
|
end
|
81
39
|
end
|
40
|
+
|
82
41
|
end
|
83
42
|
|
84
43
|
desc 'Generate documentation'
|
data/active_support_3_0.lock
CHANGED
@@ -22,6 +22,7 @@ GEM
|
|
22
22
|
diff-lcs (1.1.2)
|
23
23
|
i18n (0.5.0)
|
24
24
|
json (1.6.1)
|
25
|
+
libv8 (3.3.10.4)
|
25
26
|
mime-types (1.16)
|
26
27
|
multi_json (1.0.3)
|
27
28
|
rake (0.8.7)
|
@@ -35,6 +36,8 @@ GEM
|
|
35
36
|
rspec-expectations (2.5.0)
|
36
37
|
diff-lcs (~> 1.1.2)
|
37
38
|
rspec-mocks (2.5.0)
|
39
|
+
therubyracer (0.10.1)
|
40
|
+
libv8 (~> 3.3.10)
|
38
41
|
timecop (0.3.5)
|
39
42
|
tzinfo (0.3.26)
|
40
43
|
|
@@ -46,5 +49,6 @@ DEPENDENCIES
|
|
46
49
|
couch_potato!
|
47
50
|
rake
|
48
51
|
rspec (>= 2.0)
|
52
|
+
therubyracer
|
49
53
|
timecop
|
50
54
|
tzinfo
|
data/active_support_3_1.lock
CHANGED
@@ -25,6 +25,7 @@ GEM
|
|
25
25
|
diff-lcs (1.1.2)
|
26
26
|
i18n (0.6.0)
|
27
27
|
json (1.6.1)
|
28
|
+
libv8 (3.3.10.4)
|
28
29
|
mime-types (1.16)
|
29
30
|
multi_json (1.0.3)
|
30
31
|
rake (0.9.2)
|
@@ -38,6 +39,8 @@ GEM
|
|
38
39
|
rspec-expectations (2.6.0)
|
39
40
|
diff-lcs (~> 1.1.2)
|
40
41
|
rspec-mocks (2.6.0)
|
42
|
+
therubyracer (0.10.1)
|
43
|
+
libv8 (~> 3.3.10)
|
41
44
|
timecop (0.3.5)
|
42
45
|
tzinfo (0.3.29)
|
43
46
|
|
@@ -49,5 +52,6 @@ DEPENDENCIES
|
|
49
52
|
couch_potato!
|
50
53
|
rake
|
51
54
|
rspec (>= 2.0)
|
55
|
+
therubyracer
|
52
56
|
timecop
|
53
57
|
tzinfo
|
data/active_support_3_2
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
couch_potato (0.6.0)
|
5
|
+
activemodel
|
6
|
+
couchrest (>= 1.0.1)
|
7
|
+
json (~> 1.6.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activemodel (3.2.1)
|
13
|
+
activesupport (= 3.2.1)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
activesupport (3.2.1)
|
16
|
+
i18n (~> 0.6)
|
17
|
+
multi_json (~> 1.0)
|
18
|
+
builder (3.0.0)
|
19
|
+
couchrest (1.1.2)
|
20
|
+
mime-types (~> 1.15)
|
21
|
+
multi_json (~> 1.0.0)
|
22
|
+
rest-client (~> 1.6.1)
|
23
|
+
diff-lcs (1.1.3)
|
24
|
+
i18n (0.6.0)
|
25
|
+
json (1.6.5)
|
26
|
+
libv8 (3.3.10.4)
|
27
|
+
mime-types (1.17.2)
|
28
|
+
multi_json (1.0.4)
|
29
|
+
rake (0.9.2.2)
|
30
|
+
rest-client (1.6.7)
|
31
|
+
mime-types (>= 1.16)
|
32
|
+
rspec (2.8.0)
|
33
|
+
rspec-core (~> 2.8.0)
|
34
|
+
rspec-expectations (~> 2.8.0)
|
35
|
+
rspec-mocks (~> 2.8.0)
|
36
|
+
rspec-core (2.8.0)
|
37
|
+
rspec-expectations (2.8.0)
|
38
|
+
diff-lcs (~> 1.1.2)
|
39
|
+
rspec-mocks (2.8.0)
|
40
|
+
therubyracer (0.10.1)
|
41
|
+
libv8 (~> 3.3.10)
|
42
|
+
timecop (0.3.5)
|
43
|
+
tzinfo (0.3.31)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
activemodel (~> 3.2)
|
50
|
+
couch_potato!
|
51
|
+
rake
|
52
|
+
rspec (>= 2.0)
|
53
|
+
therubyracer
|
54
|
+
timecop
|
55
|
+
tzinfo
|
data/couch_potato.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency 'timecop'
|
21
21
|
s.add_development_dependency 'tzinfo'
|
22
22
|
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'therubyracer'
|
23
24
|
|
24
25
|
s.files = `git ls-files`.split("\n")
|
25
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|