flag_shih_tzu 0.3.15 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -4
- data/CHANGELOG.md +5 -0
- data/README.md +17 -12
- data/gemfiles/Gemfile.activerecord-3.0.x +3 -0
- data/gemfiles/Gemfile.activerecord-3.1.x +3 -0
- data/gemfiles/Gemfile.activerecord-3.2.x +3 -0
- data/lib/flag_shih_tzu.rb +2 -1
- data/lib/flag_shih_tzu/version.rb +1 -1
- data/test/flag_shih_tzu_test.rb +3 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ff897d847cf4dafdfc34e7a3d725aa6d101b77
|
4
|
+
data.tar.gz: 862c9a6441b3ec33d4f3cf0929935faf898efde7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e3a221af865774a094c4135b9621953ac33fcca96b2b2d2b0aeab0947dd873886a15078f6d4d34a07f37e9ef00ad9dba04af99bc72edc3c236721b7b73db127
|
7
|
+
data.tar.gz: bf1da90dcee4a170fdba40c179601d404351ee8f6d3debc45883d8d7cea038021d19b912ab1cab689cf37e6340c034bdb80d3c1839a0ee85a6778df69ef53461
|
data/.travis.yml
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
sudo: false
|
1
4
|
rvm:
|
2
5
|
- 1.9.3
|
3
6
|
- 2.0.0
|
4
|
-
- 2.1.
|
7
|
+
- 2.1.7
|
5
8
|
- 2.2.3
|
9
|
+
- ruby-head
|
6
10
|
- jruby-1.7.22
|
7
11
|
- jruby-9.0.1.0
|
8
12
|
gemfile:
|
@@ -14,6 +18,9 @@ gemfile:
|
|
14
18
|
- gemfiles/Gemfile.activerecord-4.1.x
|
15
19
|
- gemfiles/Gemfile.activerecord-4.2.x
|
16
20
|
matrix:
|
21
|
+
allow_failures:
|
22
|
+
- rvm: ruby-head
|
23
|
+
- rvm: 1.9.3
|
17
24
|
exclude:
|
18
25
|
- rvm: jruby-9.0.1.0
|
19
26
|
gemfile: gemfiles/Gemfile.activerecord-2.3.x
|
@@ -45,11 +52,11 @@ matrix:
|
|
45
52
|
gemfile: gemfiles/Gemfile.activerecord-3.2.x
|
46
53
|
- rvm: 2.2.3
|
47
54
|
gemfile: gemfiles/Gemfile.activerecord-4.0.x
|
48
|
-
- rvm: 2.1.
|
55
|
+
- rvm: 2.1.7
|
49
56
|
gemfile: gemfiles/Gemfile.activerecord-2.3.x
|
50
|
-
- rvm: 2.1.
|
57
|
+
- rvm: 2.1.7
|
51
58
|
gemfile: gemfiles/Gemfile.activerecord-3.0.x
|
52
|
-
- rvm: 2.1.
|
59
|
+
- rvm: 2.1.7
|
53
60
|
gemfile: gemfiles/Gemfile.activerecord-3.1.x
|
54
61
|
- rvm: 2.0.0
|
55
62
|
gemfile: gemfiles/Gemfile.activerecord-2.3.x
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
* Work merged into master branch goes here until it is released.
|
4
4
|
|
5
|
+
# Version 0.3.16 - JAN.16.2017
|
6
|
+
|
7
|
+
* Fix complex custom sql queries with multiple references to the column by vegetaras
|
8
|
+
* Improved documentation and compatibility matrix by pboling
|
9
|
+
|
5
10
|
# Version 0.3.15 - OCT.11.2015
|
6
11
|
|
7
12
|
* Fixed testing for all supported environments by Peter Boling
|
data/README.md
CHANGED
@@ -6,7 +6,8 @@ Bit fields for ActiveRecord
|
|
6
6
|
|------------------------ | ----------------- |
|
7
7
|
| gem name | flag_shih_tzu |
|
8
8
|
| license | MIT |
|
9
|
-
|
|
9
|
+
| expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
|
10
|
+
| download rank | [![Total Downloads](https://img.shields.io/gem/rt/flag_shih_tzu.svg)](https://rubygems.org/gems/flag_shih_tzu) |
|
10
11
|
| version | [![Gem Version](https://badge.fury.io/rb/flag_shih_tzu.png)](http://badge.fury.io/rb/flag_shih_tzu) |
|
11
12
|
| dependencies | [![Dependency Status](https://gemnasium.com/pboling/flag_shih_tzu.png)](https://gemnasium.com/pboling/flag_shih_tzu) |
|
12
13
|
| code quality | [![Code Climate](https://codeclimate.com/github/pboling/flag_shih_tzu.png)](https://codeclimate.com/github/pboling/flag_shih_tzu) |
|
@@ -15,8 +16,8 @@ Bit fields for ActiveRecord
|
|
15
16
|
| test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/flag_shih_tzu/badge.png)](https://coveralls.io/r/pboling/flag_shih_tzu) |
|
16
17
|
| homepage | [https://github.com/pboling/flag_shih_tzu][homepage] |
|
17
18
|
| documentation | [http://rdoc.info/github/pboling/flag_shih_tzu/frames][documentation] |
|
18
|
-
|
|
19
|
-
| Spread ~♡ⓛⓞⓥⓔ♡~
|
19
|
+
| live chat | [![Join the chat at https://gitter.im/pboling/flag_shih_tzu](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pboling/flag_shih_tzu?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
|
20
|
+
| Spread ~♡ⓛⓞⓥⓔ♡~ | [on Coderbits](https://coderbits.com/pboling), [on Coderwall](http://coderwall.com/pboling) |
|
20
21
|
|
21
22
|
## Summary
|
22
23
|
|
@@ -49,19 +50,20 @@ The gem is actively being tested with:
|
|
49
50
|
|
50
51
|
* MySQL, PostgreSQL and SQLite3 databases (Both Ruby and JRuby adapters)
|
51
52
|
* ActiveRecord versions 2.3.x, 3.0.x, 3.1.x, 3.2.x, 4.0.x, 4.1.x, 4.2.x
|
52
|
-
* Ruby 1.9.3, 2.0.0, 2.1.
|
53
|
+
* Ruby 1.9.3, 2.0.0, 2.1.7, 2.2.3, jruby-1.7.22, jruby-9.0.1.0
|
53
54
|
* Travis tests the supportedt builds. See [.travis.yml](https://github.com/pboling/flag_shih_tzu/blob/master/.travis.yml) for the matrix.
|
54
55
|
* All of the supported builds can also be run locally. See [bin/test.bash](https://github.com/pboling/flag_shih_tzu/blob/master/bin/test.bash)
|
55
56
|
|
56
57
|
### Compatibility Matrix
|
57
58
|
|
58
59
|
| Ruby / Active Record | 2.3.x | 3.0.x | 3.1.x | 3.2.x | 4.0.x | 4.1.x | 4.2.x |
|
60
|
+
|:---------------------:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
|
59
61
|
| 1.9.3 | ✓ | ✓ | ✓ | ✓ | | | |
|
60
62
|
| 2.0.0 | | ✓ | ✓ | ✓ | ✓ | ✓ | |
|
61
|
-
| 2.1.
|
62
|
-
| 2.2.
|
63
|
-
| jruby-1.7.
|
64
|
-
| jruby-9.0.
|
63
|
+
| 2.1.x | | | | ✓ | ✓ | ✓ | ✓ |
|
64
|
+
| 2.2.x | | | | ✓ | ✓ | ✓ | ✓ |
|
65
|
+
| jruby-1.7.x | | | ✓ | ✓ | ✓ | ✓ | ✓ |
|
66
|
+
| jruby-9.0.x | | | | ✓ | ✓ | ✓ | ✓ |
|
65
67
|
|
66
68
|
**Legacy**
|
67
69
|
|
@@ -520,6 +522,13 @@ rebase your work onto the current master to make integration easier.
|
|
520
522
|
|
521
523
|
More information on the changes for 0.3.X: [pboling/flag_shih_tzu/wiki/Changes-for-0.3.x](https://github.com/pboling/flag_shih_tzu/wiki/Changes-for-0.3.x)
|
522
524
|
|
525
|
+
## Alternatives
|
526
|
+
|
527
|
+
I recently (October 2015) discovered that Michael Grosser had created a competing tool, `bitfields`, way back in 2010, exactly a year after this tool was created. It was a very surreal moment, as I had thought this was the only game in town and it was when I began using and hacking on it. Once I got over that moment I became excited, because competition makes things better, right? So, now I am looking forward to a shootout some lazy Saturday. Until then there's this: http://www.railsbling.com/posts/why-use-flag_shih_tzu/
|
528
|
+
|
529
|
+
There is little that `bitfields` does better. The code is [less efficient](https://github.com/grosser/bitfields/blob/master/lib/bitfields.rb#L186 "recalculating and throwing away much of the result in many places"), albeit more readable, not as well tested, has almost zero inline documentation, and simply can't do many of the things I've built into `flag_shih_tzu`. If you are still on legacy Ruby or legacy Rails, or using jRuby, then use `flag_shih_tzu`. If you need multiple flag columns on a single model, use `flag_shih_tzu`.
|
530
|
+
|
531
|
+
Will there ever be a merb/rails-like love fest between the projects? It would be interesting. I like his name better. I like my features better. I like some of his code better, and some of my code better. I've been wanting to do a full re-write of `flag_shih_tzu` ever since I inherited the project from [XING](https://github.com/xing), but I haven't had time. So I don't know.
|
523
532
|
|
524
533
|
## License
|
525
534
|
|
@@ -556,7 +565,3 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
556
565
|
[homepage]: https://github.com/pboling/flag_shih_tzu
|
557
566
|
[bit_field]: http://en.wikipedia.org/wiki/Bit_field
|
558
567
|
[bitwise_operation]: http://en.wikipedia.org/wiki/Bitwise_operation
|
559
|
-
|
560
|
-
|
561
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/pboling/flag_shih_tzu/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
562
|
-
|
data/lib/flag_shih_tzu.rb
CHANGED
@@ -390,7 +390,8 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
390
390
|
|
391
391
|
def sql_set_for_flag(flag, colmn, enabled = true, custom_table_name = table_name)
|
392
392
|
check_flag(flag, colmn)
|
393
|
-
|
393
|
+
full_name = "#{custom_table_name}.#{colmn}"
|
394
|
+
"#{full_name} = #{full_name} #{enabled ? "| " : "& ~" }#{flag_mapping[colmn][flag]}"
|
394
395
|
end
|
395
396
|
|
396
397
|
def valid_flag_key?(flag_key)
|
data/test/flag_shih_tzu_test.rb
CHANGED
@@ -345,7 +345,7 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
|
|
345
345
|
Spaceship.send(:sql_in_for_flag, :warpdrive, "flags")
|
346
346
|
end
|
347
347
|
def test_sql_set_for_flag
|
348
|
-
assert_equal "flags = flags | 1",
|
348
|
+
assert_equal "spaceships.flags = spaceships.flags | 1",
|
349
349
|
Spaceship.send(:sql_set_for_flag, :warpdrive, "flags")
|
350
350
|
end
|
351
351
|
|
@@ -1419,9 +1419,9 @@ class FlagShihTzuDerivedClassTest < Test::Unit::TestCase
|
|
1419
1419
|
end
|
1420
1420
|
|
1421
1421
|
def test_should_return_a_sql_set_method_for_flag
|
1422
|
-
assert_equal "flags = flags | 1",
|
1422
|
+
assert_equal "spaceships.flags = spaceships.flags | 1",
|
1423
1423
|
Spaceship.send(:sql_set_for_flag, :warpdrive, "flags", true)
|
1424
|
-
assert_equal "flags = flags & ~1",
|
1424
|
+
assert_equal "spaceships.flags = spaceships.flags & ~1",
|
1425
1425
|
Spaceship.send(:sql_set_for_flag, :warpdrive, "flags", false)
|
1426
1426
|
end
|
1427
1427
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flag_shih_tzu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activerecord
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.6.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Bit fields for ActiveRecord
|
@@ -165,4 +165,3 @@ test_files:
|
|
165
165
|
- test/flag_shih_tzu_test.rb
|
166
166
|
- test/schema.rb
|
167
167
|
- test/test_helper.rb
|
168
|
-
has_rdoc:
|