active_orm 2.4.0 → 3.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/.coveralls.yml +1 -1
- data/.gitignore +1 -1
- data/.rspec +1 -1
- data/.travis.yml +1 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +2 -2
- data/README.md +7 -5
- data/Rakefile +1 -1
- data/active_orm.gemspec +14 -14
- data/bin/console +1 -1
- data/bin/rake +6 -6
- data/bin/setup +1 -1
- data/lib/active_orm.rb +19 -19
- data/lib/active_orm/base.rb +1 -1
- data/lib/active_orm/redis.rb +5 -5
- data/lib/active_orm/redis/base.rb +33 -25
- data/lib/active_orm/redis/configuration.rb +1 -1
- data/lib/active_orm/redis/connection.rb +1 -1
- data/lib/active_orm/redis/geo.rb +1 -1
- data/lib/active_orm/redis/hash.rb +1 -1
- data/lib/active_orm/redis/hyper_log_log.rb +1 -1
- data/lib/active_orm/redis/key.rb +3 -3
- data/lib/active_orm/redis/list.rb +1 -1
- data/lib/active_orm/redis/pub_sub.rb +1 -1
- data/lib/active_orm/redis/script.rb +1 -1
- data/lib/active_orm/redis/set.rb +1 -1
- data/lib/active_orm/redis/sorted_set.rb +2 -2
- data/lib/active_orm/redis/string.rb +1 -1
- data/lib/active_orm/redis/transaction.rb +1 -1
- data/lib/active_orm/version.rb +2 -2
- data/lib/generators/active_orm/install_generator.rb +4 -4
- data/lib/generators/active_orm/templates/install.rb +1 -1
- data/lib/tasks/redis.rake +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da03a7da4c7e4a6842338e0e31ea791a561f0b7e
|
4
|
+
data.tar.gz: ef6069ee665ae797c4dc77ae8b1886df4fd3ffb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8dd836ccfbfdcf2aeffd8016b721a3ad31e4d7471d1bafffede3d945012b258292c4f8754d6568fdd0bc7b0fdd1cab6efcb474a2084dd3212a04700191a8797
|
7
|
+
data.tar.gz: 8dda4a7f1b7d7160016874389b08709a9f6f3295df2d16dbc81aceefaf5f0263a7040e6decb3b53d0a2a9ee12b2a288a899473d91a569dfae7bfaac088ed6721
|
data/.coveralls.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
service_name: travis-ci
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
@@ -10,4 +10,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject
|
|
10
10
|
|
11
11
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
12
|
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/active_orm)
|
4
4
|
[](https://travis-ci.org/drexed/active_orm)
|
5
|
-
[](https://coveralls.io/github/drexed/active_orm?branch=master)
|
6
6
|
|
7
7
|
ActiveOrm is a library for object ruby mapping of different databases.
|
8
8
|
|
@@ -18,7 +18,7 @@ ActiveOrm is a library for object ruby mapping of different databases.
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem
|
21
|
+
gem "active_orm"
|
22
22
|
```
|
23
23
|
|
24
24
|
And then execute:
|
@@ -87,8 +87,10 @@ ActiveOrm::Redis::List.evaluate.find(:user_1) #=> { id: 32123, name: "James Dean
|
|
87
87
|
|
88
88
|
## Contributing
|
89
89
|
|
90
|
-
|
90
|
+
Your contribution is welcome.
|
91
|
+
|
92
|
+
1. Fork it
|
91
93
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
92
|
-
3. Commit your changes (`git commit -am '
|
94
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
93
95
|
4. Push to the branch (`git push origin my-new-feature`)
|
94
|
-
5. Create
|
96
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/active_orm.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "active_orm/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
7
|
+
spec.name = "active_orm"
|
8
|
+
spec.version = ActiveOrm::VERSION
|
9
|
+
spec.authors = ["Juan Gomez"]
|
10
|
+
spec.email = ["j.gomez@drexed.com"]
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
12
|
+
spec.summary = %q{Gem for commonly used database ORM.}
|
13
|
+
spec.description = %q{ORM for non-supported databases.}
|
14
|
+
spec.homepage = "http://drexed.github.io/active_orm"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "rails"
|
@@ -26,4 +26,4 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "rspec"
|
28
28
|
spec.add_development_dependency "generator_spec"
|
29
|
-
end
|
29
|
+
end
|
data/bin/console
CHANGED
data/bin/rake
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application
|
5
|
+
# The application "rake" is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
10
|
-
ENV[
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
11
|
Pathname.new(__FILE__).realpath)
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
15
|
|
16
|
-
load Gem.bin_path(
|
16
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
CHANGED
data/lib/active_orm.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require
|
1
|
+
require "rails/railtie"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "active_orm/version"
|
4
|
+
require "active_orm/base"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
6
|
+
require "active_orm/redis"
|
7
|
+
require "active_orm/redis/connection"
|
8
|
+
require "active_orm/redis/geo"
|
9
|
+
require "active_orm/redis/hash"
|
10
|
+
require "active_orm/redis/hyper_log_log"
|
11
|
+
require "active_orm/redis/key"
|
12
|
+
require "active_orm/redis/list"
|
13
|
+
require "active_orm/redis/pub_sub"
|
14
|
+
require "active_orm/redis/script"
|
15
|
+
require "active_orm/redis/set"
|
16
|
+
require "active_orm/redis/sorted_set"
|
17
|
+
require "active_orm/redis/string"
|
18
|
+
require "active_orm/redis/transaction"
|
19
19
|
|
20
|
-
require
|
20
|
+
require "generators/active_orm/install_generator"
|
21
21
|
|
22
22
|
module ActiveOrm
|
23
23
|
class Railtie < Rails::Railtie
|
24
24
|
|
25
25
|
rake_tasks do
|
26
|
-
Dir[File.expand_path(
|
26
|
+
Dir[File.expand_path("tasks/*.rake", File.dirname(__FILE__))].each { |ext| load(ext) }
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
30
|
-
end
|
30
|
+
end
|
data/lib/active_orm/base.rb
CHANGED
data/lib/active_orm/redis.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "fakeredis"
|
3
3
|
rescue LoadError
|
4
|
-
require
|
4
|
+
require "redis"
|
5
5
|
end
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require "active_orm/redis/base"
|
8
|
+
require "active_orm/redis/configuration"
|
9
9
|
class ActiveOrm::Redis < ActiveOrm::Base
|
10
10
|
|
11
11
|
extend Base
|
@@ -20,4 +20,4 @@ class ActiveOrm::Redis < ActiveOrm::Base
|
|
20
20
|
client.nil? ? new.client : new(client).client
|
21
21
|
end
|
22
22
|
|
23
|
-
end
|
23
|
+
end
|
@@ -7,55 +7,63 @@ module Base
|
|
7
7
|
self
|
8
8
|
end
|
9
9
|
|
10
|
+
private
|
11
|
+
|
10
12
|
def evaluate?
|
11
13
|
value = @@evaluate
|
12
14
|
@@evaluate = false
|
13
15
|
value
|
14
16
|
end
|
15
17
|
|
16
|
-
|
18
|
+
def append?(order)
|
19
|
+
"append" == order.to_s
|
20
|
+
end
|
17
21
|
|
18
22
|
def metaform(value)
|
19
|
-
value.nil? ? value :
|
23
|
+
value.nil? ? value : eval(value)
|
24
|
+
rescue Exception => e
|
25
|
+
value
|
20
26
|
end
|
21
27
|
|
22
|
-
def metamorph(
|
23
|
-
case
|
24
|
-
when
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
def metamorph(datum)
|
29
|
+
case datum.class.name
|
30
|
+
when "Array"
|
31
|
+
if datum.first.is_a?(Array)
|
32
|
+
datum.map { |array| array.map { |value| metaform(value) } }
|
33
|
+
elsif datum.first.is_a?(Hash)
|
34
|
+
datum.map { |hash| hash.each { |key, value| hash.store(key, metaform(value)) } }
|
35
|
+
else
|
36
|
+
datum.map { |value| metaform(value) }
|
37
|
+
end
|
38
|
+
when "Hash"
|
39
|
+
datum.each { |key, value| datum.store(key, metaform(value)) }
|
28
40
|
else
|
29
|
-
metaform(
|
41
|
+
metaform(datum)
|
30
42
|
end
|
31
43
|
end
|
32
44
|
|
33
|
-
def metatransform(
|
34
|
-
|
45
|
+
def metatransform(datum)
|
46
|
+
datum.empty? ? nil : (evaluate? ? metamorph(datum) : datum)
|
35
47
|
end
|
36
48
|
|
37
|
-
def
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
def stringify_keys(value)
|
42
|
-
value.map { |k, v| k.to_s }
|
49
|
+
def milliseconds?(format)
|
50
|
+
"milliseconds" == format.to_s
|
43
51
|
end
|
44
52
|
|
45
|
-
def
|
46
|
-
|
53
|
+
def normalize_key(key)
|
54
|
+
key.to_s
|
47
55
|
end
|
48
56
|
|
49
57
|
def prepend?(order)
|
50
|
-
|
58
|
+
"prepend" == order.to_s
|
51
59
|
end
|
52
60
|
|
53
|
-
def
|
54
|
-
|
61
|
+
def seconds?(format)
|
62
|
+
"seconds" == format.to_s
|
55
63
|
end
|
56
64
|
|
57
|
-
def
|
58
|
-
|
65
|
+
def stringify_keys(value)
|
66
|
+
value.map { |k, v| k.to_s }
|
59
67
|
end
|
60
68
|
|
61
|
-
end
|
69
|
+
end
|
data/lib/active_orm/redis/geo.rb
CHANGED
data/lib/active_orm/redis/key.rb
CHANGED
@@ -48,10 +48,10 @@ class ActiveOrm::Redis::Key < ActiveOrm::Redis
|
|
48
48
|
client.dump(normalize_key(key))
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.match(pattern='*'
|
51
|
+
def self.match(pattern='*')
|
52
52
|
value = client.keys(normalize_key(pattern))
|
53
53
|
value = nil if value.empty?
|
54
|
-
|
54
|
+
value
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.migrate(key, options)
|
@@ -78,4 +78,4 @@ class ActiveOrm::Redis::Key < ActiveOrm::Redis
|
|
78
78
|
client.scan(cursor, opts)
|
79
79
|
end
|
80
80
|
|
81
|
-
end
|
81
|
+
end
|
data/lib/active_orm/redis/set.rb
CHANGED
@@ -79,7 +79,7 @@ class ActiveOrm::Redis::SortedSet < ActiveOrm::Redis
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def self.all(key, opts={})
|
82
|
-
value = client.zrange(normalize_key(key), '-inf'
|
82
|
+
value = client.zrange(normalize_key(key), '-inf', '+inf', opts)
|
83
83
|
value = metatransform(value)
|
84
84
|
value
|
85
85
|
end
|
@@ -144,4 +144,4 @@ class ActiveOrm::Redis::SortedSet < ActiveOrm::Redis
|
|
144
144
|
client.zscan(normalize_key(key), cursor, opts)
|
145
145
|
end
|
146
146
|
|
147
|
-
end
|
147
|
+
end
|
data/lib/active_orm/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module ActiveOrm
|
2
|
-
VERSION = "
|
3
|
-
end
|
2
|
+
VERSION = "3.0.0"
|
3
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators"
|
2
2
|
|
3
3
|
module ActiveOrm
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
6
|
|
7
7
|
def copy_initializer_file
|
8
|
-
copy_file(
|
8
|
+
copy_file("install.rb", "config/initializers/active_orm.rb")
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
data/lib/tasks/redis.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_orm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -134,7 +134,7 @@ files:
|
|
134
134
|
- lib/generators/active_orm/install_generator.rb
|
135
135
|
- lib/generators/active_orm/templates/install.rb
|
136
136
|
- lib/tasks/redis.rake
|
137
|
-
homepage:
|
137
|
+
homepage: http://drexed.github.io/active_orm
|
138
138
|
licenses:
|
139
139
|
- MIT
|
140
140
|
metadata: {}
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.6.4
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Gem for commonly used database ORM.
|