dm-is-read_only 0.1.0 → 0.1.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/ChangeLog.md +6 -0
- data/Gemfile.lock +54 -0
- data/VERSION +1 -1
- data/dm-is-read_only.gemspec +3 -2
- data/lib/dm-is-read_only/is/read_only.rb +24 -2
- data/spec/integration/read_only_spec.rb +24 -0
- metadata +5 -4
data/ChangeLog.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
### 0.1.1 / 2010-08-11
|
|
2
|
+
|
|
3
|
+
* Override `saved?` in `DataMapper::Resource` to always return `true`,
|
|
4
|
+
so that methods such as `save_self` will also return `true`. This allows
|
|
5
|
+
read-only models to be used in relationships with non-read-only models.
|
|
6
|
+
|
|
1
7
|
### 0.1.0 / 2010-06-08
|
|
2
8
|
|
|
3
9
|
* Initial release.
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: git://github.com/technicalpickles/jeweler.git
|
|
3
|
+
revision: b996854
|
|
4
|
+
specs:
|
|
5
|
+
jeweler (1.4.0)
|
|
6
|
+
bundler (>= 0.9.5)
|
|
7
|
+
gemcutter (>= 0.1.0)
|
|
8
|
+
git (>= 1.2.5)
|
|
9
|
+
rake
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: http://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
activesupport (3.0.0.rc)
|
|
15
|
+
addressable (2.2.0)
|
|
16
|
+
data_objects (0.10.2)
|
|
17
|
+
addressable (~> 2.1)
|
|
18
|
+
dm-core (1.0.0)
|
|
19
|
+
addressable (~> 2.1)
|
|
20
|
+
extlib (~> 0.9.15)
|
|
21
|
+
dm-do-adapter (1.0.0)
|
|
22
|
+
data_objects (~> 0.10.1)
|
|
23
|
+
dm-core (~> 1.0.0)
|
|
24
|
+
dm-migrations (1.0.0)
|
|
25
|
+
dm-core (~> 1.0.0)
|
|
26
|
+
dm-sqlite-adapter (1.0.0)
|
|
27
|
+
dm-do-adapter (~> 1.0.0)
|
|
28
|
+
do_sqlite3 (~> 0.10.2)
|
|
29
|
+
do_sqlite3 (0.10.2)
|
|
30
|
+
data_objects (= 0.10.2)
|
|
31
|
+
extlib (0.9.15)
|
|
32
|
+
gemcutter (0.6.1)
|
|
33
|
+
git (1.2.5)
|
|
34
|
+
rake (0.8.7)
|
|
35
|
+
rdiscount (1.6.5)
|
|
36
|
+
rspec (1.3.0)
|
|
37
|
+
yard (0.5.8)
|
|
38
|
+
|
|
39
|
+
PLATFORMS
|
|
40
|
+
ruby
|
|
41
|
+
|
|
42
|
+
DEPENDENCIES
|
|
43
|
+
activesupport (~> 3.0.0.beta3)
|
|
44
|
+
data_objects (~> 0.10.2)
|
|
45
|
+
dm-core (~> 1.0.0)
|
|
46
|
+
dm-do-adapter (~> 1.0.0)
|
|
47
|
+
dm-migrations (~> 1.0.0)
|
|
48
|
+
dm-sqlite-adapter (~> 1.0.0)
|
|
49
|
+
do_sqlite3 (~> 0.10.2)
|
|
50
|
+
jeweler (~> 1.4.0)!
|
|
51
|
+
rake (~> 0.8.7)
|
|
52
|
+
rdiscount (~> 1.6.3)
|
|
53
|
+
rspec (~> 1.3.0)
|
|
54
|
+
yard (~> 0.5.3)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.1
|
data/dm-is-read_only.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{dm-is-read_only}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Postmodern"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-08-11}
|
|
13
13
|
s.description = %q{A DataMapper plugin for making Models absolutely read-only.}
|
|
14
14
|
s.email = %q{postmodern.mod3@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
".yardopts",
|
|
24
24
|
"ChangeLog.md",
|
|
25
25
|
"Gemfile",
|
|
26
|
+
"Gemfile.lock",
|
|
26
27
|
"LICENSE.txt",
|
|
27
28
|
"README.md",
|
|
28
29
|
"Rakefile",
|
|
@@ -33,6 +33,16 @@ module DataMapper
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
module ClassMethods
|
|
36
|
+
#
|
|
37
|
+
# Disables migrations.
|
|
38
|
+
#
|
|
39
|
+
# @return [true]
|
|
40
|
+
# Always returns `true`.
|
|
41
|
+
#
|
|
42
|
+
def migrate!(repository_name=nil)
|
|
43
|
+
true
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
#
|
|
37
47
|
# Disables auto-migrations.
|
|
38
48
|
#
|
|
@@ -40,7 +50,7 @@ module DataMapper
|
|
|
40
50
|
# Always returns `true`.
|
|
41
51
|
#
|
|
42
52
|
def auto_migrate!(repository_name=nil)
|
|
43
|
-
|
|
53
|
+
true
|
|
44
54
|
end
|
|
45
55
|
|
|
46
56
|
#
|
|
@@ -50,7 +60,7 @@ module DataMapper
|
|
|
50
60
|
# Always returns `true`.
|
|
51
61
|
#
|
|
52
62
|
def auto_upgrade!(repository_name=nil)
|
|
53
|
-
|
|
63
|
+
true
|
|
54
64
|
end
|
|
55
65
|
end
|
|
56
66
|
|
|
@@ -78,6 +88,18 @@ module DataMapper
|
|
|
78
88
|
def persisted_state=(new_state)
|
|
79
89
|
persisted_state
|
|
80
90
|
end
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Determines whether the resource has been saved.
|
|
94
|
+
#
|
|
95
|
+
# @return [true]
|
|
96
|
+
# Always returns true.
|
|
97
|
+
#
|
|
98
|
+
# @since 0.1.1
|
|
99
|
+
#
|
|
100
|
+
def saved?
|
|
101
|
+
true
|
|
102
|
+
end
|
|
81
103
|
end
|
|
82
104
|
end
|
|
83
105
|
end
|
|
@@ -4,6 +4,26 @@ require 'classes/backend_model'
|
|
|
4
4
|
require 'classes/read_only_model'
|
|
5
5
|
|
|
6
6
|
describe DataMapper::Is::ReadOnly do
|
|
7
|
+
context "migrate!" do
|
|
8
|
+
before(:all) do
|
|
9
|
+
BackendModel.auto_migrate!
|
|
10
|
+
|
|
11
|
+
('a'..'z').each do |value|
|
|
12
|
+
BackendModel.create(:value => value)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ReadOnlyModel.migrate!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should not destroy the contents of the storage table" do
|
|
19
|
+
ReadOnlyModel.all.length.should == 26
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should still return true" do
|
|
23
|
+
(ReadOnlyModel.auto_migrate!).should == true
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
7
27
|
context "auto_migrate!" do
|
|
8
28
|
before(:all) do
|
|
9
29
|
BackendModel.auto_migrate!
|
|
@@ -79,5 +99,9 @@ describe DataMapper::Is::ReadOnly do
|
|
|
79
99
|
|
|
80
100
|
@resource.persisted_state.should == old_state
|
|
81
101
|
end
|
|
102
|
+
|
|
103
|
+
it "should report the resource as having already been saved" do
|
|
104
|
+
@resource.should be_saved
|
|
105
|
+
end
|
|
82
106
|
end
|
|
83
107
|
end
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
9
|
-
version: 0.1.
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.1.1
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Postmodern
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-
|
|
17
|
+
date: 2010-08-11 00:00:00 -07:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -109,6 +109,7 @@ files:
|
|
|
109
109
|
- .yardopts
|
|
110
110
|
- ChangeLog.md
|
|
111
111
|
- Gemfile
|
|
112
|
+
- Gemfile.lock
|
|
112
113
|
- LICENSE.txt
|
|
113
114
|
- README.md
|
|
114
115
|
- Rakefile
|
|
@@ -134,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
134
135
|
requirements:
|
|
135
136
|
- - ">="
|
|
136
137
|
- !ruby/object:Gem::Version
|
|
137
|
-
hash: -
|
|
138
|
+
hash: -555306040342459765
|
|
138
139
|
segments:
|
|
139
140
|
- 0
|
|
140
141
|
version: "0"
|