rom-rails 1.2.0 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -7
- data/CHANGELOG.md +25 -2
- data/Gemfile +0 -1
- data/README.md +0 -2
- data/lib/generators/rom/install/templates/application_model.rb +1 -1
- data/lib/generators/rom/install/templates/initializer.rb.erb +1 -1
- data/lib/generators/rom/install/templates/types.rb +1 -1
- data/lib/generators/rom/repository/templates/repository.rb.erb +8 -0
- data/lib/rom/rails/active_record/configuration.rb +6 -2
- data/lib/rom/rails/railtie.rb +14 -4
- data/lib/rom/rails/tasks/db.rake +6 -0
- data/lib/rom/rails/version.rb +1 -1
- data/rom-rails.gemspec +3 -3
- data/spec/dummy/config/initializers/rom.rb +1 -1
- data/spec/lib/active_record/configuration_spec.rb +16 -0
- data/spec/lib/generators/install_generator_spec.rb +3 -3
- data/spec/lib/generators/repository_generator_spec.rb +16 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68fc37fe8b9ca646395ffd02e68f29b774d7330e9513bf1de8a27771d5393896
|
4
|
+
data.tar.gz: 90159fa988c5fbe590516e2d4112483ab35752264c771352bdfc0a63f14168d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb112f2f9c27a973262ed39133ae9befe1adbaf91aed42470d28a46776c73d02f17f22318863d9d2623e0f30caf65fafac40168ed050785a94261006a2c64fd4
|
7
|
+
data.tar.gz: e7e53cbb6139f0df6d748c3ead2c1e153ceba72f9dcb3bf69df11cb2d8b50b7cc7a99824d2d13ad75884270ae07711c7eb10e54ad1aedaeb63223ae55f0ed4fa
|
data/.travis.yml
CHANGED
@@ -4,17 +4,19 @@ cache: bundler
|
|
4
4
|
bundler_args: --without yard guard benchmarks
|
5
5
|
script: "RAILS_ENV=test bundle exec rake app:db:reset app:spec"
|
6
6
|
rvm:
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
-
|
7
|
+
- 2.4.6
|
8
|
+
- 2.5.5
|
9
|
+
- 2.6.3
|
10
|
+
- jruby-9.2.7.0
|
10
11
|
env:
|
11
|
-
- RAILS_VERSION=5.
|
12
|
-
- RAILS_VERSION=5.
|
13
|
-
- RAILS_VERSION=
|
12
|
+
- RAILS_VERSION=5.2
|
13
|
+
- RAILS_VERSION=5.1
|
14
|
+
- RAILS_VERSION=5.0
|
15
|
+
- RAILS_VERSION=4.2
|
14
16
|
notifications:
|
15
17
|
webhooks:
|
16
18
|
urls:
|
17
|
-
- https://
|
19
|
+
- https://rom-rb.zulipchat.com/api/v1/external/travis?api_key=S1S2GRkXHlzlaCGyUwm7o4lg50IZrwCH&stream=notifications&topic=ci
|
18
20
|
on_success: change
|
19
21
|
on_failure: always
|
20
22
|
on_start: false
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
|
+
## v2.0.0 2019-04-27
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* Updated to depend on rom-* 5.0
|
6
|
+
* Repository generator creates a `by_id` method (cflipse)
|
7
|
+
|
8
|
+
[Compare v1.3.0...v2.0.0](https://github.com/rom-rb/rom-rails/compare/v1.3.0...v2.0.0)
|
9
|
+
|
10
|
+
## v1.3.0 2018-11-26
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
* Rake task automatically attempts to include `rom-sql`'s tasks (cflipse)
|
15
|
+
* Escape special characters in username & password from parsed database.yml (Cervajz)
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
* do not double log when ActiveRecord is present (Cervajz)
|
20
|
+
* running the install generator no longer results in a broken app if `DATABASE_URL` is not set (cflipse)
|
21
|
+
|
22
|
+
[Compare v1.2.0...v1.3.0](https://github.com/rom-rb/rom-rails/compare/v1.2.0...v1.3.0)
|
23
|
+
|
1
24
|
## v1.2.0 2018-10-20
|
2
25
|
|
3
|
-
|
26
|
+
### Changed
|
4
27
|
|
5
28
|
* ROM output is broadcast to STDOUT during rails console (radar)
|
6
29
|
* Generators default to same adapter as the default gateway (cflipse)
|
@@ -11,7 +34,7 @@
|
|
11
34
|
|
12
35
|
## v1.1.1 2018-04-17
|
13
36
|
|
14
|
-
###
|
37
|
+
### Fixedd
|
15
38
|
|
16
39
|
* Fix Rails.logger lookup bug (cflipse)
|
17
40
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
[gem]: https://rubygems.org/gems/rom-rails
|
2
2
|
[travis]: https://travis-ci.org/rom-rb/rom-rails
|
3
|
-
[gemnasium]: https://gemnasium.com/rom-rb/rom-rails
|
4
3
|
[codeclimate]: https://codeclimate.com/github/rom-rb/rom-rails
|
5
4
|
[coveralls]: https://coveralls.io/r/rom-rb/rom-rails
|
6
5
|
[inchpages]: http://inch-ci.org/github/rom-rb/rom-rails
|
@@ -9,7 +8,6 @@
|
|
9
8
|
|
10
9
|
[][gem]
|
11
10
|
[][travis]
|
12
|
-
[][gemnasium]
|
13
11
|
[][codeclimate]
|
14
12
|
[][codeclimate]
|
15
13
|
[][inchpages]
|
@@ -86,8 +86,8 @@ module ROM
|
|
86
86
|
def self.generic_uri(config)
|
87
87
|
build_uri(
|
88
88
|
scheme: config.fetch(:scheme),
|
89
|
-
user: config[:username],
|
90
|
-
password: config[:password],
|
89
|
+
user: escape_option(config[:username]),
|
90
|
+
password: escape_option(config[:password]),
|
91
91
|
host: config[:host],
|
92
92
|
port: config[:port],
|
93
93
|
path: config[:database]
|
@@ -97,6 +97,10 @@ module ROM
|
|
97
97
|
def self.build_uri(attrs)
|
98
98
|
Addressable::URI.new(attrs).to_s
|
99
99
|
end
|
100
|
+
|
101
|
+
def self.escape_option(option)
|
102
|
+
option.nil? ? option : CGI.escape(option)
|
103
|
+
end
|
100
104
|
end
|
101
105
|
end
|
102
106
|
end
|
data/lib/rom/rails/railtie.rb
CHANGED
@@ -46,10 +46,7 @@ module ROM
|
|
46
46
|
end
|
47
47
|
|
48
48
|
console do |_app|
|
49
|
-
|
50
|
-
console = ActiveSupport::Logger.new(STDERR)
|
51
|
-
::Rails.logger.extend ActiveSupport::Logger.broadcast console
|
52
|
-
end
|
49
|
+
Railtie.configure_console_logger
|
53
50
|
end
|
54
51
|
|
55
52
|
# Behaves like `Railtie#configure` if the given block does not take any
|
@@ -137,6 +134,19 @@ module ROM
|
|
137
134
|
def active_record?
|
138
135
|
defined?(::ActiveRecord)
|
139
136
|
end
|
137
|
+
|
138
|
+
# @api private
|
139
|
+
def std_err_out_logger?
|
140
|
+
ActiveSupport::Logger.logger_outputs_to?(::Rails.logger, STDERR, STDOUT)
|
141
|
+
end
|
142
|
+
|
143
|
+
# @api private
|
144
|
+
def configure_console_logger
|
145
|
+
return if active_record? || std_err_out_logger?
|
146
|
+
|
147
|
+
console = ActiveSupport::Logger.new(STDERR)
|
148
|
+
::Rails.logger.extend ActiveSupport::Logger.broadcast console
|
149
|
+
end
|
140
150
|
end
|
141
151
|
end
|
142
152
|
end
|
data/lib/rom/rails/tasks/db.rake
CHANGED
data/lib/rom/rails/version.rb
CHANGED
data/rom-rails.gemspec
CHANGED
@@ -5,8 +5,8 @@ require 'rom/rails/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rom-rails"
|
7
7
|
spec.version = ROM::Rails::VERSION.dup
|
8
|
-
spec.authors = ["Piotr Solnica"]
|
9
|
-
spec.email = ["piotr.solnica@gmail.com"]
|
8
|
+
spec.authors = ["Chris Flipse", "Piotr Solnica"]
|
9
|
+
spec.email = ["cflipse@gmail.com", "piotr.solnica@gmail.com"]
|
10
10
|
spec.summary = 'Integrate Ruby Object Mapper with Rails'
|
11
11
|
spec.homepage = "http://rom-rb.org"
|
12
12
|
spec.license = "MIT"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency 'dry-core', '~> 0.3'
|
21
21
|
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
|
22
22
|
spec.add_runtime_dependency 'railties', '>= 3.0', '< 6.0'
|
23
|
-
spec.add_runtime_dependency 'rom', '~>
|
23
|
+
spec.add_runtime_dependency 'rom', '~> 5.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler"
|
26
26
|
spec.add_development_dependency "rake"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
ROM::Rails::Railtie.configure do |config|
|
2
2
|
scheme = RUBY_ENGINE == 'jruby' ? 'jdbc:sqlite' : 'sqlite'
|
3
|
-
config.gateways[:arro] = [:
|
3
|
+
config.gateways[:arro] = [:test_adapter, uri: 'http://example.org' ]
|
4
4
|
config.gateways[:sql] = [:sql, "#{scheme}://#{Rails.root}/db/#{Rails.env}.sqlite3"]
|
5
5
|
config.gateways[:default] = [:test_adapter, foo: :bar]
|
6
6
|
config.auto_registration_paths += [Rails.root.join('lib', 'additional_app', 'persistence')]
|
@@ -112,6 +112,22 @@ RSpec.describe ROM::Rails::ActiveRecord::Configuration do
|
|
112
112
|
|
113
113
|
expect(read(config)).to eq uri: expected_uri, options: { pool: 5 }
|
114
114
|
end
|
115
|
+
|
116
|
+
it 'handles special characters in username and password' do
|
117
|
+
config = {
|
118
|
+
pool: 5,
|
119
|
+
adapter: 'mysql2',
|
120
|
+
username: 'r@o%ot',
|
121
|
+
password: 'p@ssw0rd#',
|
122
|
+
database: 'database',
|
123
|
+
host: 'example.com'
|
124
|
+
}
|
125
|
+
|
126
|
+
expected_uri = 'mysql2://r%40o%25ot:p%40ssw0rd%23@example.com/database'
|
127
|
+
expected_uri = "jdbc:#{expected_uri}" if RUBY_ENGINE == 'jruby'
|
128
|
+
|
129
|
+
expect(read(config)).to eq uri: expected_uri, options: { pool: 5 }
|
130
|
+
end
|
115
131
|
end
|
116
132
|
end
|
117
133
|
end
|
@@ -16,7 +16,7 @@ RSpec.describe ROM::Generators::InstallGenerator, type: :generator do
|
|
16
16
|
file 'rom.rb' do
|
17
17
|
contains <<-CONTENT.strip_heredoc
|
18
18
|
ROM::Rails::Railtie.configure do |config|
|
19
|
-
config.gateways[:default] = [:sql, ENV.fetch('DATABASE_URL')]
|
19
|
+
# config.gateways[:default] = [:sql, ENV.fetch('DATABASE_URL')]
|
20
20
|
end
|
21
21
|
CONTENT
|
22
22
|
end
|
@@ -39,7 +39,7 @@ RSpec.describe ROM::Generators::InstallGenerator, type: :generator do
|
|
39
39
|
directory "lib" do
|
40
40
|
file "types.rb" do
|
41
41
|
contains <<-CONTENT.strip_heredoc
|
42
|
-
require
|
42
|
+
require "dry/types"
|
43
43
|
|
44
44
|
module Types
|
45
45
|
include Dry::Types.module
|
@@ -63,7 +63,7 @@ RSpec.describe ROM::Generators::InstallGenerator, type: :generator do
|
|
63
63
|
directory "models" do
|
64
64
|
file "application_model.rb" do
|
65
65
|
contains <<-CONTENT.strip_heredoc
|
66
|
-
require
|
66
|
+
require "types"
|
67
67
|
|
68
68
|
class ApplicationModel < ROM::Struct
|
69
69
|
def self.inherited(base)
|
@@ -22,6 +22,14 @@ RSpec.describe ROM::Generators::RepositoryGenerator, type: :generator do
|
|
22
22
|
commands :create, update: :by_pk, delete: :by_pk
|
23
23
|
|
24
24
|
struct_namespace Dummy
|
25
|
+
|
26
|
+
def by_id(id)
|
27
|
+
root.by_pk(id).one
|
28
|
+
end
|
29
|
+
|
30
|
+
def all
|
31
|
+
root.to_a
|
32
|
+
end
|
25
33
|
end
|
26
34
|
CONTENT
|
27
35
|
end
|
@@ -44,6 +52,14 @@ RSpec.describe ROM::Generators::RepositoryGenerator, type: :generator do
|
|
44
52
|
commands :create, update: :by_pk, delete: :by_pk
|
45
53
|
|
46
54
|
struct_namespace Dummy
|
55
|
+
|
56
|
+
def by_id(id)
|
57
|
+
root.by_pk(id).one
|
58
|
+
end
|
59
|
+
|
60
|
+
def all
|
61
|
+
root.to_a
|
62
|
+
end
|
47
63
|
end
|
48
64
|
CONTENT
|
49
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Chris Flipse
|
7
8
|
- Piotr Solnica
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: addressable
|
@@ -78,14 +79,14 @@ dependencies:
|
|
78
79
|
requirements:
|
79
80
|
- - "~>"
|
80
81
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
82
|
+
version: '5.0'
|
82
83
|
type: :runtime
|
83
84
|
prerelease: false
|
84
85
|
version_requirements: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
87
|
- - "~>"
|
87
88
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
89
|
+
version: '5.0'
|
89
90
|
- !ruby/object:Gem::Dependency
|
90
91
|
name: bundler
|
91
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,6 +145,7 @@ dependencies:
|
|
144
145
|
version: '0.50'
|
145
146
|
description:
|
146
147
|
email:
|
148
|
+
- cflipse@gmail.com
|
147
149
|
- piotr.solnica@gmail.com
|
148
150
|
executables: []
|
149
151
|
extensions: []
|