active_orm 2.0.2 → 2.1.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: 5a15b69e5056f4a1460a3d5f285f98c05b6e6c6f
4
- data.tar.gz: 3f39bbaa249aef0f25ca718ce557fd4f4fee9523
3
+ metadata.gz: 5650292e8b9bbac3eb802b6de000823ae42f8850
4
+ data.tar.gz: ff6f1d95cc140f1b3e07ee1b254b2240083b50a1
5
5
  SHA512:
6
- metadata.gz: ae108e8f8d384539e37c776eb567ce4023ec81a6a4168419bb043b47f1ffe1437e7a69809bac9db4c44bc6a00320d67fd0a4925b25c4f72857c57a484e9f9674
7
- data.tar.gz: 4b230d67c5b67df21bd9c743b53bdffa6275438899addcba060b683042b28505e918e97cb5ee7f098d497bb091dcc50b29c34e5bb2395ac0985346d189984092
6
+ metadata.gz: aa5e1eddbc50075f8409e460b6a4ee04b8af2f0aff9f89b59dc7297df155cce864880f4c6e1f5afb3e6cff4cb1c8400a034a8f7854b16072e064cc856c1644d0
7
+ data.tar.gz: 1eeef7b4b480b5adf813caeed2907396338659275ab94d39d3d7a9eca5f2e6e1ef695c582b9004d229629f22e2793f7e7e99e3cdcb82a7280b0b2e2adb5bab8d
data/README.md CHANGED
@@ -13,8 +13,6 @@ ActiveOrm is a library for object ruby mapping of different databases.
13
13
  * Cassandra
14
14
  * InfluxDB
15
15
 
16
- Note: Library will be rewritten to be even more flexible for connection switching.
17
-
18
16
  ## Installation
19
17
 
20
18
  Add this line to your application's Gemfile:
@@ -42,9 +40,15 @@ Or install it yourself as:
42
40
  **Options:**
43
41
  * client: add a custom Redis client
44
42
 
43
+ `rails generate active_orm:install` will generate the following `active_orm.rb` file:
44
+
45
45
  ```ruby
46
- ActiveOrm::Redis.configure do |config|
47
- config.client = Redis.new(:host => "10.0.1.1", :port => 6380, :db => 15)
46
+ # config/initalizers/active_orm.rb
47
+
48
+ if defined?(Redis)
49
+ ActiveOrm::Redis.configure do |config|
50
+ config.client = Redis.new(:host => "10.0.1.1", :port => 6380, :db => 15)
51
+ end
48
52
  end
49
53
  ```
50
54
 
@@ -79,7 +83,7 @@ ActiveOrm::Redis::List.evaluate.find(:user_1) #=> { id: 32123, name: "James Dean
79
83
  * reset: reset current database
80
84
  * reset_all: reset all databases
81
85
 
82
- `rake redis:reset` and `rake redis:reset_all`
86
+ `rake db:redis:reset` and `rake db:redis:reset_all`
83
87
 
84
88
  ## Contributing
85
89
 
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "coveralls"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "generator_spec"
28
29
  end
@@ -1,3 +1,5 @@
1
+ require "rails/railtie"
2
+
1
3
  require "active_orm/version"
2
4
  require "active_orm/base"
3
5
 
@@ -15,6 +17,8 @@ require "active_orm/redis/sorted_set"
15
17
  require "active_orm/redis/string"
16
18
  require "active_orm/redis/transaction"
17
19
 
20
+ require "generators/active_orm/install_generator"
21
+
18
22
  module ActiveOrm
19
23
  class Railtie < Rails::Railtie
20
24
 
@@ -1,3 +1,3 @@
1
1
  module ActiveOrm
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveOrm
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def copy_initializer_file
8
+ copy_file("install.rb", "config/initializers/active_orm.rb")
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ if defined?(Redis)
2
+ ActiveOrm::Redis.configure do |config|
3
+ config.client = Redis.new
4
+ end
5
+ end
@@ -1,27 +1,29 @@
1
1
  namespace :db do
2
2
  namespace :redis do
3
3
 
4
- desc "Reset active Redis databases"
5
- task :reset do
6
- puts "== Reset: reseting active ".ljust(80, "=")
4
+ desc "Reset Redis database"
5
+ task reset: :environment do
6
+ puts "== Reset: reseting Redis ".ljust(80, "=")
7
7
  total_task_start_time = Time.current
8
8
 
9
+ puts " -> Resetting"
9
10
  ActiveOrm::Redis::Connection.flush
10
11
 
11
12
  total_task_elapsed_time = (Time.current - total_task_start_time).round(5)
12
- puts "== Reset: reset active (#{total_task_elapsed_time}s) ".ljust(80, "=")
13
+ puts "== Reset: reset Redis (#{total_task_elapsed_time}s) ".ljust(80, "=")
13
14
  puts ""
14
15
  end
15
16
 
16
17
  desc "Reset all Redis databases"
17
- task :reset_all do
18
- puts "== Reset: reseting all ".ljust(80, "=")
18
+ task reset_all: :environment do
19
+ puts "== Reset: reseting all Redis ".ljust(80, "=")
19
20
  total_task_start_time = Time.current
20
21
 
22
+ puts " -> Resetting"
21
23
  ActiveOrm::Redis::Connection.flush_all
22
24
 
23
25
  total_task_elapsed_time = (Time.current - total_task_start_time).round(5)
24
- puts "== Reset: reset all (#{total_task_elapsed_time}s) ".ljust(80, "=")
26
+ puts "== Reset: reset all Redis (#{total_task_elapsed_time}s) ".ljust(80, "=")
25
27
  puts ""
26
28
  end
27
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: generator_spec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: ORM for non-supported databases.
84
98
  email:
85
99
  - j.gomez@drexed.com
@@ -117,6 +131,8 @@ files:
117
131
  - lib/active_orm/redis/string.rb
118
132
  - lib/active_orm/redis/transaction.rb
119
133
  - lib/active_orm/version.rb
134
+ - lib/generators/active_orm/install_generator.rb
135
+ - lib/generators/active_orm/templates/install.rb
120
136
  - lib/tasks/redis.rake
121
137
  homepage: https://github.com/drexed/active_orm
122
138
  licenses: