ar_after_transaction 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - ree
3
+ - 1.9.2
4
+ - 1.9.3
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source :rubygems
3
3
  gemspec
4
4
 
5
5
  gem 'appraisal'
6
+ gem 'bump'
6
7
  gem 'rake'
7
8
  gem 'rspec', '~>2'
8
9
  gem 'sqlite3'
data/Gemfile.lock CHANGED
@@ -1,42 +1,43 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ar_after_transaction (0.2.5)
4
+ ar_after_transaction (0.2.6)
5
5
  activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.8)
11
- activesupport (= 3.2.8)
10
+ activemodel (3.2.9)
11
+ activesupport (= 3.2.9)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.8)
14
- activemodel (= 3.2.8)
15
- activesupport (= 3.2.8)
13
+ activerecord (3.2.9)
14
+ activemodel (= 3.2.9)
15
+ activesupport (= 3.2.9)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.8)
18
+ activesupport (3.2.9)
19
19
  i18n (~> 0.6)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.4.1)
21
+ appraisal (0.5.1)
22
22
  bundler
23
23
  rake
24
24
  arel (3.0.2)
25
25
  builder (3.0.4)
26
+ bump (0.3.5)
26
27
  diff-lcs (1.1.3)
27
28
  i18n (0.6.1)
28
- multi_json (1.3.6)
29
- rake (0.9.2.2)
30
- rspec (2.8.0)
31
- rspec-core (~> 2.8.0)
32
- rspec-expectations (~> 2.8.0)
33
- rspec-mocks (~> 2.8.0)
34
- rspec-core (2.8.0)
35
- rspec-expectations (2.8.0)
36
- diff-lcs (~> 1.1.2)
37
- rspec-mocks (2.8.0)
29
+ multi_json (1.3.7)
30
+ rake (10.0.2)
31
+ rspec (2.12.0)
32
+ rspec-core (~> 2.12.0)
33
+ rspec-expectations (~> 2.12.0)
34
+ rspec-mocks (~> 2.12.0)
35
+ rspec-core (2.12.0)
36
+ rspec-expectations (2.12.0)
37
+ diff-lcs (~> 1.1.3)
38
+ rspec-mocks (2.12.0)
38
39
  sqlite3 (1.3.6)
39
- tzinfo (0.3.33)
40
+ tzinfo (0.3.35)
40
41
 
41
42
  PLATFORMS
42
43
  ruby
@@ -44,6 +45,7 @@ PLATFORMS
44
45
  DEPENDENCIES
45
46
  appraisal
46
47
  ar_after_transaction!
48
+ bump
47
49
  rake
48
50
  rspec (~> 2)
49
51
  sqlite3
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bundler/setup"
2
2
  require "bundler/gem_tasks"
3
3
  require "appraisal"
4
+ require "bump/tasks"
4
5
 
5
6
 
6
7
  task :spec do
@@ -10,20 +11,3 @@ end
10
11
  task :default do
11
12
  sh "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
12
13
  end
13
-
14
- # extracted from https://github.com/grosser/project_template
15
- rule /^version:bump:.*/ do |t|
16
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
17
- index = ['major', 'minor','patch'].index(t.name.split(':').last)
18
- file = 'lib/ar_after_transaction/version.rb'
19
-
20
- version_file = File.read(file)
21
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
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
25
- new_version = version_parts * '.'
26
- File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
27
-
28
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
29
- end
data/Readme.md CHANGED
@@ -58,11 +58,16 @@ If you use transactional fixtures you should change it in test mode.
58
58
 
59
59
  Alternative
60
60
  ===========
61
+ Rails 3+
62
+ - basic support is built in, use it if you can!
63
+ - `after_commit :foo`
64
+ - `after_commit :bar, :on => :create / :update`
65
+
61
66
  [after_commit](https://github.com/pat/after_commit)<br/>
62
- + threadsafe<br/>
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/>
65
- - more complex<br/>
67
+ - pro: threadsafe<br/>
68
+ - pro: more fine-grained callbacks (before_commit, `after_commit`, before_rollback, after_rollback)<br/>
69
+ - con: 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/>
70
+ - con: more complex<br/>
66
71
 
67
72
  Authors
68
73
  =======
@@ -71,7 +76,10 @@ Authors
71
76
  ### [Contributors](http://github.com/grosser/ar_after_transaction/contributors)
72
77
  - [Bogdan Gusiev](http://gusiev.com)
73
78
  - [Benedikt Deicke](http://blog.synatic.net)
79
+ - [Tyler Rick](https://github.com/TylerRick)
74
80
 
75
81
  [Michael Grosser](http://grosser.it)<br/>
76
82
  michael@grosser.it<br/>
77
- Hereby placed under public domain, do what you want, just do not hold me accountable...
83
+ License: MIT<br/>
84
+ [![Build Status](https://travis-ci.org/grosser/ar_after_transaction.png)](https://travis-ci.org/grosser/ar_after_transaction)
85
+
@@ -3,6 +3,7 @@
3
3
  source :rubygems
4
4
 
5
5
  gem "appraisal"
6
+ gem "bump"
6
7
  gem "rake"
7
8
  gem "rspec", "~>2"
8
9
  gem "sqlite3"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/ar_after_transaction
3
3
  specs:
4
- ar_after_transaction (0.2.4)
4
+ ar_after_transaction (0.2.5)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -13,6 +13,7 @@ GEM
13
13
  appraisal (0.4.1)
14
14
  bundler
15
15
  rake
16
+ bump (0.3.5)
16
17
  diff-lcs (1.1.3)
17
18
  rake (0.9.2.2)
18
19
  rspec (2.11.0)
@@ -32,6 +33,7 @@ DEPENDENCIES
32
33
  activerecord (~> 2.3.14)
33
34
  appraisal
34
35
  ar_after_transaction!
36
+ bump
35
37
  rake
36
38
  rspec (~> 2)
37
39
  sqlite3
@@ -3,6 +3,7 @@
3
3
  source :rubygems
4
4
 
5
5
  gem "appraisal"
6
+ gem "bump"
6
7
  gem "rake"
7
8
  gem "rspec", "~>2"
8
9
  gem "sqlite3"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/ar_after_transaction
3
3
  specs:
4
- ar_after_transaction (0.2.4)
4
+ ar_after_transaction (0.2.5)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -23,6 +23,7 @@ GEM
23
23
  rake
24
24
  arel (3.0.2)
25
25
  builder (3.0.4)
26
+ bump (0.3.5)
26
27
  diff-lcs (1.1.3)
27
28
  i18n (0.6.1)
28
29
  multi_json (1.3.6)
@@ -45,6 +46,7 @@ DEPENDENCIES
45
46
  activerecord (~> 3.2.7)
46
47
  appraisal
47
48
  ar_after_transaction!
49
+ bump
48
50
  rake
49
51
  rspec (~> 2)
50
52
  sqlite3
@@ -2,10 +2,6 @@ require 'active_record'
2
2
  require 'ar_after_transaction/version'
3
3
 
4
4
  module ARAfterTransaction
5
- def self.included(base)
6
- base.extend(ClassMethods)
7
- end
8
-
9
5
  module ClassMethods
10
6
  @@after_transaction_callbacks = []
11
7
 
@@ -51,9 +47,12 @@ module ARAfterTransaction
51
47
  end
52
48
  end
53
49
 
54
- def after_transaction(&block)
55
- self.class.after_transaction(&block)
50
+ module InstanceMethods
51
+ def after_transaction(&block)
52
+ self.class.after_transaction(&block)
53
+ end
56
54
  end
57
55
  end
58
56
 
59
- ActiveRecord::Base.send(:include, ARAfterTransaction)
57
+ ActiveRecord::Base.send(:extend, ARAfterTransaction::ClassMethods)
58
+ ActiveRecord::Base.send(:include, ARAfterTransaction::InstanceMethods)
@@ -1,3 +1,3 @@
1
1
  module ARAfterTransaction
2
- VERSION = Version = '0.2.5'
2
+ VERSION = Version = '0.2.6'
3
3
  end
@@ -119,3 +119,10 @@ describe ARAfterTransaction do
119
119
  end
120
120
  end
121
121
  end
122
+
123
+ describe "A normal ActiveRecord subclass" do
124
+ it "does not get polluted" do
125
+ User.const_defined?(:VERSION).should be_false
126
+ User.const_defined?(:Version).should be_false
127
+ end
128
+ end
metadata CHANGED
@@ -1,45 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ar_after_transaction
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 5
10
- version: 0.2.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Grosser
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-10-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: activerecord
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :runtime
32
- requirement: *id001
33
23
  prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
34
30
  description:
35
31
  email: michael@grosser.it
36
32
  executables: []
37
-
38
33
  extensions: []
39
-
40
34
  extra_rdoc_files: []
41
-
42
- files:
35
+ files:
36
+ - .travis.yml
43
37
  - Appraisals
44
38
  - Gemfile
45
39
  - Gemfile.lock
@@ -56,37 +50,34 @@ files:
56
50
  - spec/setup_database.rb
57
51
  - spec/spec_helper.rb
58
52
  homepage: http://github.com/grosser/ar_after_transaction
59
- licenses:
53
+ licenses:
60
54
  - MIT
61
55
  post_install_message:
62
56
  rdoc_options: []
63
-
64
- require_paths:
57
+ require_paths:
65
58
  - lib
66
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
67
60
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ segments:
73
66
  - 0
74
- version: "0"
75
- required_rubygems_version: !ruby/object:Gem::Requirement
67
+ hash: 3939892965249242623
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
69
  none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- hash: 3
81
- segments:
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ segments:
82
75
  - 0
83
- version: "0"
76
+ hash: 3939892965249242623
84
77
  requirements: []
85
-
86
78
  rubyforge_project:
87
79
  rubygems_version: 1.8.24
88
80
  signing_key:
89
81
  specification_version: 3
90
82
  summary: Execute irreversible actions only when transactions are not rolled back
91
83
  test_files: []
92
-