mixed_gauge 0.1.0 → 0.1.1

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: b0f38717b364867534a54530bbd6a5279086a46e
4
- data.tar.gz: ea86038064d74083b87d1d631bfc3b7769b71bfc
3
+ metadata.gz: 5cb22b7adaa5a1e4b9ef9b995f5bd5fe1793d366
4
+ data.tar.gz: 334e18351f5e92c0a931aceff4fb8f294afee30b
5
5
  SHA512:
6
- metadata.gz: e499016ee06b4683e9b71b48b315a758d296812fe87cffb62d02ffa9590687b7d4280ed6ea853fbf10de630588f148a7993717ecc7ec56ecb2c3c9977956e57d
7
- data.tar.gz: 8e516f5b4f727b24bfeaebd3aa707ee60826d5b33af930508cec651e10bf95fc6241a872a752d582d8370abe8b03f17a3e2e35b1409fc37efa311a8f266576c6
6
+ metadata.gz: a11c1dd6b9df580f0671d9cff99ce4d69d5c6aef2b26cfd378803bd8fa025875b988b549f9b866f230454e5b53cf09bdad246af0da61ddf337e22f1c04c4c1f4
7
+ data.tar.gz: eb0683ff2d6d3df290edaa26a9e7391a169a7dc0e4b9f617d45f58f5d5d1e22a63df4655592d76c90bed54af2de14fc93ae4fb1f15ac4aa01fece1260f51fd46
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.1
3
+ - '2.0'
4
+ - '2.1'
5
+ - '2.2'
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.1
2
+ - Fix NoMethodError bug on MixedGauge::Model.
3
+ - Improve tests, measure coverage.
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # MixedGauge
2
+ [![Build Status](https://travis-ci.org/taiki45/mixed_gauge.svg?branch=master)](https://travis-ci.org/taiki45/mixed_gauge) [![Coverage Status](https://coveralls.io/repos/taiki45/mixed_gauge/badge.svg?branch=master)](https://coveralls.io/r/taiki45/mixed_gauge?branch=master) [![Code Climate](https://codeclimate.com/github/taiki45/mixed_gauge/badges/gpa.svg)](https://codeclimate.com/github/taiki45/mixed_gauge) [![Gem Version](https://badge.fury.io/rb/mixed_gauge.svg)](http://badge.fury.io/rb/mixed_gauge)
3
+
2
4
  An ActiveRecord extension for database sharding.
3
5
 
4
6
  ## Installation
@@ -63,7 +65,7 @@ model, specify distkey which determine nodes to store.
63
65
  class User < ActiveRecord::Base
64
66
  include MixedGauge::Model
65
67
  use_cluster :user
66
- distkey :email
68
+ def_distkey :email
67
69
  end
68
70
  ```
69
71
 
@@ -79,7 +81,7 @@ alice = User.get('alice@example.com')
79
81
  alice.age = 1
80
82
  alice.save!
81
83
 
82
- User.all_shards.flat_map {|m| m.where(name: 'alice') }
84
+ User.all_shards.flat_map {|m| m.where(name: 'alice') }.compact
83
85
  ```
84
86
 
85
87
  ## Development
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task :default => :spec
7
+ rescue LoadError
8
+ end
data/lib/mixed_gauge.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'active_record'
2
2
 
3
3
  require 'mixed_gauge/version'
4
+ require 'mixed_gauge/errors'
4
5
  require 'mixed_gauge/cluster_config'
5
6
  require 'mixed_gauge/config'
6
7
  require 'mixed_gauge/routing'
@@ -5,7 +5,7 @@ module MixedGauge
5
5
  # class User < ActiveRecord::Base
6
6
  # include MixedGauge::Model
7
7
  # use_cluster :user
8
- # distkey :email
8
+ # def_distkey :email
9
9
  # end
10
10
  #
11
11
  # User.put!(email: 'alice@example.com', name: 'alice')
@@ -14,13 +14,14 @@ module MixedGauge
14
14
  # alice.age = 1
15
15
  # alice.save!
16
16
  #
17
- # User.all_shards.flat_map {|m| m.where(name: 'alice') }
17
+ # User.all_shards.flat_map {|m| m.where(name: 'alice') }.compact
18
18
  module Model
19
19
  extend ActiveSupport::Concern
20
20
 
21
21
  included do
22
22
  class_attribute :cluster_routing, instance_writer: false
23
23
  class_attribute :sub_model_repository, instance_writer: false
24
+ class_attribute :distkey, instance_writer: false
24
25
  end
25
26
 
26
27
  module ClassMethods
@@ -33,7 +34,7 @@ module MixedGauge
33
34
  end
34
35
 
35
36
  # @param [Symbol] column
36
- def distkey(column)
37
+ def def_distkey(column)
37
38
  self.distkey = column.to_sym
38
39
  end
39
40
 
@@ -1,3 +1,3 @@
1
1
  module MixedGauge
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
data/mixed_gauge.gemspec CHANGED
@@ -21,9 +21,12 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'activesupport', '>= 4.0.0'
23
23
  spec.add_dependency 'activerecord', '>= 4.0.0'
24
- spec.add_development_dependency 'bundler', '~> 1.9'
24
+ spec.add_development_dependency 'coveralls'
25
25
  spec.add_development_dependency 'pry'
26
- spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'pry-doc'
27
+ spec.add_development_dependency 'pry-stack_explorer'
28
+ spec.add_development_dependency 'rake'
27
29
  spec.add_development_dependency 'rspec', '~> 3'
30
+ spec.add_development_dependency 'simplecov'
28
31
  spec.add_development_dependency 'sqlite3'
29
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixed_gauge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.9'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.9'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +66,48 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-doc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-stack_explorer
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'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '10.0'
103
+ version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '10.0'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rspec
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,20 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '3'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: sqlite3
99
141
  requirement: !ruby/object:Gem::Requirement
@@ -116,9 +158,11 @@ executables: []
116
158
  extensions: []
117
159
  extra_rdoc_files: []
118
160
  files:
161
+ - ".coveralls.yml"
119
162
  - ".gitignore"
120
163
  - ".rspec"
121
164
  - ".travis.yml"
165
+ - CHANGELOG.md
122
166
  - Gemfile
123
167
  - LICENSE.txt
124
168
  - README.md