increment_with_sql 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -8
- data/README.md +19 -1
- data/gemfiles/4.2.gemfile +2 -3
- data/gemfiles/{4.0.gemfile → 5.1.gemfile} +2 -3
- data/lib/increment_with_sql/version.rb +1 -1
- data/lib/increment_with_sql.rb +1 -1
- metadata +4 -6
- data/gemfiles/3.2.gemfile +0 -26
- data/gemfiles/4.1.gemfile +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2ed8448f5e9cf7420642f2b41a9519dcc12c0d
|
4
|
+
data.tar.gz: 311ae3fdfae8d485c52611ae873214c9e32dd36e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dc87a9b6cf71ad028dd587bf32f0858fa65bcd509f0949c3731162d194ec355530f7acad3fa11543c1e7863dceb2c2d7db9d804fef2dd0c7666709c9df130c3
|
7
|
+
data.tar.gz: dfb8a5cb72fb34d62444bb5995280ece229063ddf8d372c3472e2851537f2f19c807ffea1cadcf3fcd0ca91032a9c4395c1e5e165972efe43dadb86159a461d6
|
data/.travis.yml
CHANGED
@@ -7,10 +7,8 @@ before_script:
|
|
7
7
|
- psql -c 'create database increment_with_sql;' -U postgres
|
8
8
|
|
9
9
|
rvm:
|
10
|
-
-
|
11
|
-
- 2.
|
12
|
-
- 2.1.1
|
13
|
-
- rbx-2
|
10
|
+
- 2.2.9
|
11
|
+
- 2.3.3
|
14
12
|
- jruby
|
15
13
|
env:
|
16
14
|
- DATABASE=sqlite
|
@@ -18,14 +16,11 @@ env:
|
|
18
16
|
- DATABASE=postgres
|
19
17
|
matrix:
|
20
18
|
allow_failures:
|
21
|
-
- rvm: rbx-2
|
22
19
|
- rvm: jruby
|
23
20
|
|
24
21
|
gemfile:
|
25
|
-
- gemfiles/3.2.gemfile
|
26
|
-
- gemfiles/4.0.gemfile
|
27
|
-
- gemfiles/4.1.gemfile
|
28
22
|
- gemfiles/4.2.gemfile
|
23
|
+
- gemfiles/5.1.gemfile
|
29
24
|
|
30
25
|
install:
|
31
26
|
- "travis_retry bundle install"
|
data/README.md
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
[](https://gemnasium.com/mrkamel/increment_with_sql)
|
5
5
|
[](http://badge.fury.io/rb/increment_with_sql)
|
6
6
|
|
7
|
-
Provides `#increment_with_sql!` and `#decrement_with_sql!` for ActiveRecord::Base
|
7
|
+
Provides `#increment_with_sql!` and `#decrement_with_sql!` for ActiveRecord::Base,
|
8
|
+
since ActiveRecord's bulti-in non-atomic `#increment` and `#decrement` methods don't
|
9
|
+
provide database consistency.
|
8
10
|
|
9
11
|
## Installation
|
10
12
|
|
@@ -22,6 +24,22 @@ Or install it yourself as:
|
|
22
24
|
|
23
25
|
$ gem install increment_with_sql
|
24
26
|
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
It's simple:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
class MyModel < ActiveRecord::Base
|
33
|
+
def increment_counter!
|
34
|
+
increment_with_sql! :counter
|
35
|
+
end
|
36
|
+
|
37
|
+
def decrement_counter!
|
38
|
+
decrement_with_sql! :counter
|
39
|
+
end
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
25
43
|
## Contributing
|
26
44
|
|
27
45
|
1. Fork it ( https://github.com/[my-github-username]/increment_with_sql/fork )
|
data/gemfiles/4.2.gemfile
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "activerecord", "~> 4.2.
|
6
|
-
gem "increment_with_sql", :path => "../"
|
5
|
+
gem "activerecord", "~> 4.2.4"
|
7
6
|
|
8
7
|
platforms :jruby do
|
9
8
|
gem "activerecord-jdbcmysql-adapter"
|
@@ -14,7 +13,7 @@ end
|
|
14
13
|
platforms :ruby do
|
15
14
|
gem "sqlite3"
|
16
15
|
gem "mysql2", "~> 0.3.20"
|
17
|
-
gem "pg"
|
16
|
+
gem "pg", '< 1.0.0'
|
18
17
|
end
|
19
18
|
|
20
19
|
platforms :rbx do
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "activerecord", "~>
|
6
|
-
gem "increment_with_sql", :path => "../"
|
5
|
+
gem "activerecord", "~> 5.1.5"
|
7
6
|
|
8
7
|
platforms :jruby do
|
9
8
|
gem "activerecord-jdbcmysql-adapter"
|
@@ -14,7 +13,7 @@ end
|
|
14
13
|
platforms :ruby do
|
15
14
|
gem "sqlite3"
|
16
15
|
gem "mysql2", "~> 0.3.20"
|
17
|
-
gem "pg"
|
16
|
+
gem "pg", '< 1.0.0'
|
18
17
|
end
|
19
18
|
|
20
19
|
platforms :rbx do
|
data/lib/increment_with_sql.rb
CHANGED
@@ -16,7 +16,7 @@ module IncrementWithSql
|
|
16
16
|
send "#{attribute}=", self.class.unscoped.where(:id => id).select(attribute).first.send(attribute)
|
17
17
|
|
18
18
|
if respond_to?(:clear_attribute_changes, true)
|
19
|
-
send :clear_attribute_changes, attribute
|
19
|
+
send :clear_attribute_changes, [attribute]
|
20
20
|
else
|
21
21
|
changed_attributes.except! attribute.to_s
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: increment_with_sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Vetter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,10 +95,8 @@ files:
|
|
95
95
|
- LICENSE.txt
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
|
-
- gemfiles/3.2.gemfile
|
99
|
-
- gemfiles/4.0.gemfile
|
100
|
-
- gemfiles/4.1.gemfile
|
101
98
|
- gemfiles/4.2.gemfile
|
99
|
+
- gemfiles/5.1.gemfile
|
102
100
|
- increment_with_sql.gemspec
|
103
101
|
- lib/increment_with_sql.rb
|
104
102
|
- lib/increment_with_sql/version.rb
|
@@ -125,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
123
|
version: '0'
|
126
124
|
requirements: []
|
127
125
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.2.
|
126
|
+
rubygems_version: 2.5.2.1
|
129
127
|
signing_key:
|
130
128
|
specification_version: 4
|
131
129
|
summary: Provides increment_with_sql! and decrement_with_sql! for ActiveRecord models
|
data/gemfiles/3.2.gemfile
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 3.2.18"
|
6
|
-
gem "increment_with_sql", :path => "../"
|
7
|
-
|
8
|
-
platforms :jruby do
|
9
|
-
gem "activerecord-jdbcmysql-adapter"
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby do
|
15
|
-
gem "sqlite3"
|
16
|
-
gem "mysql2", "~> 0.3.20"
|
17
|
-
gem "pg"
|
18
|
-
end
|
19
|
-
|
20
|
-
platforms :rbx do
|
21
|
-
gem "racc"
|
22
|
-
gem "rubysl", "~> 2.0"
|
23
|
-
gem "psych"
|
24
|
-
end
|
25
|
-
|
26
|
-
gemspec :path => "../"
|
data/gemfiles/4.1.gemfile
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.1.0.beta"
|
6
|
-
gem "increment_with_sql", :path => "../"
|
7
|
-
|
8
|
-
platforms :jruby do
|
9
|
-
gem "activerecord-jdbcmysql-adapter"
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby do
|
15
|
-
gem "sqlite3"
|
16
|
-
gem "mysql2", "~> 0.3.20"
|
17
|
-
gem "pg"
|
18
|
-
end
|
19
|
-
|
20
|
-
platforms :rbx do
|
21
|
-
gem "racc"
|
22
|
-
gem "rubysl", "~> 2.0"
|
23
|
-
gem "psych"
|
24
|
-
end
|
25
|
-
|
26
|
-
gemspec :path => "../"
|