rom-roda 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +20 -0
- data/Gemfile +2 -4
- data/README.md +9 -5
- data/lib/rom-roda.rb +1 -1
- data/lib/rom/roda/plugin.rb +4 -2
- data/lib/rom/roda/version.rb +1 -1
- data/rom-roda.gemspec +1 -1
- data/spec/integration/load_path_spec.rb +11 -0
- data/spec/integration/plugin_setup_spec.rb +59 -0
- data/spec/spec_helper.rb +12 -0
- metadata +15 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2128db69a23bdec4354929eb16503e7225070236
|
4
|
+
data.tar.gz: 63042a8f762c8120bb1f298dcbb56c2e054e0a47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29f5291600465d9262a948cacf5b803098bdd9e0322ec9f1423e24947ef39d1a149aa6d2131940cce7f4f417f3b600dfd2963d9b78dc9a9f8ee9b68903346657
|
7
|
+
data.tar.gz: be4f75dc86917ebd56a08031390e484bfce2e60d9556b1263ecb5ba49b33dfa02de16fecca21cdbdfd37aa9d52de7d48a7f92aff5312512924a70e50f752571e
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
4
|
+
bundler_args: --without sql benchmarks console tools
|
5
|
+
script: "bundle exec rspec"
|
6
|
+
rvm:
|
7
|
+
- 2.0
|
8
|
+
- 2.1
|
9
|
+
- 2.2
|
10
|
+
- rbx-2
|
11
|
+
- jruby
|
12
|
+
- ruby-head
|
13
|
+
- jruby-head
|
14
|
+
env:
|
15
|
+
global:
|
16
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
17
|
+
matrix:
|
18
|
+
allow_failures:
|
19
|
+
- rvm: ruby-head
|
20
|
+
- rvm: jruby-head
|
data/Gemfile
CHANGED
@@ -8,15 +8,13 @@ gem 'roda'
|
|
8
8
|
|
9
9
|
platforms :jruby do
|
10
10
|
gem 'jdbc-sqlite3'
|
11
|
-
gem 'activerecord-jdbc-adapter'
|
12
11
|
end
|
13
12
|
|
14
13
|
group :test do
|
14
|
+
gem 'thread_safe'
|
15
15
|
gem 'rom', github: 'rom-rb/rom', branch: 'master'
|
16
16
|
gem 'rom-sql', github: 'rom-rb/rom-sql', branch: 'master'
|
17
17
|
gem 'rspec', '~> 3.2'
|
18
|
+
gem 'rack-test'
|
18
19
|
gem 'codeclimate-test-reporter', require: nil
|
19
|
-
gem 'database_cleaner'
|
20
|
-
gem 'capybara'
|
21
|
-
gem 'byebug', platform: :mri
|
22
20
|
end
|
data/README.md
CHANGED
@@ -75,7 +75,7 @@ end
|
|
75
75
|
|
76
76
|
With the ROM environment configured, the following instance methods are available in Roda routes:
|
77
77
|
|
78
|
-
|
78
|
+
#### rom
|
79
79
|
|
80
80
|
Provides an instance of the ROM environment:
|
81
81
|
|
@@ -85,19 +85,23 @@ route do |r|
|
|
85
85
|
end
|
86
86
|
```
|
87
87
|
|
88
|
-
|
88
|
+
#### relation(name)
|
89
89
|
|
90
90
|
Provides an instance of the named relation:
|
91
91
|
|
92
92
|
```ruby
|
93
93
|
route do |r|
|
94
|
-
r.
|
95
|
-
relation(:products).
|
94
|
+
r.on('catalog') do
|
95
|
+
@products = relation(:products).in_stock
|
96
|
+
|
97
|
+
r.is('category/:category') do |category|
|
98
|
+
@products.by_category(category)
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
98
102
|
```
|
99
103
|
|
100
|
-
|
104
|
+
#### command(name)
|
101
105
|
|
102
106
|
Provides an instance of the named command:
|
103
107
|
|
data/lib/rom-roda.rb
CHANGED
data/lib/rom/roda/plugin.rb
CHANGED
@@ -2,8 +2,10 @@ module ROM
|
|
2
2
|
module Roda
|
3
3
|
module Plugin
|
4
4
|
def self.configure(app, *args)
|
5
|
+
args = args.dup
|
6
|
+
|
5
7
|
if args.last.is_a?(Hash) && args.last.key?(:load_path)
|
6
|
-
load_path = File.expand_path(args.
|
8
|
+
load_path = File.expand_path(args.pop.delete(:load_path), app.opts[:root])
|
7
9
|
end
|
8
10
|
|
9
11
|
ROM.setup(*args)
|
@@ -40,4 +42,4 @@ module ROM
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
|
-
end
|
45
|
+
end
|
data/lib/rom/roda/version.rb
CHANGED
data/rom-roda.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_runtime_dependency 'rom', '~> 0.
|
20
|
+
spec.add_runtime_dependency 'rom', '~> 0.7', '>= 0.7.0'
|
21
21
|
spec.add_runtime_dependency 'inflecto'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ROM::Roda::Plugin do
|
4
|
+
it 'uses load_path relative to application by default' do
|
5
|
+
subject.should_receive(:load_files).with(File.expand_path('models'))
|
6
|
+
|
7
|
+
class RelativeLoadPathExample < Roda
|
8
|
+
plugin :rom, :memory, load_path: 'models'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ROM::Roda::Plugin do
|
4
|
+
SQL_DSN = RUBY_ENGINE == 'jruby' ? 'jdbc:sqlite:memory' : 'sqlite:memory'
|
5
|
+
|
6
|
+
context 'single adapter' do
|
7
|
+
let(:default_gateway) do
|
8
|
+
class MemoryAdapterExample < Roda
|
9
|
+
plugin :rom, :memory
|
10
|
+
end
|
11
|
+
|
12
|
+
MemoryAdapterExample.freeze
|
13
|
+
|
14
|
+
ROM.env.gateways[:default]
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'configures gateway with empty args' do
|
18
|
+
expect(default_gateway).to be_a(ROM::Memory::Gateway)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'single adapter with settings' do
|
23
|
+
let(:default_gateway) do
|
24
|
+
class SqliteAdapterExample < Roda
|
25
|
+
plugin :rom, :sql, SQL_DSN
|
26
|
+
end
|
27
|
+
|
28
|
+
SqliteAdapterExample.freeze
|
29
|
+
|
30
|
+
ROM.env.gateways[:default]
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'configures gateway with a connection string' do
|
34
|
+
expect(default_gateway).to be_a(ROM::SQL::Gateway)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'multiple adapters' do
|
39
|
+
let(:gateways) do
|
40
|
+
class MultipleAdaptersExample < Roda
|
41
|
+
plugin :rom, {
|
42
|
+
default: [:sql, SQL_DSN],
|
43
|
+
warehouse: [:sql, SQL_DSN],
|
44
|
+
transient: :memory
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
MultipleAdaptersExample.freeze
|
49
|
+
|
50
|
+
ROM.env.gateways
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'configures gateways with given settings' do
|
54
|
+
expect(gateways[:default]).to be_a(ROM::SQL::Gateway)
|
55
|
+
expect(gateways[:warehouse]).to be_a(ROM::SQL::Gateway)
|
56
|
+
expect(gateways[:transient]).to be_a(ROM::Memory::Gateway)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-roda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickerby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rom
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.7'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.7.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: '0.7'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.7.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: inflecto
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,7 @@ extra_rdoc_files: []
|
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
97
|
- ".rspec"
|
98
|
+
- ".travis.yml"
|
98
99
|
- CHANGELOG.md
|
99
100
|
- Gemfile
|
100
101
|
- LICENSE
|
@@ -103,6 +104,9 @@ files:
|
|
103
104
|
- lib/rom/roda/plugin.rb
|
104
105
|
- lib/rom/roda/version.rb
|
105
106
|
- rom-roda.gemspec
|
107
|
+
- spec/integration/load_path_spec.rb
|
108
|
+
- spec/integration/plugin_setup_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
106
110
|
homepage: http://rom-rb.org
|
107
111
|
licenses:
|
108
112
|
- MIT
|
@@ -123,9 +127,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
127
|
version: '0'
|
124
128
|
requirements: []
|
125
129
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.2.2
|
127
131
|
signing_key:
|
128
132
|
specification_version: 4
|
129
133
|
summary: Integrate Ruby Object Mapper with Roda
|
130
|
-
test_files:
|
134
|
+
test_files:
|
135
|
+
- spec/integration/load_path_spec.rb
|
136
|
+
- spec/integration/plugin_setup_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
131
138
|
has_rdoc:
|