otr-activerecord 2.3.0 → 2.5.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/LICENSE +1 -1
- data/README.md +3 -1
- data/lib/otr-activerecord/activerecord.rb +1 -6
- data/lib/otr-activerecord/shim/base.rb +32 -0
- data/lib/otr-activerecord/shim/v6.rb +3 -22
- data/lib/otr-activerecord/shim/v7.rb +3 -25
- data/lib/otr-activerecord/shim/v8.rb +9 -0
- data/lib/otr-activerecord/version.rb +1 -1
- data/lib/otr-activerecord.rb +0 -1
- metadata +6 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f553708de15ec631fbcc5d0005db418324b4d95eeeddec85c3daff4bdd6e3bb
|
4
|
+
data.tar.gz: f9e0b8443ba85b5d493a51b7628c25416c37eb834651c8103d034938f624ac07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2097923cb788f26cabe4c9c2fe042cc18ac53e93b28814e07b1782c4c602ff64914f6318f136c110732008c93b4a4f854a42cdf557052149f29e01ec28894e3
|
7
|
+
data.tar.gz: 6594ed5ef934ab286edc2b562baddae3a09d977600f87d8e10a3979b3b49f0200025ea2eda3bc99ef7f88de0df1c03f8610f0b74aefd0d3f9f210e6dc7d83fd5
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
An easy way to use ActiveRecord "off the rails." Works with Grape, Sinatra, plain old Rack, or even in a boring little script! The defaults are all very Railsy (`config/database.yml`, `db/seeds.rb`, `db/migrate`, etc.), but you can easily change them. (Formerly known as `grape-activerecord`.) Supports:
|
4
4
|
|
5
|
+
* ActiveRecord 8.0
|
6
|
+
* ActiveRecord 7.2
|
5
7
|
* ActiveRecord 7.1
|
6
|
-
* ActiveRecord 7.0
|
8
|
+
* ActiveRecord 7.0
|
7
9
|
* ActiveRecord 6.1
|
8
10
|
* See older versions of this library for older versions of ActiveRecord
|
9
11
|
|
@@ -8,12 +8,7 @@ module OTR
|
|
8
8
|
module ActiveRecord
|
9
9
|
autoload :ConnectionManagement, 'otr-activerecord/middleware/connection_management'
|
10
10
|
autoload :QueryCache, 'otr-activerecord/middleware/query_cache'
|
11
|
-
autoload :Shim,
|
12
|
-
case ::ActiveRecord::VERSION::MAJOR
|
13
|
-
when 6 then 'otr-activerecord/shim/v6'
|
14
|
-
when 7 then 'otr-activerecord/shim/v7'
|
15
|
-
else raise "Unsupported ActiveRecord version"
|
16
|
-
end
|
11
|
+
autoload :Shim, "otr-activerecord/shim/v#{::ActiveRecord::VERSION::MAJOR}"
|
17
12
|
|
18
13
|
class << self
|
19
14
|
# Relative path to the "db" dir
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module OTR
|
2
|
+
module ActiveRecord
|
3
|
+
# Base compatibility layer for ActiveRecord
|
4
|
+
class ShimBase
|
5
|
+
def initialize
|
6
|
+
::ActiveRecord.default_timezone = :utc
|
7
|
+
end
|
8
|
+
|
9
|
+
# All db migration dir paths
|
10
|
+
def migrations_paths
|
11
|
+
OTR::ActiveRecord.migrations_paths
|
12
|
+
end
|
13
|
+
|
14
|
+
# The dir in which to put new migrations
|
15
|
+
def migrations_path
|
16
|
+
OTR::ActiveRecord.migrations_paths[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
# Basename of migration classes
|
20
|
+
def migration_base_class_name
|
21
|
+
major_v = ::ActiveRecord::VERSION::MAJOR
|
22
|
+
minor_v = ::ActiveRecord::VERSION::MINOR
|
23
|
+
"ActiveRecord::Migration[#{major_v}.#{minor_v}]"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Force RACK_ENV/RAILS_ENV to be 'test' when running any db:test:* tasks
|
27
|
+
def force_db_test_env?
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,31 +1,12 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
1
3
|
module OTR
|
2
4
|
module ActiveRecord
|
3
5
|
# Compatibility layer for ActiveRecord 6
|
4
|
-
class Shim
|
6
|
+
class Shim < ShimBase
|
5
7
|
def initialize
|
6
8
|
::ActiveRecord::Base.default_timezone = :utc
|
7
9
|
end
|
8
|
-
|
9
|
-
# All db migration dir paths
|
10
|
-
def migrations_paths
|
11
|
-
OTR::ActiveRecord.migrations_paths
|
12
|
-
end
|
13
|
-
|
14
|
-
# The dir in which to put new migrations
|
15
|
-
def migrations_path
|
16
|
-
OTR::ActiveRecord.migrations_paths[0]
|
17
|
-
end
|
18
|
-
|
19
|
-
# Basename of migration classes
|
20
|
-
def migration_base_class_name
|
21
|
-
version = "6.#{::ActiveRecord::VERSION::MINOR}"
|
22
|
-
"ActiveRecord::Migration[#{version}]"
|
23
|
-
end
|
24
|
-
|
25
|
-
# Force RACK_ENV/RAILS_ENV to be 'test' when running any db:test:* tasks
|
26
|
-
def force_db_test_env?
|
27
|
-
false
|
28
|
-
end
|
29
10
|
end
|
30
11
|
end
|
31
12
|
end
|
@@ -1,31 +1,9 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
1
3
|
module OTR
|
2
4
|
module ActiveRecord
|
3
5
|
# Compatibility layer for ActiveRecord 7
|
4
|
-
class Shim
|
5
|
-
def initialize
|
6
|
-
::ActiveRecord.default_timezone = :utc
|
7
|
-
end
|
8
|
-
|
9
|
-
# All db migration dir paths
|
10
|
-
def migrations_paths
|
11
|
-
OTR::ActiveRecord.migrations_paths
|
12
|
-
end
|
13
|
-
|
14
|
-
# The dir in which to put new migrations
|
15
|
-
def migrations_path
|
16
|
-
OTR::ActiveRecord.migrations_paths[0]
|
17
|
-
end
|
18
|
-
|
19
|
-
# Basename of migration classes
|
20
|
-
def migration_base_class_name
|
21
|
-
version = "7.#{::ActiveRecord::VERSION::MINOR}"
|
22
|
-
"ActiveRecord::Migration[#{version}]"
|
23
|
-
end
|
24
|
-
|
25
|
-
# Force RACK_ENV/RAILS_ENV to be 'test' when running any db:test:* tasks
|
26
|
-
def force_db_test_env?
|
27
|
-
false
|
28
|
-
end
|
6
|
+
class Shim < ShimBase
|
29
7
|
end
|
30
8
|
end
|
31
9
|
end
|
data/lib/otr-activerecord.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otr-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '6.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,21 +29,7 @@ dependencies:
|
|
29
29
|
version: '6.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: hashie-forbidden_attributes
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0.1'
|
40
|
-
type: :runtime
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.1'
|
32
|
+
version: '8.1'
|
47
33
|
description: 'Off The Rails ActiveRecord: Use ActiveRecord with Grape, Sinatra, Rack,
|
48
34
|
or anything else! Formerly known as ''grape-activerecord''.'
|
49
35
|
email: jordan.hollinger@gmail.com
|
@@ -57,8 +43,10 @@ files:
|
|
57
43
|
- lib/otr-activerecord/activerecord.rb
|
58
44
|
- lib/otr-activerecord/middleware/connection_management.rb
|
59
45
|
- lib/otr-activerecord/middleware/query_cache.rb
|
46
|
+
- lib/otr-activerecord/shim/base.rb
|
60
47
|
- lib/otr-activerecord/shim/v6.rb
|
61
48
|
- lib/otr-activerecord/shim/v7.rb
|
49
|
+
- lib/otr-activerecord/shim/v8.rb
|
62
50
|
- lib/otr-activerecord/version.rb
|
63
51
|
- lib/tasks/otr-activerecord.rake
|
64
52
|
homepage: https://github.com/jhollinger/otr-activerecord
|