dm-ambition 1.0.0 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,13 @@ describe DataMapper::Ambition::Query do
11
11
  property :admin, Boolean
12
12
  end
13
13
 
14
+ class ::Person
15
+ include DataMapper::Resource
16
+
17
+ property :first_name, String, :key => true
18
+ property :last_name, String, :key => true
19
+ end
20
+
14
21
  if DataMapper.respond_to?(:auto_migrate!)
15
22
  DataMapper.auto_migrate!
16
23
  end
@@ -27,8 +34,8 @@ describe DataMapper::Ambition::Query do
27
34
  it { @subject.should respond_to(:filter) }
28
35
 
29
36
  describe '#filter' do
30
- describe 'with operator' do
31
- describe '==' do
37
+ context 'with operator' do
38
+ context '==' do
32
39
  before :all do
33
40
  @return = @subject.filter { |u| u.name == 'Dan Kubb' }
34
41
  end
@@ -48,7 +55,7 @@ describe DataMapper::Ambition::Query do
48
55
  end
49
56
  end
50
57
 
51
- describe '=~' do
58
+ context '=~' do
52
59
  before :all do
53
60
  @return = @subject.filter { |u| u.name =~ /Dan Kubb/ }
54
61
  end
@@ -68,7 +75,7 @@ describe DataMapper::Ambition::Query do
68
75
  end
69
76
  end
70
77
 
71
- describe '>' do
78
+ context '>' do
72
79
  before :all do
73
80
  @return = @subject.filter { |u| u.id > 1 }
74
81
  end
@@ -88,7 +95,7 @@ describe DataMapper::Ambition::Query do
88
95
  end
89
96
  end
90
97
 
91
- describe '>=' do
98
+ context '>=' do
92
99
  before :all do
93
100
  @return = @subject.filter { |u| u.id >= 1 }
94
101
  end
@@ -108,7 +115,7 @@ describe DataMapper::Ambition::Query do
108
115
  end
109
116
  end
110
117
 
111
- describe '<' do
118
+ context '<' do
112
119
  before :all do
113
120
  @return = @subject.filter { |u| u.id < 1 }
114
121
  end
@@ -128,7 +135,7 @@ describe DataMapper::Ambition::Query do
128
135
  end
129
136
  end
130
137
 
131
- describe '<=' do
138
+ context '<=' do
132
139
  before :all do
133
140
  @return = @subject.filter { |u| u.id <= 1 }
134
141
  end
@@ -149,7 +156,7 @@ describe DataMapper::Ambition::Query do
149
156
  end
150
157
 
151
158
  [ :include?, :member? ].each do |method|
152
- describe "Array##{method}" do
159
+ context "Array##{method}" do
153
160
  before :all do
154
161
  @return = @subject.filter { |u| [ 1, 2 ].send(method, u.id) }
155
162
  end
@@ -171,7 +178,7 @@ describe DataMapper::Ambition::Query do
171
178
  end
172
179
 
173
180
  [ :include?, :member?, :=== ].each do |method|
174
- describe "Range##{method} (inclusive)" do
181
+ context "Range##{method} (inclusive)" do
175
182
  before :all do
176
183
  @return = @subject.filter { |u| (1..2).send(method, u.id) }
177
184
  end
@@ -191,7 +198,7 @@ describe DataMapper::Ambition::Query do
191
198
  end
192
199
  end
193
200
 
194
- describe "Range##{method} (exclusive)" do
201
+ context "Range##{method} (exclusive)" do
195
202
  before :all do
196
203
  @return = @subject.filter { |u| (1...3).send(method, u.id) }
197
204
  end
@@ -213,7 +220,7 @@ describe DataMapper::Ambition::Query do
213
220
  end
214
221
 
215
222
  [ :key?, :has_key?, :include?, :member? ].each do |method|
216
- describe "Hash##{method}" do
223
+ context "Hash##{method}" do
217
224
  before :all do
218
225
  @return = @subject.filter { |u| { 1 => '1', 2 => '2' }.send(method, u.id) }
219
226
  end
@@ -235,9 +242,9 @@ describe DataMapper::Ambition::Query do
235
242
  end
236
243
 
237
244
  [ :value?, :has_value? ].each do |method|
238
- describe "Hash##{method}" do
245
+ context "Hash##{method}" do
239
246
  before :all do
240
- @return = @subject.filter { |u| { '1' => 1, '2' => 2 }.value?(u.id) }
247
+ @return = @subject.filter { |u| { '1' => 1, '2' => 2 }.send(method, u.id) }
241
248
  end
242
249
 
243
250
  it 'should return a Query' do
@@ -256,7 +263,7 @@ describe DataMapper::Ambition::Query do
256
263
  end
257
264
  end
258
265
 
259
- describe 'receiver.method.nil?' do
266
+ context 'receiver.method.nil?' do
260
267
  before :all do
261
268
  @return = @subject.filter { |u| u.id.nil? }
262
269
  end
@@ -277,8 +284,8 @@ describe DataMapper::Ambition::Query do
277
284
  end
278
285
  end
279
286
 
280
- describe 'with bind value' do
281
- describe 'nil' do
287
+ context 'with bind value' do
288
+ context 'nil' do
282
289
  before :all do
283
290
  @return = @subject.filter { |u| u.name == nil }
284
291
  end
@@ -298,7 +305,7 @@ describe DataMapper::Ambition::Query do
298
305
  end
299
306
  end
300
307
 
301
- describe 'true' do
308
+ context 'true' do
302
309
  before :all do
303
310
  @return = @subject.filter { |u| u.admin == true }
304
311
  end
@@ -318,7 +325,7 @@ describe DataMapper::Ambition::Query do
318
325
  end
319
326
  end
320
327
 
321
- describe 'false' do
328
+ context 'false' do
322
329
  before :all do
323
330
  @return = @subject.filter { |u| u.admin == false }
324
331
  end
@@ -339,8 +346,8 @@ describe DataMapper::Ambition::Query do
339
346
  end
340
347
  end
341
348
 
342
- describe 'with conditions' do
343
- describe 'ANDed' do
349
+ context 'with conditions' do
350
+ context 'ANDed' do
344
351
  before :all do
345
352
  @return = @subject.filter { |u| u.id == 1 && u.name == 'Dan Kubb' }
346
353
  end
@@ -361,7 +368,7 @@ describe DataMapper::Ambition::Query do
361
368
  end
362
369
  end
363
370
 
364
- describe 'ORed' do
371
+ context 'ORed' do
365
372
  before :all do
366
373
  @return = @subject.filter { |u| u.id == 1 || u.name == 'Dan Kubb' }
367
374
  end
@@ -384,7 +391,7 @@ describe DataMapper::Ambition::Query do
384
391
  end
385
392
  end
386
393
 
387
- describe 'negated' do
394
+ context 'negated' do
388
395
  before :all do
389
396
  @return = @subject.filter { |u| !(u.id == 1) }
390
397
  end
@@ -406,7 +413,7 @@ describe DataMapper::Ambition::Query do
406
413
  end
407
414
  end
408
415
 
409
- describe 'double-negated' do
416
+ context 'double-negated' do
410
417
  before :all do
411
418
  @return = @subject.filter { |u| !(!(u.id == 1)) }
412
419
  end
@@ -421,18 +428,14 @@ describe DataMapper::Ambition::Query do
421
428
 
422
429
  it 'should set conditions' do
423
430
  @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
424
- DataMapper::Query::Conditions::Operation.new(:not,
425
- DataMapper::Query::Conditions::Operation.new(:not,
426
- DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:id], 1)
427
- )
428
- )
431
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:id], 1)
429
432
  )
430
433
  end
431
434
  end
432
435
 
433
- describe 'receiver matching a resource' do
436
+ context 'receiver matching a resource' do
434
437
  before :all do
435
- resource = User.create(:id => 1)
438
+ resource = @model.new(:id => 1)
436
439
 
437
440
  @return = @subject.filter { |u| u == resource }
438
441
  end
@@ -452,12 +455,75 @@ describe DataMapper::Ambition::Query do
452
455
  end
453
456
  end
454
457
 
458
+ context 'resource matching a receiver' do
459
+ before :all do
460
+ resource = @model.new(:id => 1)
461
+
462
+ @return = @subject.filter { |u| resource == u }
463
+ end
464
+
465
+ it 'should return a Query' do
466
+ @return.should be_kind_of(DataMapper::Query)
467
+ end
468
+
469
+ it 'should not return self' do
470
+ @return.should_not equal(@subject)
471
+ end
472
+
473
+ it 'should set conditions' do
474
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
475
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:id], 1)
476
+ )
477
+ end
478
+ end
479
+
480
+ context 'receiver matching a non-resource' do
481
+ before :all do
482
+ @return = @subject.filter { |u| u == nil }
483
+ end
484
+
485
+ it 'should return a Query' do
486
+ @return.should be_kind_of(DataMapper::Query)
487
+ end
488
+
489
+ it 'should not return self' do
490
+ @return.should_not equal(@subject)
491
+ end
492
+
493
+ it 'should set conditions' do
494
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
495
+ DataMapper::Query::Conditions::Comparison.new(:in, @model.properties[:id], [])
496
+ )
497
+ end
498
+ end
499
+
500
+ context 'non-resource matching a receiver' do
501
+ before :all do
502
+ @return = @subject.filter { |u| nil == u }
503
+ end
504
+
505
+ it 'should return a Query' do
506
+ @return.should be_kind_of(DataMapper::Query)
507
+ end
508
+
509
+ it 'should not return self' do
510
+ @return.should_not equal(@subject)
511
+ end
512
+
513
+ it 'should set conditions' do
514
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
515
+ DataMapper::Query::Conditions::Comparison.new(:in, @model.properties[:id], [])
516
+ )
517
+ end
518
+ end
519
+
455
520
  [ :include?, :member? ].each do |method|
456
- describe "receiver matching a resource using Array##{method}" do
521
+ context "receiver matching a resource using Array##{method}" do
457
522
  before :all do
458
- resource = User.new(:id => 1)
523
+ one = @model.new(:id => 1)
524
+ two = @model.new(:id => 2)
459
525
 
460
- @return = @subject.filter { |u| [ resource ].send(method, u) }
526
+ @return = @subject.filter { |u| [ one, two ].send(method, u) }
461
527
  end
462
528
 
463
529
  it 'should return a Query' do
@@ -470,17 +536,52 @@ describe DataMapper::Ambition::Query do
470
536
 
471
537
  it 'should set conditions' do
472
538
  @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
473
- DataMapper::Query::Conditions::Comparison.new(:in, @model.properties[:id], [ 1 ])
539
+ DataMapper::Query::Conditions::Comparison.new(:in, @model.properties[:id], [ 1, 2 ])
540
+ )
541
+ end
542
+ end
543
+
544
+ context "receiver matching a resource (with a CPK) using Array##{method}" do
545
+ before :all do
546
+ @model = Person
547
+ @subject = DataMapper::Query.new(@repository, @model)
548
+
549
+ @one = @model.new(:first_name => 'Dan', :last_name => 'Kubb')
550
+ @two = @model.new(:first_name => 'John', :last_name => 'Doe')
551
+
552
+ @return = @subject.filter { |p| [ @one, @two ].send(method, p) }
553
+ end
554
+
555
+ it 'should return a Query' do
556
+ @return.should be_kind_of(DataMapper::Query)
557
+ end
558
+
559
+ it 'should not return self' do
560
+ @return.should_not equal(@subject)
561
+ end
562
+
563
+ it 'should set conditions' do
564
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
565
+ DataMapper::Query::Conditions::Operation.new(:or,
566
+ DataMapper::Query::Conditions::Operation.new(:and,
567
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:first_name], 'Dan'),
568
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:last_name], 'Kubb')
569
+ ),
570
+ DataMapper::Query::Conditions::Operation.new(:and,
571
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:first_name], 'John'),
572
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:last_name], 'Doe')
573
+ )
574
+ )
474
575
  )
475
576
  end
476
577
  end
477
578
  end
478
579
 
479
580
  [ :key?, :has_key?, :include?, :member? ].each do |method|
480
- describe "receiver matching a resource using Hash##{method}" do
581
+ context "receiver matching a resource using Hash##{method}" do
481
582
  before :all do
482
- one = User.new(:id => 1)
483
- two = User.new(:id => 2)
583
+ one = @model.new(:id => 1)
584
+ two = @model.new(:id => 2)
484
585
 
485
586
  @return = @subject.filter { |u| { one => '1', two => '2' }.send(method, u) }
486
587
  end
@@ -502,10 +603,10 @@ describe DataMapper::Ambition::Query do
502
603
  end
503
604
 
504
605
  [ :value?, :has_value? ].each do |method|
505
- describe "receiver matching a resource using Hash##{method}" do
606
+ context "receiver matching a resource using Hash##{method}" do
506
607
  before :all do
507
- one = User.new(:id => 1)
508
- two = User.new(:id => 2)
608
+ one = @model.new(:id => 1)
609
+ two = @model.new(:id => 2)
509
610
 
510
611
  @return = @subject.filter { |u| { '1' => one, '2' => two }.send(method, u) }
511
612
  end
@@ -526,29 +627,31 @@ describe DataMapper::Ambition::Query do
526
627
  end
527
628
  end
528
629
 
529
- describe 'using send on receiver' do
530
- before :all do
531
- @return = @subject.filter { |u| u.send(:name) == 'Dan Kubb' }
532
- end
630
+ [ :send, :__send__ ].each do |method|
631
+ context 'using send on receiver' do
632
+ before :all do
633
+ @return = @subject.filter { |u| u.send(method, :name) == 'Dan Kubb' }
634
+ end
533
635
 
534
- it 'should return a Query' do
535
- @return.should be_kind_of(DataMapper::Query)
536
- end
636
+ it 'should return a Query' do
637
+ @return.should be_kind_of(DataMapper::Query)
638
+ end
537
639
 
538
- it 'should not return self' do
539
- @return.should_not equal(@subject)
540
- end
640
+ it 'should not return self' do
641
+ @return.should_not equal(@subject)
642
+ end
541
643
 
542
- it 'should set conditions' do
543
- @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
544
- DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], 'Dan Kubb')
545
- )
644
+ it 'should set conditions' do
645
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
646
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], 'Dan Kubb')
647
+ )
648
+ end
546
649
  end
547
650
  end
548
651
  end
549
652
 
550
- describe 'with external value' do
551
- describe 'local variable' do
653
+ context 'with external value' do
654
+ context 'local variable' do
552
655
  before :all do
553
656
  name = 'Dan Kubb'
554
657
 
@@ -570,7 +673,7 @@ describe DataMapper::Ambition::Query do
570
673
  end
571
674
  end
572
675
 
573
- describe 'instance variable' do
676
+ context 'instance variable' do
574
677
  before :all do
575
678
  @name = 'Dan Kubb'
576
679
 
@@ -592,7 +695,7 @@ describe DataMapper::Ambition::Query do
592
695
  end
593
696
  end
594
697
 
595
- describe 'global variable' do
698
+ context 'global variable' do
596
699
  before :all do
597
700
  $name = 'Dan Kubb'
598
701
 
@@ -614,7 +717,7 @@ describe DataMapper::Ambition::Query do
614
717
  end
615
718
  end
616
719
 
617
- describe 'method' do
720
+ context 'method' do
618
721
  def name
619
722
  'Dan Kubb'
620
723
  end
@@ -632,15 +735,37 @@ describe DataMapper::Ambition::Query do
632
735
  end
633
736
 
634
737
  it 'should set conditions' do
635
- pending 'TODO: make methods work inside block' do
636
- @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
637
- DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], name)
638
- )
639
- end
738
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
739
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], 'Dan Kubb')
740
+ )
640
741
  end
641
742
  end
642
743
 
643
- describe 'constant' do
744
+ context 'method with arguments' do
745
+ def name(first_name, last_name)
746
+ "#{first_name} #{last_name}"
747
+ end
748
+
749
+ before :all do
750
+ @return = @subject.filter { |u| u.name == name('Dan', 'Kubb') }
751
+ end
752
+
753
+ it 'should return a Query' do
754
+ @return.should be_kind_of(DataMapper::Query)
755
+ end
756
+
757
+ it 'should not return self' do
758
+ @return.should_not equal(@subject)
759
+ end
760
+
761
+ it 'should set conditions' do
762
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
763
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], 'Dan Kubb')
764
+ )
765
+ end
766
+ end
767
+
768
+ context 'constant' do
644
769
  NAME = 'Dan Kubb'
645
770
 
646
771
  before :all do
@@ -662,7 +787,7 @@ describe DataMapper::Ambition::Query do
662
787
  end
663
788
  end
664
789
 
665
- describe 'namespaced constant' do
790
+ context 'namespaced constant' do
666
791
  before :all do
667
792
  Object.send(:remove_const, :Condition) if defined?(::Condition)
668
793
  module ::Condition
@@ -687,7 +812,7 @@ describe DataMapper::Ambition::Query do
687
812
  end
688
813
  end
689
814
 
690
- describe 'namespaced method' do
815
+ context 'namespaced method' do
691
816
  before :all do
692
817
  Object.send(:remove_const, :Condition) if defined?(::Condition)
693
818
  module ::Condition
@@ -714,5 +839,96 @@ describe DataMapper::Ambition::Query do
714
839
  end
715
840
  end
716
841
  end
842
+
843
+ context 'with literal' do
844
+ context 'true' do
845
+ before :all do
846
+ @return = @subject.filter { |u| true }
847
+ end
848
+
849
+ it 'should return a Query' do
850
+ @return.should be_kind_of(DataMapper::Query)
851
+ end
852
+
853
+ it 'should not return self' do
854
+ @return.should_not equal(@subject)
855
+ end
856
+
857
+ it 'should set conditions' do
858
+ pending do
859
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:null)
860
+ end
861
+ end
862
+ end
863
+
864
+ [ nil, false ].each do |literal|
865
+ context literal.inspect do
866
+ before :all do
867
+ @return = @subject.filter { |u| literal }
868
+ end
869
+
870
+ it 'should return a Query' do
871
+ @return.should be_kind_of(DataMapper::Query)
872
+ end
873
+
874
+ it 'should not return self' do
875
+ @return.should_not equal(@subject)
876
+ end
877
+
878
+ it 'should set conditions' do
879
+ pending 'TODO: figure out a way to represent that nothing matches'
880
+ end
881
+ end
882
+ end
883
+ end
884
+
885
+ context 'with single local variable assignment' do
886
+ before do
887
+ @return = @subject.filter { |u| name = 'Dan Kubb'; u.name == name }
888
+ end
889
+
890
+ it 'should return a Query' do
891
+ @return.should be_kind_of(DataMapper::Query)
892
+ end
893
+
894
+ it 'should not return self' do
895
+ @return.should_not equal(@subject)
896
+ end
897
+
898
+ it 'should set conditions' do
899
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
900
+ DataMapper::Query::Conditions::Comparison.new(:eql, @model.properties[:name], 'Dan Kubb')
901
+ )
902
+ end
903
+ end
904
+
905
+ context 'with multiple local variable assignment' do
906
+ before do
907
+ @return = @subject.filter { |u| name1, name2 = 'Dan Kubb', 'John Doe'; [ name1, name2 ].include?(u.name) }
908
+ end
909
+
910
+ it 'should return a Query' do
911
+ @return.should be_kind_of(DataMapper::Query)
912
+ end
913
+
914
+ it 'should not return self' do
915
+ @return.should_not equal(@subject)
916
+ end
917
+
918
+ it 'should set conditions' do
919
+ @return.conditions.should == DataMapper::Query::Conditions::Operation.new(:and,
920
+ DataMapper::Query::Conditions::Comparison.new(:in, @model.properties[:name], [ 'Dan Kubb', 'John Doe' ])
921
+ )
922
+ end
923
+ end
924
+
925
+ context 'with an invalid block' do
926
+ specify do
927
+ expect {
928
+ # global assignment will not be allowed within the block
929
+ @subject.filter { |u| $name = 'Dan Kubb'; u.name == $name }
930
+ }.to raise_error(ArgumentError, 'calling process_gasgn with s(:$name, s(:str, "Dan Kubb"))')
931
+ end
932
+ end
717
933
  end
718
934
  end
data/spec/spec_helper.rb CHANGED
@@ -1,49 +1,17 @@
1
- require 'pathname'
2
- require 'rubygems'
3
- require 'spec'
1
+ require 'dm-ambition'
4
2
 
5
- require 'dm-core'
6
- require 'dm-migrations'
3
+ require 'dm-core/spec/setup'
4
+ require 'dm-core/spec/lib/adapter_helpers'
5
+ require 'dm-core/spec/lib/spec_helper'
7
6
 
8
- SPEC_ROOT = Pathname(__FILE__).dirname.expand_path
9
- require SPEC_ROOT.parent / 'lib' / 'dm-ambition'
10
- Pathname.glob((SPEC_ROOT / '{lib,*/shared}/**/*.rb').to_s).each { |f| require f }
11
-
12
- def load_driver(name, default_uri)
13
- return false if ENV['ADAPTER'] != name.to_s
14
-
15
- begin
16
- DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
17
- DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
18
- true
19
- rescue LoadError => e
20
- warn "Could not load do_#{name}: #{e}"
21
- false
22
- end
23
- end
24
-
25
- ENV['ADAPTER'] ||= 'sqlite3'
26
-
27
- HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:')
28
- HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test')
29
- HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
7
+ Dir['spec/*/shared/**/*.rb'].each { |file| require File.expand_path(file) }
30
8
 
31
9
  Spec::Runner.configure do |config|
32
- config.after :all do
33
- # global model cleanup
34
- descendants = DataMapper::Model.descendants.to_a
35
- while model = descendants.shift
36
- descendants.concat(model.descendants.to_a - [ model ])
37
-
38
- parts = model.name.split('::')
39
- constant_name = parts.pop.to_sym
40
- base = parts.empty? ? Object : Object.full_const_get(parts.join('::'))
41
10
 
42
- if base.const_defined?(constant_name)
43
- base.send(:remove_const, constant_name)
44
- end
11
+ config.extend(DataMapper::Spec::Adapters::Helpers)
45
12
 
46
- DataMapper::Model.descendants.delete(model)
47
- end
13
+ config.after :all do
14
+ DataMapper::Spec.cleanup_models
48
15
  end
16
+
49
17
  end
@@ -0,0 +1,16 @@
1
+ desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
2
+ task :local_gemfile do |t|
3
+
4
+ root = Pathname(__FILE__).dirname.parent
5
+ datamapper = root.parent
6
+
7
+ root.join('Gemfile.local').open('w') do |f|
8
+ root.join('Gemfile').open.each do |line|
9
+ line.sub!(/DATAMAPPER = 'git:\/\/github.com\/datamapper'/, "DATAMAPPER = '#{datamapper}'")
10
+ line.sub!(/:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, ':path => "#{DATAMAPPER}/\1"')
11
+ line.sub!(/do_options\[:git\] = \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, 'do_options[:path] = "#{DATAMAPPER}/\1"')
12
+ f.puts line
13
+ end
14
+ end
15
+
16
+ end
data/tasks/spec.rake CHANGED
@@ -35,7 +35,4 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
39
- task :rcov => :check_dependencies
40
-
41
38
  task :default => :spec