remodel-h 0.1.5 → 0.1.6
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/VERSION +1 -1
- data/lib/remodel-h.rb +12 -2
- data/remodel-h.gemspec +2 -2
- data/test/helper.rb +1 -1
- data/test/test_context.rb +31 -0
- metadata +2 -2
- data/remodel.gemspec +0 -72
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/remodel-h.rb
CHANGED
@@ -51,8 +51,18 @@ module Remodel
|
|
51
51
|
Thread.current[:remodel_context] || raise(MissingContext)
|
52
52
|
end
|
53
53
|
|
54
|
-
def self.context=(
|
55
|
-
Thread.current[:remodel_context] =
|
54
|
+
def self.context=(c)
|
55
|
+
Thread.current[:remodel_context] = c
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.in_context(c, &block)
|
59
|
+
old_c = self.context rescue nil
|
60
|
+
begin
|
61
|
+
self.context = c
|
62
|
+
yield
|
63
|
+
ensure
|
64
|
+
self.context = old_c
|
65
|
+
end
|
56
66
|
end
|
57
67
|
|
58
68
|
# Returns the mapper defined for a given class, or the identity mapper.
|
data/remodel-h.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{remodel-h}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Lossen"]
|
@@ -33,7 +33,6 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/remodel/has_many.rb",
|
34
34
|
"lib/remodel/mapper.rb",
|
35
35
|
"remodel-h.gemspec",
|
36
|
-
"remodel.gemspec",
|
37
36
|
"test/helper.rb",
|
38
37
|
"test/test_entity.rb",
|
39
38
|
"test/test_many_to_many.rb",
|
@@ -50,6 +49,7 @@ Gem::Specification.new do |s|
|
|
50
49
|
s.summary = %q{remodel variant which uses hashes}
|
51
50
|
s.test_files = [
|
52
51
|
"test/helper.rb",
|
52
|
+
"test/test_context.rb",
|
53
53
|
"test/test_entity.rb",
|
54
54
|
"test/test_many_to_many.rb",
|
55
55
|
"test/test_many_to_one.rb",
|
data/test/helper.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Foo < Remodel::Entity
|
4
|
+
property :x
|
5
|
+
property :y
|
6
|
+
end
|
7
|
+
|
8
|
+
class Bar < Remodel::Entity
|
9
|
+
property :d, :default => 123
|
10
|
+
end
|
11
|
+
|
12
|
+
class TestContext < Test::Unit::TestCase
|
13
|
+
|
14
|
+
context "in_context" do
|
15
|
+
should "execute a block in the given context" do
|
16
|
+
Remodel.in_context 'a' do
|
17
|
+
Foo.create
|
18
|
+
end
|
19
|
+
assert redis.hexists 'a', 'f:1'
|
20
|
+
end
|
21
|
+
|
22
|
+
should "not change the context permanently" do
|
23
|
+
Remodel.context = 'a'
|
24
|
+
Remodel.in_context 'b' do
|
25
|
+
2 + 2
|
26
|
+
end
|
27
|
+
assert_equal 'a', Remodel.context
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remodel-h
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Lossen
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- lib/remodel/has_many.rb
|
38
38
|
- lib/remodel/mapper.rb
|
39
39
|
- remodel-h.gemspec
|
40
|
-
- remodel.gemspec
|
41
40
|
- test/helper.rb
|
42
41
|
- test/test_entity.rb
|
43
42
|
- test/test_many_to_many.rb
|
@@ -76,6 +75,7 @@ specification_version: 3
|
|
76
75
|
summary: remodel variant which uses hashes
|
77
76
|
test_files:
|
78
77
|
- test/helper.rb
|
78
|
+
- test/test_context.rb
|
79
79
|
- test/test_entity.rb
|
80
80
|
- test/test_many_to_many.rb
|
81
81
|
- test/test_many_to_one.rb
|
data/remodel.gemspec
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{remodel}
|
8
|
-
s.version = "0.1.4"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tim Lossen"]
|
12
|
-
s.date = %q{2010-07-01}
|
13
|
-
s.default_executable = %q{redis-monitor.rb}
|
14
|
-
s.description = %q{build your domain model in ruby, persist your objects to redis.}
|
15
|
-
s.email = %q{tim@lossen.de}
|
16
|
-
s.executables = ["redis-monitor.rb"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.md"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".gitignore",
|
23
|
-
"LICENSE",
|
24
|
-
"README.md",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"bin/redis-monitor.rb",
|
28
|
-
"docs/docco.css",
|
29
|
-
"docs/remodel.html",
|
30
|
-
"example/book.rb",
|
31
|
-
"lib/remodel.rb",
|
32
|
-
"lib/remodel/entity.rb",
|
33
|
-
"lib/remodel/has_many.rb",
|
34
|
-
"lib/remodel/has_one.rb",
|
35
|
-
"lib/remodel/mapper.rb",
|
36
|
-
"remodel.gemspec",
|
37
|
-
"test/helper.rb",
|
38
|
-
"test/test_entity.rb",
|
39
|
-
"test/test_many_to_many.rb",
|
40
|
-
"test/test_many_to_one.rb",
|
41
|
-
"test/test_mappers.rb",
|
42
|
-
"test/test_monkeypatches.rb",
|
43
|
-
"test/test_one_to_many.rb",
|
44
|
-
"test/test_one_to_one.rb"
|
45
|
-
]
|
46
|
-
s.homepage = %q{http://github.com/tlossen/remodel}
|
47
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
48
|
-
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = %q{1.3.5}
|
50
|
-
s.summary = %q{a minimal ORM (object-redis-mapper)}
|
51
|
-
s.test_files = [
|
52
|
-
"test/helper.rb",
|
53
|
-
"test/test_entity.rb",
|
54
|
-
"test/test_many_to_many.rb",
|
55
|
-
"test/test_many_to_one.rb",
|
56
|
-
"test/test_mappers.rb",
|
57
|
-
"test/test_monkeypatches.rb",
|
58
|
-
"test/test_one_to_many.rb",
|
59
|
-
"test/test_one_to_one.rb"
|
60
|
-
]
|
61
|
-
|
62
|
-
if s.respond_to? :specification_version then
|
63
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
64
|
-
s.specification_version = 3
|
65
|
-
|
66
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
67
|
-
else
|
68
|
-
end
|
69
|
-
else
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|