ar_after_transaction 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +7 -0
- data/Gemfile +6 -6
- data/Gemfile.lock +26 -16
- data/Rakefile +9 -4
- data/Readme.md +4 -5
- data/ar_after_transaction.gemspec +1 -0
- data/gemfiles/rails2.gemfile +11 -0
- data/gemfiles/rails2.gemfile.lock +37 -0
- data/gemfiles/rails3.gemfile +11 -0
- data/gemfiles/rails3.gemfile.lock +50 -0
- data/lib/ar_after_transaction/version.rb +1 -1
- data/lib/ar_after_transaction.rb +1 -0
- data/spec/ar_after_transaction_spec.rb +1 -1
- data/spec/setup_database.rb +4 -3
- data/spec/spec_helper.rb +2 -4
- metadata +53 -30
- data/init.rb +0 -1
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ar_after_transaction (0.2.5)
|
5
|
+
activerecord
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: http://rubygems.org/
|
3
9
|
specs:
|
4
|
-
activemodel (3.
|
5
|
-
activesupport (= 3.
|
10
|
+
activemodel (3.2.8)
|
11
|
+
activesupport (= 3.2.8)
|
6
12
|
builder (~> 3.0.0)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
arel (~> 2.2.1)
|
13
|
+
activerecord (3.2.8)
|
14
|
+
activemodel (= 3.2.8)
|
15
|
+
activesupport (= 3.2.8)
|
16
|
+
arel (~> 3.0.2)
|
12
17
|
tzinfo (~> 0.3.29)
|
13
|
-
activesupport (3.
|
18
|
+
activesupport (3.2.8)
|
19
|
+
i18n (~> 0.6)
|
14
20
|
multi_json (~> 1.0)
|
15
|
-
|
16
|
-
|
21
|
+
appraisal (0.4.1)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
arel (3.0.2)
|
25
|
+
builder (3.0.4)
|
17
26
|
diff-lcs (1.1.3)
|
18
|
-
i18n (0.6.
|
19
|
-
multi_json (1.
|
20
|
-
mysql (2.8.1)
|
27
|
+
i18n (0.6.1)
|
28
|
+
multi_json (1.3.6)
|
21
29
|
rake (0.9.2.2)
|
22
30
|
rspec (2.8.0)
|
23
31
|
rspec-core (~> 2.8.0)
|
@@ -27,13 +35,15 @@ GEM
|
|
27
35
|
rspec-expectations (2.8.0)
|
28
36
|
diff-lcs (~> 1.1.2)
|
29
37
|
rspec-mocks (2.8.0)
|
30
|
-
|
38
|
+
sqlite3 (1.3.6)
|
39
|
+
tzinfo (0.3.33)
|
31
40
|
|
32
41
|
PLATFORMS
|
33
42
|
ruby
|
34
43
|
|
35
44
|
DEPENDENCIES
|
36
|
-
|
37
|
-
|
45
|
+
appraisal
|
46
|
+
ar_after_transaction!
|
38
47
|
rake
|
39
48
|
rspec (~> 2)
|
49
|
+
sqlite3
|
data/Rakefile
CHANGED
@@ -1,22 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "appraisal"
|
4
|
+
|
2
5
|
|
3
6
|
task :spec do
|
4
7
|
sh "rspec spec"
|
5
8
|
end
|
6
9
|
|
7
10
|
task :default do
|
8
|
-
sh "
|
9
|
-
sh "RAILS='~>3' && (bundle || bundle install) && bundle exec rake spec"
|
11
|
+
sh "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
|
10
12
|
end
|
11
13
|
|
14
|
+
# extracted from https://github.com/grosser/project_template
|
12
15
|
rule /^version:bump:.*/ do |t|
|
13
16
|
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
|
14
17
|
index = ['major', 'minor','patch'].index(t.name.split(':').last)
|
15
|
-
file = 'lib/
|
18
|
+
file = 'lib/ar_after_transaction/version.rb'
|
16
19
|
|
17
20
|
version_file = File.read(file)
|
18
21
|
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
|
19
22
|
version_parts[index] = version_parts[index].to_i + 1
|
23
|
+
version_parts[2] = 0 if index < 2 # remove patch for minor
|
24
|
+
version_parts[1] = 0 if index < 1 # remove minor for major
|
20
25
|
new_version = version_parts * '.'
|
21
26
|
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
22
27
|
|
data/Readme.md
CHANGED
@@ -4,8 +4,7 @@ Normally everything gets rolled back when a transaction fails, but you cannot ro
|
|
4
4
|
|
5
5
|
Install
|
6
6
|
=======
|
7
|
-
|
8
|
-
or
|
7
|
+
|
9
8
|
gem install ar_after_transaction
|
10
9
|
|
11
10
|
|
@@ -59,10 +58,10 @@ If you use transactional fixtures you should change it in test mode.
|
|
59
58
|
|
60
59
|
Alternative
|
61
60
|
===========
|
62
|
-
[after_commit](https://github.com/
|
61
|
+
[after_commit](https://github.com/pat/after_commit)<br/>
|
63
62
|
+ threadsafe<br/>
|
64
|
-
+ more fine-grained
|
65
|
-
-
|
63
|
+
+ more fine-grained callbacks (before_commit, `after_commit`, before_rollback, after_rollback)<br/>
|
64
|
+
- doesn't let you define `after_transaction` callbacks *anywhere* like `ar_after_transaction` does (*outside* of the `after_commit`, etc. callbacks which only happen at certain points in the model's life cycle)<br/>
|
66
65
|
- more complex<br/>
|
67
66
|
|
68
67
|
Authors
|
@@ -0,0 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mgrosser/code/tools/ar_after_transaction
|
3
|
+
specs:
|
4
|
+
ar_after_transaction (0.2.4)
|
5
|
+
activerecord
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activerecord (2.3.14)
|
11
|
+
activesupport (= 2.3.14)
|
12
|
+
activesupport (2.3.14)
|
13
|
+
appraisal (0.4.1)
|
14
|
+
bundler
|
15
|
+
rake
|
16
|
+
diff-lcs (1.1.3)
|
17
|
+
rake (0.9.2.2)
|
18
|
+
rspec (2.11.0)
|
19
|
+
rspec-core (~> 2.11.0)
|
20
|
+
rspec-expectations (~> 2.11.0)
|
21
|
+
rspec-mocks (~> 2.11.0)
|
22
|
+
rspec-core (2.11.1)
|
23
|
+
rspec-expectations (2.11.3)
|
24
|
+
diff-lcs (~> 1.1.3)
|
25
|
+
rspec-mocks (2.11.3)
|
26
|
+
sqlite3 (1.3.6)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
activerecord (~> 2.3.14)
|
33
|
+
appraisal
|
34
|
+
ar_after_transaction!
|
35
|
+
rake
|
36
|
+
rspec (~> 2)
|
37
|
+
sqlite3
|
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mgrosser/code/tools/ar_after_transaction
|
3
|
+
specs:
|
4
|
+
ar_after_transaction (0.2.4)
|
5
|
+
activerecord
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (3.2.8)
|
11
|
+
activesupport (= 3.2.8)
|
12
|
+
builder (~> 3.0.0)
|
13
|
+
activerecord (3.2.8)
|
14
|
+
activemodel (= 3.2.8)
|
15
|
+
activesupport (= 3.2.8)
|
16
|
+
arel (~> 3.0.2)
|
17
|
+
tzinfo (~> 0.3.29)
|
18
|
+
activesupport (3.2.8)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
multi_json (~> 1.0)
|
21
|
+
appraisal (0.4.1)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
arel (3.0.2)
|
25
|
+
builder (3.0.4)
|
26
|
+
diff-lcs (1.1.3)
|
27
|
+
i18n (0.6.1)
|
28
|
+
multi_json (1.3.6)
|
29
|
+
rake (0.9.2.2)
|
30
|
+
rspec (2.11.0)
|
31
|
+
rspec-core (~> 2.11.0)
|
32
|
+
rspec-expectations (~> 2.11.0)
|
33
|
+
rspec-mocks (~> 2.11.0)
|
34
|
+
rspec-core (2.11.1)
|
35
|
+
rspec-expectations (2.11.3)
|
36
|
+
diff-lcs (~> 1.1.3)
|
37
|
+
rspec-mocks (2.11.3)
|
38
|
+
sqlite3 (1.3.6)
|
39
|
+
tzinfo (0.3.33)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
activerecord (~> 3.2.7)
|
46
|
+
appraisal
|
47
|
+
ar_after_transaction!
|
48
|
+
rake
|
49
|
+
rspec (~> 2)
|
50
|
+
sqlite3
|
data/lib/ar_after_transaction.rb
CHANGED
data/spec/setup_database.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
ActiveRecord::Base.establish_connection(
|
2
|
-
:adapter
|
3
|
-
:database =>
|
2
|
+
:adapter => 'sqlite3',
|
3
|
+
:database => ':memory:'
|
4
4
|
)
|
5
5
|
|
6
|
-
ActiveRecord::
|
6
|
+
ActiveRecord::Migration.verbose = false
|
7
7
|
ActiveRecord::Schema.define(:version => 1) do
|
8
8
|
create_table :users do |t|
|
9
9
|
t.string :name
|
@@ -11,6 +11,7 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
# for detailed debugging:
|
14
15
|
#require 'logger'
|
15
16
|
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
16
17
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,92 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_after_transaction
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Michael Grosser
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-10-20 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: activerecord
|
16
|
-
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
23
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
22
31
|
type: :runtime
|
32
|
+
requirement: *id001
|
23
33
|
prerelease: false
|
24
|
-
version_requirements: *73628820
|
25
34
|
description:
|
26
35
|
email: michael@grosser.it
|
27
36
|
executables: []
|
37
|
+
|
28
38
|
extensions: []
|
39
|
+
|
29
40
|
extra_rdoc_files: []
|
30
|
-
|
41
|
+
|
42
|
+
files:
|
43
|
+
- Appraisals
|
31
44
|
- Gemfile
|
32
45
|
- Gemfile.lock
|
33
46
|
- Rakefile
|
34
47
|
- Readme.md
|
35
48
|
- ar_after_transaction.gemspec
|
36
|
-
-
|
49
|
+
- gemfiles/rails2.gemfile
|
50
|
+
- gemfiles/rails2.gemfile.lock
|
51
|
+
- gemfiles/rails3.gemfile
|
52
|
+
- gemfiles/rails3.gemfile.lock
|
37
53
|
- lib/ar_after_transaction.rb
|
38
54
|
- lib/ar_after_transaction/version.rb
|
39
55
|
- spec/ar_after_transaction_spec.rb
|
40
56
|
- spec/setup_database.rb
|
41
57
|
- spec/spec_helper.rb
|
42
58
|
homepage: http://github.com/grosser/ar_after_transaction
|
43
|
-
licenses:
|
59
|
+
licenses:
|
60
|
+
- MIT
|
44
61
|
post_install_message:
|
45
62
|
rdoc_options: []
|
46
|
-
|
63
|
+
|
64
|
+
require_paths:
|
47
65
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
67
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
segments:
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
55
73
|
- 0
|
56
|
-
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
76
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
63
84
|
requirements: []
|
85
|
+
|
64
86
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.8.
|
87
|
+
rubygems_version: 1.8.24
|
66
88
|
signing_key:
|
67
89
|
specification_version: 3
|
68
90
|
summary: Execute irreversible actions only when transactions are not rolled back
|
69
91
|
test_files: []
|
92
|
+
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'ar_after_transaction'
|