active_orm 2.4.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ded593384a6c91abb5c83b0e5176c372785b3069
4
- data.tar.gz: 10ff300037fbca447decc4db69c8c51270c193c1
3
+ metadata.gz: da03a7da4c7e4a6842338e0e31ea791a561f0b7e
4
+ data.tar.gz: ef6069ee665ae797c4dc77ae8b1886df4fd3ffb1
5
5
  SHA512:
6
- metadata.gz: e5ce61a5e7d5f2d8427627983dd1d6b3f9bd2697f4defa4a7ce4f806aaeb476a1932a7ec9a720da27fa5b3c3b4d0d783524e8367e3d0df25e76c973640ac6431
7
- data.tar.gz: f8d832763c3737f65059fd012fef4ffd9c07628150a99dae5fce8a55ac00bebeee86212cad0a4bd493ece5b9eca9f4f41ad7f9324295b846a32364d12a4624eb
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
@@ -6,4 +6,4 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
- /tmp/
9
+ /tmp/
data/.rspec CHANGED
@@ -1,4 +1,4 @@
1
1
  --backtrace
2
2
  --color
3
3
  --format progress
4
- --order random
4
+ --order random
data/.travis.yml CHANGED
@@ -10,4 +10,4 @@ notifications:
10
10
  on_success: never
11
11
  rvm:
12
12
  - ruby-head
13
- script: 'bundle exec rake'
13
+ script: 'bundle exec rake'
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
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in active_orm.gemspec
4
- gemspec
4
+ gemspec
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/active_orm.svg)](http://badge.fury.io/rb/active_orm)
4
4
  [![Build Status](https://travis-ci.org/drexed/active_orm.svg?branch=master)](https://travis-ci.org/drexed/active_orm)
5
- [![Coverage Status](https://coveralls.io/repos/drexed/active_orm/badge.png)](https://coveralls.io/r/drexed/active_orm)
5
+ [![Coverage Status](https://coveralls.io/repos/github/drexed/active_orm/badge.svg?branch=master)](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 'active_orm'
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
- 1. Fork it ( https://github.com/[my-github-username]/active_orm/fork )
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 'Add some feature'`)
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 a new Pull Request
96
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -2,4 +2,4 @@ require "bundler/gem_tasks"
2
2
 
3
3
  task default: :spec
4
4
 
5
- import "lib/tasks/redis.rake"
5
+ import "lib/tasks/redis.rake"
data/active_orm.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'active_orm/version'
4
+ require "active_orm/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "active_orm"
8
- spec.version = ActiveOrm::VERSION
9
- spec.authors = ["Juan Gomez"]
10
- spec.email = ["j.gomez@drexed.com"]
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 = %q{Gem for commonly used database ORM.}
13
- spec.description = %q{ORM for non-supported databases.}
14
- spec.homepage = "https://github.com/drexed/active_orm"
15
- spec.license = "MIT"
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 = `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) }
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
@@ -11,4 +11,4 @@ require "active_orm"
11
11
  # Pry.start
12
12
 
13
13
  require "irb"
14
- IRB.start
14
+ IRB.start
data/bin/rake CHANGED
@@ -2,15 +2,15 @@
2
2
  #
3
3
  # This file was generated by Bundler.
4
4
  #
5
- # The application 'rake' is installed as part of a gem, and
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 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('rake', 'rake')
16
+ load Gem.bin_path("rake", "rake")
data/bin/setup CHANGED
@@ -4,4 +4,4 @@ IFS=$'\n\t'
4
4
 
5
5
  bundle install
6
6
 
7
- # Do any other automated setup that you need to do here
7
+ # Do any other automated setup that you need to do here
data/lib/active_orm.rb CHANGED
@@ -1,30 +1,30 @@
1
- require 'rails/railtie'
1
+ require "rails/railtie"
2
2
 
3
- require 'active_orm/version'
4
- require 'active_orm/base'
3
+ require "active_orm/version"
4
+ require "active_orm/base"
5
5
 
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'
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 'generators/active_orm/install_generator'
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('tasks/*.rake'.freeze, File.dirname(__FILE__))].each { |ext| load(ext) }
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
@@ -14,4 +14,4 @@ class ActiveOrm::Base
14
14
  yield(configuration)
15
15
  end
16
16
 
17
- end
17
+ end
@@ -1,11 +1,11 @@
1
1
  begin
2
- require 'fakeredis'
2
+ require "fakeredis"
3
3
  rescue LoadError
4
- require 'redis'
4
+ require "redis"
5
5
  end
6
6
 
7
- require 'active_orm/redis/base'
8
- require 'active_orm/redis/configuration'
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
- private
18
+ def append?(order)
19
+ "append" == order.to_s
20
+ end
17
21
 
18
22
  def metaform(value)
19
- value.nil? ? value : (eval(value) rescue value)
23
+ value.nil? ? value : eval(value)
24
+ rescue Exception => e
25
+ value
20
26
  end
21
27
 
22
- def metamorph(args)
23
- case args.class.name
24
- when 'Array'.freeze
25
- args.first.is_a?(Array) ? args.map { |h| h.map { |v| metaform(v) } } : args.map { |v| metaform(v) }
26
- when 'Hash'.freeze
27
- args.each { |k, v| args[k] = metaform(v) }
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(args)
41
+ metaform(datum)
30
42
  end
31
43
  end
32
44
 
33
- def metatransform(value)
34
- value.empty? ? nil : (evaluate? ? metamorph(value) : value)
45
+ def metatransform(datum)
46
+ datum.empty? ? nil : (evaluate? ? metamorph(datum) : datum)
35
47
  end
36
48
 
37
- def normalize_key(key)
38
- key.to_s
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 append?(order)
46
- 'append'.freeze == order.to_s
53
+ def normalize_key(key)
54
+ key.to_s
47
55
  end
48
56
 
49
57
  def prepend?(order)
50
- 'prepend'.freeze == order.to_s
58
+ "prepend" == order.to_s
51
59
  end
52
60
 
53
- def milliseconds?(format)
54
- 'milliseconds'.freeze == format.to_s
61
+ def seconds?(format)
62
+ "seconds" == format.to_s
55
63
  end
56
64
 
57
- def seconds?(format)
58
- 'seconds'.freeze == format.to_s
65
+ def stringify_keys(value)
66
+ value.map { |k, v| k.to_s }
59
67
  end
60
68
 
61
- end
69
+ end
@@ -6,4 +6,4 @@ class Configuration
6
6
  @client ||= Redis.new
7
7
  end
8
8
 
9
- end
9
+ end
@@ -100,4 +100,4 @@ class ActiveOrm::Redis::Connection < ActiveOrm::Redis
100
100
  client.with_reconnect(false, &block)
101
101
  end
102
102
 
103
- end
103
+ end
@@ -24,4 +24,4 @@ class ActiveOrm::Redis::Geo < ActiveOrm::Redis
24
24
  # TODO
25
25
  end
26
26
 
27
- end
27
+ end
@@ -66,4 +66,4 @@ class ActiveOrm::Redis::Hash < ActiveOrm::Redis
66
66
  client.hdel(normalize_key(key), cursor, opts)
67
67
  end
68
68
 
69
- end
69
+ end
@@ -12,4 +12,4 @@ class ActiveOrm::Redis::HyperLogLog < ActiveOrm::Redis
12
12
  client.pfmerge(normalize_key(key), keys)
13
13
  end
14
14
 
15
- end
15
+ end
@@ -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='*'.freeze)
51
+ def self.match(pattern='*')
52
52
  value = client.keys(normalize_key(pattern))
53
53
  value = nil if value.empty?
54
- return(value)
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
@@ -110,4 +110,4 @@ class ActiveOrm::Redis::List < ActiveOrm::Redis
110
110
  value
111
111
  end
112
112
 
113
- end
113
+ end
@@ -28,4 +28,4 @@ class ActiveOrm::Redis::PubSub < ActiveOrm::Redis
28
28
  client.pubsub(command, args)
29
29
  end
30
30
 
31
- end
31
+ end
@@ -12,4 +12,4 @@ class ActiveOrm::Redis::Script < ActiveOrm::Redis
12
12
  client.eval(:evalsha, args)
13
13
  end
14
14
 
15
- end
15
+ end
@@ -70,4 +70,4 @@ class ActiveOrm::Redis::Set < ActiveOrm::Redis
70
70
  client.sscan(normalize_key(key), cursor, opts)
71
71
  end
72
72
 
73
- end
73
+ end
@@ -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'.freeze, '+inf'.freeze, opts)
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
@@ -79,4 +79,4 @@ class ActiveOrm::Redis::String < ActiveOrm::Redis
79
79
  client.setbit(normalize_key(key), offset, bit)
80
80
  end
81
81
 
82
- end
82
+ end
@@ -20,4 +20,4 @@ class ActiveOrm::Redis::Transaction < ActiveOrm::Redis
20
20
  client.unwatch
21
21
  end
22
22
 
23
- end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveOrm
2
- VERSION = "2.4.0"
3
- end
2
+ VERSION = "3.0.0"
3
+ end
@@ -1,12 +1,12 @@
1
- require 'rails/generators'
1
+ require "rails/generators"
2
2
 
3
3
  module ActiveOrm
4
4
  class InstallGenerator < Rails::Generators::Base
5
- source_root File.expand_path('../templates', __FILE__)
5
+ source_root File.expand_path("../templates", __FILE__)
6
6
 
7
7
  def copy_initializer_file
8
- copy_file('install.rb'.freeze, 'config/initializers/active_orm.rb'.freeze)
8
+ copy_file("install.rb", "config/initializers/active_orm.rb")
9
9
  end
10
10
 
11
11
  end
12
- end
12
+ end
@@ -2,4 +2,4 @@ if defined?(Redis)
2
2
  ActiveOrm::Redis.configure do |config|
3
3
  config.client = Redis.new
4
4
  end
5
- end
5
+ end
data/lib/tasks/redis.rake CHANGED
@@ -28,4 +28,4 @@ namespace :db do
28
28
  end
29
29
 
30
30
  end
31
- end
31
+ end
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: 2.4.0
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-01-07 00:00:00.000000000 Z
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: https://github.com/drexed/active_orm
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.5.1
157
+ rubygems_version: 2.6.4
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Gem for commonly used database ORM.