dm-is-list 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -2
- data/LICENSE +1 -1
- data/Rakefile +3 -4
- data/VERSION +1 -1
- data/dm-is-list.gemspec +9 -12
- data/lib/dm-is-list/is/list.rb +8 -13
- data/spec/integration/list_spec.rb +2 -11
- data/spec/rcov.opts +1 -1
- data/spec/spec_helper.rb +2 -0
- data/tasks/spec.rake +3 -0
- metadata +13 -30
data/Gemfile
CHANGED
@@ -71,7 +71,7 @@
|
|
71
71
|
source 'http://rubygems.org'
|
72
72
|
|
73
73
|
DATAMAPPER = 'git://github.com/datamapper'
|
74
|
-
DM_VERSION = '~> 1.0.0.
|
74
|
+
DM_VERSION = '~> 1.0.0.rc3'
|
75
75
|
|
76
76
|
group :runtime do # Runtime dependencies (as in the gemspec)
|
77
77
|
|
@@ -83,7 +83,6 @@ group :runtime do # Runtime dependencies (as in the gemspec)
|
|
83
83
|
|
84
84
|
gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
|
85
85
|
gem 'dm-adjust', DM_VERSION, :git => "#{DATAMAPPER}/dm-adjust.git"
|
86
|
-
gem 'dm-transactions', DM_VERSION, :git => "#{DATAMAPPER}/dm-transactions.git"
|
87
86
|
|
88
87
|
end
|
89
88
|
|
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -10,14 +10,13 @@ begin
|
|
10
10
|
gem.summary = 'DataMapper plugin for creating and organizing lists'
|
11
11
|
gem.description = gem.summary
|
12
12
|
gem.email = 'sindre [a] identu [d] no'
|
13
|
-
gem.homepage = 'http://github.com/datamapper
|
13
|
+
gem.homepage = 'http://github.com/datamapper/%s' % gem.name
|
14
14
|
gem.authors = [ 'Sindre Aarsaether' ]
|
15
15
|
|
16
16
|
gem.rubyforge_project = 'datamapper'
|
17
17
|
|
18
|
-
gem.add_dependency 'dm-core',
|
19
|
-
gem.add_dependency 'dm-adjust',
|
20
|
-
gem.add_dependency 'dm-transactions', '~> 1.0.0.rc2'
|
18
|
+
gem.add_dependency 'dm-core', '~> 1.0.0.rc3'
|
19
|
+
gem.add_dependency 'dm-adjust', '~> 1.0.0.rc3'
|
21
20
|
|
22
21
|
gem.add_development_dependency 'rspec', '~> 1.3'
|
23
22
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.rc3
|
data/dm-is-list.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-is-list}
|
8
|
-
s.version = "1.0.0.
|
8
|
+
s.version = "1.0.0.rc3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sindre Aarsaether"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-27}
|
13
13
|
s.description = %q{DataMapper plugin for creating and organizing lists}
|
14
14
|
s.email = %q{sindre [a] identu [d] no}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"tasks/yard.rake",
|
38
38
|
"tasks/yardstick.rake"
|
39
39
|
]
|
40
|
-
s.homepage = %q{http://github.com/datamapper/dm-
|
40
|
+
s.homepage = %q{http://github.com/datamapper/dm-is-list}
|
41
41
|
s.rdoc_options = ["--charset=UTF-8"]
|
42
42
|
s.require_paths = ["lib"]
|
43
43
|
s.rubyforge_project = %q{datamapper}
|
@@ -53,20 +53,17 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.specification_version = 3
|
54
54
|
|
55
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.
|
57
|
-
s.add_runtime_dependency(%q<dm-adjust>, ["~> 1.0.0.
|
58
|
-
s.add_runtime_dependency(%q<dm-transactions>, ["~> 1.0.0.rc2"])
|
56
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
|
57
|
+
s.add_runtime_dependency(%q<dm-adjust>, ["~> 1.0.0.rc3"])
|
59
58
|
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
60
59
|
else
|
61
|
-
s.add_dependency(%q<dm-core>, ["~> 1.0.0.
|
62
|
-
s.add_dependency(%q<dm-adjust>, ["~> 1.0.0.
|
63
|
-
s.add_dependency(%q<dm-transactions>, ["~> 1.0.0.rc2"])
|
60
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
|
61
|
+
s.add_dependency(%q<dm-adjust>, ["~> 1.0.0.rc3"])
|
64
62
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
65
63
|
end
|
66
64
|
else
|
67
|
-
s.add_dependency(%q<dm-core>, ["~> 1.0.0.
|
68
|
-
s.add_dependency(%q<dm-adjust>, ["~> 1.0.0.
|
69
|
-
s.add_dependency(%q<dm-transactions>, ["~> 1.0.0.rc2"])
|
65
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
|
66
|
+
s.add_dependency(%q<dm-adjust>, ["~> 1.0.0.rc3"])
|
70
67
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
71
68
|
end
|
72
69
|
end
|
data/lib/dm-is-list/is/list.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'dm-core'
|
2
|
-
require 'dm-transactions'
|
3
2
|
require 'dm-adjust'
|
4
3
|
|
5
4
|
module DataMapper
|
@@ -253,8 +252,8 @@ module DataMapper
|
|
253
252
|
extend DataMapper::Is::List::ClassMethods
|
254
253
|
include DataMapper::Is::List::InstanceMethods
|
255
254
|
|
256
|
-
unless properties.any? { |p| p.
|
257
|
-
property :position, Integer
|
255
|
+
unless properties.any? { |p| p.kind_of?(Property::Integer) && p.name == :position }
|
256
|
+
property :position, Integer, :min => options[:first], :required => true
|
258
257
|
end
|
259
258
|
|
260
259
|
@list_options = options
|
@@ -442,13 +441,11 @@ module DataMapper
|
|
442
441
|
#
|
443
442
|
# @api public
|
444
443
|
def move_to_list(scope, pos = nil)
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
self.move(pos) unless pos.nil?
|
451
|
-
end
|
444
|
+
detach # remove from current list
|
445
|
+
attribute_set(model.list_options[:scope][0], scope.to_i) # set new scope
|
446
|
+
save # save progress. Needed to get the positions correct.
|
447
|
+
reload # get a fresh new start
|
448
|
+
move(pos) unless pos.nil?
|
452
449
|
end
|
453
450
|
|
454
451
|
##
|
@@ -517,9 +514,7 @@ module DataMapper
|
|
517
514
|
#
|
518
515
|
# @api public
|
519
516
|
def move(vector)
|
520
|
-
|
521
|
-
move_without_saving(vector) && save
|
522
|
-
end
|
517
|
+
move_without_saving(vector) && save
|
523
518
|
end
|
524
519
|
|
525
520
|
|
@@ -568,11 +568,6 @@ describe 'DataMapper::Is::List' do
|
|
568
568
|
end
|
569
569
|
|
570
570
|
it "should move an item from one list to a fixed position in another list" do
|
571
|
-
pending %Q{Failing Test: Error = [ no such table: todos ]. Error is due to the nested transactions. (See notes in spec)}
|
572
|
-
# NOTE:: This error happens because of the nested transactions taking place
|
573
|
-
# first within the #move_to_list and then the #move method.
|
574
|
-
# If you comment out either of those transactions, the test passes.
|
575
|
-
|
576
571
|
DataMapper.repository(:default) do |repos|
|
577
572
|
item = Todo.get(2)
|
578
573
|
list_scope = Todo.get(6).list_scope
|
@@ -638,10 +633,6 @@ describe 'DataMapper::Is::List' do
|
|
638
633
|
|
639
634
|
describe "CRUD" do
|
640
635
|
|
641
|
-
# describe "#create" do
|
642
|
-
# pending
|
643
|
-
# end #/ #create
|
644
|
-
|
645
636
|
describe "Updating list items" do
|
646
637
|
|
647
638
|
it "should NOT loose position when updating other attributes" do
|
@@ -956,8 +947,8 @@ describe 'DataMapper::Is::List' do
|
|
956
947
|
|
957
948
|
property :id, Serial
|
958
949
|
property :title, String
|
959
|
-
property :position, Integer, :required => true, :
|
960
|
-
property :client_id, Integer, :
|
950
|
+
property :position, Integer, :min => 1, :required => true, :unique => :position
|
951
|
+
property :client_id, Integer, :unique => :position
|
961
952
|
|
962
953
|
belongs_to :client
|
963
954
|
|
data/spec/rcov.opts
CHANGED
data/spec/spec_helper.rb
CHANGED
data/tasks/spec.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 977940572
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
10
|
+
- rc3
|
11
|
+
version: 1.0.0.rc3
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Sindre Aarsaether
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-27 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,13 +27,13 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 977940572
|
31
31
|
segments:
|
32
32
|
- 1
|
33
33
|
- 0
|
34
34
|
- 0
|
35
|
-
-
|
36
|
-
version: 1.0.0.
|
35
|
+
- rc3
|
36
|
+
version: 1.0.0.rc3
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id001
|
39
39
|
- !ruby/object:Gem::Dependency
|
@@ -44,36 +44,19 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
hash:
|
47
|
+
hash: 977940572
|
48
48
|
segments:
|
49
49
|
- 1
|
50
50
|
- 0
|
51
51
|
- 0
|
52
|
-
-
|
53
|
-
version: 1.0.0.
|
52
|
+
- rc3
|
53
|
+
version: 1.0.0.rc3
|
54
54
|
type: :runtime
|
55
55
|
version_requirements: *id002
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: dm-transactions
|
58
|
-
prerelease: false
|
59
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
|
-
requirements:
|
62
|
-
- - ~>
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
hash: 977940575
|
65
|
-
segments:
|
66
|
-
- 1
|
67
|
-
- 0
|
68
|
-
- 0
|
69
|
-
- rc2
|
70
|
-
version: 1.0.0.rc2
|
71
|
-
type: :runtime
|
72
|
-
version_requirements: *id003
|
73
56
|
- !ruby/object:Gem::Dependency
|
74
57
|
name: rspec
|
75
58
|
prerelease: false
|
76
|
-
requirement: &
|
59
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
77
60
|
none: false
|
78
61
|
requirements:
|
79
62
|
- - ~>
|
@@ -84,7 +67,7 @@ dependencies:
|
|
84
67
|
- 3
|
85
68
|
version: "1.3"
|
86
69
|
type: :development
|
87
|
-
version_requirements: *
|
70
|
+
version_requirements: *id003
|
88
71
|
description: DataMapper plugin for creating and organizing lists
|
89
72
|
email: sindre [a] identu [d] no
|
90
73
|
executables: []
|
@@ -115,7 +98,7 @@ files:
|
|
115
98
|
- tasks/yard.rake
|
116
99
|
- tasks/yardstick.rake
|
117
100
|
has_rdoc: true
|
118
|
-
homepage: http://github.com/datamapper/dm-
|
101
|
+
homepage: http://github.com/datamapper/dm-is-list
|
119
102
|
licenses: []
|
120
103
|
|
121
104
|
post_install_message:
|