simple_taggable 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/lib/simple_taggable.rb +4 -4
- data/lib/simple_taggable/version.rb +1 -1
- data/simple_taggable.gemspec +2 -0
- data/spec/spec_helper.rb +21 -4
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d0262bfe132b7511991593c2a22e104d5742528
|
4
|
+
data.tar.gz: 2e89ce1e7fc1841bc38f5ba53801763560f9f5d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83bf560d7534478b89e78ad1b5802ac3a7119f200c51923f3195eb6bd8d2555a4a4c7b541c980b934fbde123b92f20949bc09eaed57f41eb534c03101f23f53
|
7
|
+
data.tar.gz: 2a8c3c76a25b8f52119a41adfcf01c5da956f4ad0a1f4b904e29f63dcdb5cd417fdbe06954f4e182f1bd5d4a1801016e1b983f60d52a6b9e12a3ca47568d54b1
|
data/.travis.yml
CHANGED
@@ -7,7 +7,14 @@ rvm:
|
|
7
7
|
- 2.2
|
8
8
|
- 2.1
|
9
9
|
|
10
|
+
env:
|
11
|
+
- DB=postgres
|
12
|
+
- DB=mysql
|
13
|
+
- DB=sqlite3
|
14
|
+
|
10
15
|
before_script:
|
16
|
+
- mysql -e 'create database simple_taggable;'
|
17
|
+
- psql -c 'create database simple_taggable;' -U postgres
|
11
18
|
- bundle exec rake test:copy_migrations
|
12
19
|
|
13
20
|
gemfile:
|
data/lib/simple_taggable.rb
CHANGED
@@ -21,11 +21,11 @@ module SimpleTaggable
|
|
21
21
|
tag_scope = SimpleTaggable::Models::Tag.where(name: tag_name)
|
22
22
|
|
23
23
|
if exclude
|
24
|
-
|
25
|
-
where.not(id:
|
24
|
+
records = joins(:tags).merge(tag_scope).group(%W(#{quoted_table_name}.#{connection.quote_column_name("id")}))
|
25
|
+
where.not(id: records.pluck(:id))
|
26
26
|
else
|
27
|
-
|
28
|
-
break scope.having("count(*)
|
27
|
+
joins(:tags).merge(tag_scope).group(%W(#{quoted_table_name}.#{connection.quote_column_name("id")})).tap do |scope|
|
28
|
+
break scope.having("count(*) = ?", tag_name.length) if match_all
|
29
29
|
end
|
30
30
|
end
|
31
31
|
}
|
data/simple_taggable.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
28
|
spec.add_development_dependency "database_cleaner"
|
29
29
|
spec.add_development_dependency "sqlite3"
|
30
|
+
spec.add_development_dependency "pg"
|
31
|
+
spec.add_development_dependency "mysql2", "~> 0.3.0"
|
30
32
|
spec.add_development_dependency "shoulda-matchers"
|
31
33
|
spec.add_development_dependency "coveralls"
|
32
34
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,10 +4,27 @@ Coveralls.wear!
|
|
4
4
|
|
5
5
|
require "active_record"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
case ENV["DB"]
|
8
|
+
when "postgres"
|
9
|
+
require "pg"
|
10
|
+
ActiveRecord::Base.establish_connection(
|
11
|
+
adapter: "postgresql",
|
12
|
+
database: "simple_taggable",
|
13
|
+
username: "postgres"
|
14
|
+
)
|
15
|
+
when "mysql"
|
16
|
+
require "mysql2"
|
17
|
+
ActiveRecord::Base.establish_connection(
|
18
|
+
adapter: "mysql2",
|
19
|
+
database: "simple_taggable",
|
20
|
+
username: "root"
|
21
|
+
)
|
22
|
+
else
|
23
|
+
ActiveRecord::Base.establish_connection(
|
24
|
+
adapter: "sqlite3",
|
25
|
+
database: ":memory:"
|
26
|
+
)
|
27
|
+
end
|
11
28
|
|
12
29
|
require 'simple_taggable'
|
13
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_taggable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pg
|
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'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: mysql2
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.3.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.3.0
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: shoulda-matchers
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|