rom 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.gitmodules +9 -0
- data/Gemfile +5 -0
- data/LICENSE +1 -1
- data/README.md +66 -6
- data/lib/rom.rb +6 -0
- data/rom.gemspec +21 -0
- metadata +108 -30
- checksums.yaml +0 -7
data/.gitignore
ADDED
data/.gitmodules
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
[submodule "rom-relation"]
|
2
|
+
path = rom-relation
|
3
|
+
url = git@github.com:rom-rb/rom-relation.git
|
4
|
+
[submodule "rom-mapper"]
|
5
|
+
path = rom-mapper
|
6
|
+
url = git@github.com:rom-rb/rom-mapper.git
|
7
|
+
[submodule "rom-session"]
|
8
|
+
path = rom-session
|
9
|
+
url = git@github.com:rom-rb/rom-session.git
|
data/Gemfile
ADDED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,69 @@
|
|
1
|
-
|
2
|
-
===
|
1
|
+
# Ruby Object Mapper
|
3
2
|
|
4
|
-
|
3
|
+
This is a meta-project grouping pieces of ROM's default stack:
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
* [rom-relation](https://github.com/rom-rb/rom-relation)
|
6
|
+
* [rom-mapper](https://github.com/rom-rb/rom-mapper)
|
7
|
+
* [rom-session](https://github.com/rom-rb/rom-session)
|
8
8
|
|
9
|
-
|
9
|
+
## Getting started
|
10
|
+
|
11
|
+
### 1. Set up environment and define schema
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'rom'
|
15
|
+
|
16
|
+
env = ROM::Environment.coerce(memory: 'memory://test')
|
17
|
+
|
18
|
+
env.schema do
|
19
|
+
base_relation :users do
|
20
|
+
repository :memory
|
21
|
+
|
22
|
+
attribute :id, Serial
|
23
|
+
attribute :name, String
|
24
|
+
|
25
|
+
key :id
|
26
|
+
end
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
### 2. Set up mapping
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
class User
|
34
|
+
attr_reader :id, :name
|
35
|
+
|
36
|
+
def initialize(attributes)
|
37
|
+
@id, @name = attributes.values_at(:id, :name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
env.mapping do
|
42
|
+
users do
|
43
|
+
map :id, :name
|
44
|
+
model User
|
45
|
+
end
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
### 3. Work with Plain Old Ruby Objects
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
env.session do |session|
|
53
|
+
session[:users].save(User.new(id: 1, name: 'Jane'))
|
54
|
+
session.commit
|
55
|
+
end
|
56
|
+
|
57
|
+
jane = env[:users].restrict(name: 'Jane').one
|
58
|
+
```
|
59
|
+
|
60
|
+
## Authors
|
61
|
+
|
62
|
+
* [Dan Kubb](https://github.com/dkubb)
|
63
|
+
* [Markus Schirp](https://github.com/mbj)
|
64
|
+
* [Martin Gamsjaeger](https://github.com/snusnu)
|
65
|
+
* [Piotr Solnica](https://github.com/solnic)
|
66
|
+
|
67
|
+
## Licence
|
68
|
+
|
69
|
+
See `LICENSE` file.
|
data/lib/rom.rb
ADDED
data/rom.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../lib/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'rom'
|
7
|
+
gem.summary = 'Ruby Object Mapper'
|
8
|
+
gem.description = gem.summary
|
9
|
+
gem.authors = ['Piotr Solnica', 'Dan Kubb', 'Markus Schirp', 'Martin Gamsjaeger'].sort
|
10
|
+
gem.email = ['piotr.solnica@gmail.com', 'dan.kubb@gmail.com', 'mbj@schirp-dso.com', 'gamsnjaga@gmail.com'].sort
|
11
|
+
gem.homepage = 'http://rom-rb.org'
|
12
|
+
gem.require_paths = ['lib']
|
13
|
+
gem.version = ROM::VERSION
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
gem.license = 'MIT'
|
17
|
+
|
18
|
+
gem.add_dependency 'rom-relation', '~> 0.1.0'
|
19
|
+
gem.add_dependency 'rom-mapper', '~> 0.1.0'
|
20
|
+
gem.add_dependency 'rom-session', '~> 0.1.0'
|
21
|
+
end
|
metadata
CHANGED
@@ -1,47 +1,125 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- Dan Kubb
|
14
|
+
- Markus Schirp
|
15
|
+
- Martin Gamsjaeger
|
16
|
+
- Piotr Solnica
|
8
17
|
autorequire:
|
9
18
|
bindir: bin
|
10
19
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
20
|
+
|
21
|
+
date: 2013-08-23 00:00:00 Z
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: rom-relation
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 27
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 1
|
35
|
+
- 0
|
36
|
+
version: 0.1.0
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rom-mapper
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 27
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
- 1
|
51
|
+
- 0
|
52
|
+
version: 0.1.0
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rom-session
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 27
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
- 1
|
67
|
+
- 0
|
68
|
+
version: 0.1.0
|
69
|
+
type: :runtime
|
70
|
+
version_requirements: *id003
|
71
|
+
description: Ruby Object Mapper
|
72
|
+
email:
|
73
|
+
- dan.kubb@gmail.com
|
74
|
+
- gamsnjaga@gmail.com
|
75
|
+
- mbj@schirp-dso.com
|
76
|
+
- piotr.solnica@gmail.com
|
15
77
|
executables: []
|
78
|
+
|
16
79
|
extensions: []
|
17
|
-
|
80
|
+
|
81
|
+
extra_rdoc_files: []
|
82
|
+
|
83
|
+
files:
|
84
|
+
- .gitignore
|
85
|
+
- .gitmodules
|
86
|
+
- Gemfile
|
18
87
|
- LICENSE
|
19
88
|
- README.md
|
20
|
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
|
24
|
-
|
25
|
-
metadata: {}
|
89
|
+
- lib/rom.rb
|
90
|
+
- rom.gemspec
|
91
|
+
homepage: http://rom-rb.org
|
92
|
+
licenses:
|
93
|
+
- MIT
|
26
94
|
post_install_message:
|
27
95
|
rdoc_options: []
|
28
|
-
|
96
|
+
|
97
|
+
require_paths:
|
29
98
|
- lib
|
30
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
40
117
|
requirements: []
|
118
|
+
|
41
119
|
rubyforge_project:
|
42
|
-
rubygems_version:
|
120
|
+
rubygems_version: 1.8.15
|
43
121
|
signing_key:
|
44
|
-
specification_version:
|
45
|
-
summary: Ruby Object
|
122
|
+
specification_version: 3
|
123
|
+
summary: Ruby Object Mapper
|
46
124
|
test_files: []
|
47
|
-
|
125
|
+
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 8c063456f52dae7ca853f96c66fe95ba2d98071a
|
4
|
-
data.tar.gz: f60cdf5815a6eb131c04a97db10bbc746d30d97f
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: ded74cd17c38faffb6a65c3c5ed2f3da9dd708e970a5e3cfd941f7e896ea7762b5f96084a353da100ce681b032d2ef8a3c389734846e01b0511a64cad74cc0f8
|
7
|
-
data.tar.gz: 597f44a2cce35ae01388ce8a1dd17004f227c29d48b6361ee96e7f3aef99b7b3ea90c319202632cd78f5a066c503e4bcb0b3db8473204bc4b30376b265ff69aa
|