groupify 0.6.2 → 0.6.3

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: 4f88acd3be5c8900aa35d7f0d7f1a86c2443dfcf
4
- data.tar.gz: 5aa05e78a95816fe5c56673cb1dad8ead865090a
3
+ metadata.gz: 330d329200d0dda6ac489a0c099fd54655e2899d
4
+ data.tar.gz: 95a7c8c3d68c7e409818cd8fe816957325da8112
5
5
  SHA512:
6
- metadata.gz: c9ed6a4b163849098b3b54f2347e22494521c4c2073cc0013e445503ff66e807eeca113d27247b83b9d9f0f1d8f745599e345dc36e6163950555a1453b4c51f2
7
- data.tar.gz: b098c8c0cc68cbfa5e024b52422020f53b8a7c2639bf22987f8933cd2e9bb098e02bc567d1b922211d9074af7ee07f0762ce8f3f57aaf20b96cc70bf9030d764
6
+ metadata.gz: f256fc9f5d55ad7feb210c9af83ae7005f0c1921ad76af0f3f5287f8f0e71653a5a54e99f335460cada5dd11466ad96b70b862951e4eb8f52362f3175fa004f4
7
+ data.tar.gz: 2be5800f07ea8e8b32f13e349557ebfb6f795fe490433a7468e4f5606c349573728ce47e59a40894705967cc4599b38000b966ca10a37c4d5bf2e8993d0d40c3
data/.travis.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  language: ruby
2
2
  services: mongodb
3
+ env:
4
+ - DATABASE=sqlite3
5
+ - DATABASE=sqlite3mem
6
+ - DATABASE=postgresql
7
+ - DATABASE=mysql
3
8
  rvm:
4
9
  - 1.9.3
5
10
  - 2.0.0
data/Gemfile CHANGED
@@ -11,5 +11,15 @@ end
11
11
  # Specify your gem's dependencies in groupify.gemspec
12
12
  gemspec
13
13
 
14
- gem "jdbc-sqlite3", platform: :jruby
15
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
14
+ platforms :jruby do
15
+ gem "activerecord-jdbcsqlite3-adapter"
16
+ gem "activerecord-jdbcmysql-adapter"
17
+ gem "jdbc-mysql"
18
+ gem "activerecord-jdbcpostgresql-adapter"
19
+ end
20
+
21
+ platforms :ruby do
22
+ gem "sqlite3"
23
+ gem "mysql2"
24
+ gem "pg"
25
+ end
data/README.md CHANGED
@@ -7,13 +7,19 @@ model? Use named groups instead to add members to named groups such as
7
7
  `:admin` or `"Team Rocketpants"`.
8
8
 
9
9
  The following ORMs are supported:
10
- * ActiveRecord 3.2, 4.x
11
- * Mongoid 3.1, 4.0,
10
+ * ActiveRecord 3.2, 4.1.x, 4.2.x
11
+ * Mongoid 3.1, 4.0
12
12
 
13
13
  The following Rubies are supported:
14
- * MRI Ruby 1.9.3, 2.0.x, 2.1.x
14
+ * MRI Ruby 1.9.3, 2.0.x, 2.1.x, 2.2.x
15
15
  * JRuby (1.9 mode)
16
16
 
17
+ The following databases are supported:
18
+ * MySQL
19
+ * PostgreSQL
20
+ * SQLite
21
+ * MongoDB
22
+
17
23
  ## Installation
18
24
 
19
25
  Add this line to your application's Gemfile:
@@ -2,8 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jdbc-sqlite3", :platform => :jruby
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
7
5
  gem "activerecord", "~> 3.2"
8
6
  gem "mongoid", ">= 3.0", "< 4"
9
7
 
@@ -15,4 +13,17 @@ group :test do
15
13
  gem "coveralls", :require => false
16
14
  end
17
15
 
16
+ platforms :jruby do
17
+ gem "activerecord-jdbcsqlite3-adapter"
18
+ gem "activerecord-jdbcmysql-adapter"
19
+ gem "jdbc-mysql"
20
+ gem "activerecord-jdbcpostgresql-adapter"
21
+ end
22
+
23
+ platforms :ruby do
24
+ gem "sqlite3"
25
+ gem "mysql2"
26
+ gem "pg"
27
+ end
28
+
18
29
  gemspec :path => "../"
@@ -2,8 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jdbc-sqlite3", :platform => :jruby
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
7
5
  gem "activerecord", "~> 4.0.0"
8
6
  gem "mongoid", "~> 4.0"
9
7
 
@@ -15,4 +13,17 @@ group :test do
15
13
  gem "coveralls", :require => false
16
14
  end
17
15
 
16
+ platforms :jruby do
17
+ gem "activerecord-jdbcsqlite3-adapter"
18
+ gem "activerecord-jdbcmysql-adapter"
19
+ gem "jdbc-mysql"
20
+ gem "activerecord-jdbcpostgresql-adapter"
21
+ end
22
+
23
+ platforms :ruby do
24
+ gem "sqlite3"
25
+ gem "mysql2"
26
+ gem "pg"
27
+ end
28
+
18
29
  gemspec :path => "../"
@@ -2,8 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jdbc-sqlite3", :platform => :jruby
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
7
5
  gem "activerecord", "~> 4.1.0"
8
6
  gem "mongoid", "~> 4.0"
9
7
 
@@ -15,4 +13,17 @@ group :test do
15
13
  gem "coveralls", :require => false
16
14
  end
17
15
 
16
+ platforms :jruby do
17
+ gem "activerecord-jdbcsqlite3-adapter"
18
+ gem "activerecord-jdbcmysql-adapter"
19
+ gem "jdbc-mysql"
20
+ gem "activerecord-jdbcpostgresql-adapter"
21
+ end
22
+
23
+ platforms :ruby do
24
+ gem "sqlite3"
25
+ gem "mysql2"
26
+ gem "pg"
27
+ end
28
+
18
29
  gemspec :path => "../"
@@ -2,8 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jdbc-sqlite3", :platform => :jruby
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
7
5
  gem "activerecord", "~> 4.2.0"
8
6
  gem "mongoid", "~> 4.0"
9
7
 
@@ -15,4 +13,17 @@ group :test do
15
13
  gem "coveralls", :require => false
16
14
  end
17
15
 
16
+ platforms :jruby do
17
+ gem "activerecord-jdbcsqlite3-adapter"
18
+ gem "activerecord-jdbcmysql-adapter"
19
+ gem "jdbc-mysql"
20
+ gem "activerecord-jdbcpostgresql-adapter"
21
+ end
22
+
23
+ platforms :ruby do
24
+ gem "sqlite3"
25
+ gem "mysql2"
26
+ gem "pg"
27
+ end
28
+
18
29
  gemspec :path => "../"
data/groupify.gemspec CHANGED
@@ -16,15 +16,14 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Groupify::VERSION
17
17
  gem.license = 'MIT'
18
18
 
19
- gem.add_development_dependency "mongoid", ">= 3.1"
20
- gem.add_development_dependency "activerecord", ">= 3.2"
19
+ gem.required_ruby_version = ">= 1.9.3"
21
20
 
22
- unless defined?(JRUBY_VERSION)
23
- gem.add_development_dependency "sqlite3"
24
- end
21
+ gem.add_development_dependency "mongoid", ">= 3.1"
22
+ gem.add_development_dependency "activerecord", ">= 3.2", "< 5"
25
23
 
26
24
  gem.add_development_dependency "rspec", ">= 3"
27
25
 
28
26
  gem.add_development_dependency "database_cleaner", "~> 1.3.0"
27
+ gem.add_development_dependency 'combustion'
29
28
  gem.add_development_dependency "appraisal"
30
29
  end
@@ -117,7 +117,7 @@ module Groupify
117
117
  return none unless groups.present?
118
118
 
119
119
  joins(:group_memberships).
120
- group(:"group_memberships.member_id").
120
+ group("#{quoted_table_name}.#{connection.quote_column_name('id')}").
121
121
  where(:group_memberships => {:group_id => groups.map(&:id)}).
122
122
  having("COUNT(group_memberships.group_id) = #{groups.count}").
123
123
  uniq
@@ -128,7 +128,7 @@ module Groupify
128
128
  return none unless groups.present?
129
129
 
130
130
  joins(:group_memberships).
131
- group(:"group_memberships.member_id").
131
+ group("#{quoted_table_name}.#{connection.quote_column_name('id')}").
132
132
  having("COUNT(DISTINCT group_memberships.group_id) = #{groups.count}").
133
133
  uniq
134
134
  end
@@ -80,7 +80,7 @@ module Groupify
80
80
  return none unless named_groups.present?
81
81
 
82
82
  joins(:group_memberships).
83
- group(:"group_memberships.member_id").
83
+ group("#{quoted_table_name}.#{connection.quote_column_name('id')}").
84
84
  where(:group_memberships => {:group_name => named_groups}).
85
85
  having("COUNT(DISTINCT group_memberships.group_name) = #{named_groups.count}").
86
86
  uniq
@@ -91,7 +91,7 @@ module Groupify
91
91
  return none unless named_groups.present?
92
92
 
93
93
  joins(:group_memberships).
94
- group("group_memberships.member_id").
94
+ group("#{quoted_table_name}.#{connection.quote_column_name('id')}").
95
95
  having("COUNT(DISTINCT group_memberships.group_name) = #{named_groups.count}").
96
96
  uniq
97
97
  end
@@ -1,3 +1,3 @@
1
1
  module Groupify
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -1,15 +1,18 @@
1
1
  require 'active_record'
2
2
 
3
- puts "ActiveRecord version #{ActiveSupport::VERSION::STRING}"
4
-
5
- # Load database config
6
- if JRUBY
7
- require 'jdbc/sqlite3'
8
- require 'active_record'
9
- require 'active_record/connection_adapters/jdbcsqlite3_adapter'
10
- else
11
- require 'sqlite3'
12
- end
3
+ DATABASE = ENV.fetch('DATABASE', 'sqlite3mem')
4
+
5
+ puts "ActiveRecord Version: #{ActiveSupport::VERSION::STRING}, Database: #{DATABASE}"
6
+
7
+ require 'yaml'
8
+ require 'erb'
9
+ ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read("#{File.dirname(__FILE__)}/db/database.yml")).result)
10
+ ActiveRecord::Base.establish_connection(DATABASE.to_sym)
11
+ ActiveRecord::Migration.verbose = false
12
+
13
+ require 'combustion/database'
14
+ Combustion::Database.create_database(ActiveRecord::Base.configurations[DATABASE])
15
+ load(File.join(File.dirname(__FILE__), "db", "schema.rb"))
13
16
 
14
17
  RSpec.configure do |config|
15
18
  config.before(:suite) do
@@ -23,45 +26,11 @@ RSpec.configure do |config|
23
26
  config.after(:each) do
24
27
  DatabaseCleaner[:active_record].clean
25
28
  end
26
- end
27
-
28
- ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ":memory:" )
29
-
30
- ActiveRecord::Migration.verbose = false
31
- ActiveRecord::Schema.define(:version => 1) do
32
-
33
- create_table :groups do |t|
34
- t.string :name
35
- t.string :type
36
- end
37
-
38
- create_table :group_memberships do |t|
39
- t.string :member_type
40
- t.integer :member_id
41
- t.integer :group_id
42
- t.string :group_name
43
- t.string :membership_type
44
- end
45
-
46
- create_table :users do |t|
47
- t.string :name
48
- t.string :type
49
- end
50
-
51
- create_table :widgets do |t|
52
- t.string :name
53
- end
54
29
 
55
- create_table :projects do |t|
56
- t.string :name
57
- end
58
-
59
- create_table :organizations do |t|
60
- t.string :name
61
- end
62
-
63
- create_table :members do |t|
64
- t.string :name
30
+ config.after(:suite) do
31
+ unless ENV['DB'] =~ /sqlite/
32
+ Combustion::Database.drop_database(ActiveRecord::Base.configurations[DATABASE])
33
+ end
65
34
  end
66
35
  end
67
36
 
@@ -0,0 +1,20 @@
1
+ sqlite3:
2
+ adapter: <%= "jdbc" if defined? JRUBY_VERSION %>sqlite3
3
+ database: groupify.sqlite3.db
4
+ sqlite3mem:
5
+ adapter: <%= "jdbc" if defined? JRUBY_VERSION %>sqlite3
6
+ database: ":memory:"
7
+ postgresql:
8
+ adapter: postgresql
9
+ encoding: unicode
10
+ database: groupify_test
11
+ pool: 5
12
+ username: postgres
13
+ password: postgres
14
+ min_messages: warning
15
+ mysql:
16
+ adapter: <%= defined?(JRUBY_VERSION) ? "jdbcmysql" : "mysql2" %>
17
+ host: localhost
18
+ username: root
19
+ password:
20
+ database: groupify_test
data/spec/db/schema.rb ADDED
@@ -0,0 +1,35 @@
1
+ ActiveRecord::Schema.define(version: 0) do
2
+ create_table :groups do |t|
3
+ t.string :name
4
+ t.string :type
5
+ end
6
+
7
+ create_table :group_memberships do |t|
8
+ t.string :member_type
9
+ t.integer :member_id
10
+ t.integer :group_id
11
+ t.string :group_name
12
+ t.string :membership_type
13
+ end
14
+
15
+ create_table :users do |t|
16
+ t.string :name
17
+ t.string :type
18
+ end
19
+
20
+ create_table :widgets do |t|
21
+ t.string :name
22
+ end
23
+
24
+ create_table :projects do |t|
25
+ t.string :name
26
+ end
27
+
28
+ create_table :organizations do |t|
29
+ t.string :name
30
+ end
31
+
32
+ create_table :members do |t|
33
+ t.string :name
34
+ end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dwbutler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-28 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '5'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,20 +41,9 @@ dependencies:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '3.2'
41
- - !ruby/object:Gem::Dependency
42
- name: sqlite3
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
44
+ - - "<"
53
45
  - !ruby/object:Gem::Version
54
- version: '0'
46
+ version: '5'
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: rspec
57
49
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +72,20 @@ dependencies:
80
72
  - - "~>"
81
73
  - !ruby/object:Gem::Version
82
74
  version: 1.3.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: combustion
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: appraisal
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -133,6 +139,8 @@ files:
133
139
  - lib/groupify/railtie.rb
134
140
  - lib/groupify/version.rb
135
141
  - spec/active_record_spec.rb
142
+ - spec/db/database.yml
143
+ - spec/db/schema.rb
136
144
  - spec/mongoid_spec.rb
137
145
  - spec/spec_helper.rb
138
146
  homepage: https://github.com/dwbutler/groupify
@@ -147,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
155
  requirements:
148
156
  - - ">="
149
157
  - !ruby/object:Gem::Version
150
- version: '0'
158
+ version: 1.9.3
151
159
  required_rubygems_version: !ruby/object:Gem::Requirement
152
160
  requirements:
153
161
  - - ">="
@@ -161,5 +169,7 @@ specification_version: 4
161
169
  summary: Group functionality for Rails
162
170
  test_files:
163
171
  - spec/active_record_spec.rb
172
+ - spec/db/database.yml
173
+ - spec/db/schema.rb
164
174
  - spec/mongoid_spec.rb
165
175
  - spec/spec_helper.rb