procedural_transactions 0.0.1

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.
data.tar.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ V{}��i�2@�KR�b5y��>�(�0���Q��"TQ���_C���ɳ�~C~$>#
2
+ QB���a�>��o� F��b���[B�0
3
+ \���� ���ǐ6Z�I|�����l��̞9g sv��d���y�"��7��:X3A����o�v d��HL��&�]�w�3���2�%�� �L��.w�K:�ģ��i�|��b�'���V;���i�~=gk����Ť}V�б]���ᶥ�/"���|~M���
data/History.txt ADDED
@@ -0,0 +1,3 @@
1
+ Version 0.0.1 2010-10-17
2
+ - Initial release
3
+ - Rails 2 support
data/Manifest ADDED
@@ -0,0 +1,5 @@
1
+ History.txt
2
+ README.txt
3
+ Rakefile
4
+ lib/procedural_transactions.rb
5
+ Manifest
data/README.txt ADDED
@@ -0,0 +1,63 @@
1
+ = procedural_transactions
2
+
3
+ * http://github.com/jwinky/procedural_transactions
4
+
5
+ == Description:
6
+
7
+ Procedural transaction is a gem that adds methods to ActiveRecord::Base for managing transactions
8
+ procedurally (i.e. without the ActiveRecord::Base.transaction method's block syntax.)
9
+
10
+ This was written for situations where transaction control is necessary but cannot be applied
11
+ using blocks, such as in a test setup/teardown.
12
+
13
+ == Synopsis:
14
+
15
+ To start a new transaction:
16
+
17
+ ActiveRecord::Base.start_transaction
18
+
19
+ To rollback the current transaction:
20
+
21
+ ActiveRecord::Base.rollback_transaction
22
+
23
+ WARNING: These methods operate on the currently-open transaction, whether or not you started it.
24
+
25
+ == Install:
26
+
27
+ The procedural_transactions gem in hosted on Gemcutter.org
28
+
29
+ gem install procedural_transactions
30
+
31
+ In the appropriate rails environment, add:
32
+
33
+ config.gem "procedural_transactions"
34
+
35
+ == Credits:
36
+
37
+ - Justin Wienckowski (github.com/jwinky)
38
+ - Kevin Fitzpatrick (github.com/kfitzpatrick)
39
+
40
+ == License:
41
+
42
+ (The MIT License)
43
+
44
+ Copyright (c) 2010 Justin Wienckowski
45
+
46
+ Permission is hereby granted, free of charge, to any person obtaining
47
+ a copy of this software and associated documentation files (the
48
+ 'Software'), to deal in the Software without restriction, including
49
+ without limitation the rights to use, copy, modify, merge, publish,
50
+ distribute, sublicense, and/or sell copies of the Software, and to
51
+ permit persons to whom the Software is furnished to do so, subject to
52
+ the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be
55
+ included in all copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
58
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
60
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
61
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
62
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
63
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('procedural_transactions', '0.0.1') do |p|
6
+ p.description = "Procedural interface to ActiveRecord transactions."
7
+ p.summary = "Adds methods to ActiveRecord::Base to manage transactions procedurally instead of being constrained by the transaction method's block syntax."
8
+ p.url = "http://github.com/jwinky/procedural_transactions"
9
+ p.author = "Justin Wienckoski"
10
+ p.email = "jwinky @nospam@ gmail.com"
11
+ p.ignore_pattern = ["tmp/*", "script/*", ".idea"]
12
+ p.development_dependencies = []
13
+ end
14
+
@@ -0,0 +1,45 @@
1
+ require 'active_record'
2
+
3
+ module ActiveRecord::ProceduralTransactions
4
+
5
+ def self.included(base)
6
+ if Rails.version.starts_with?("2.")
7
+ base.extend Rails2
8
+ else
9
+ raise "ActiveRecord::ProceduralTransactions only supports Rails v2"
10
+ end
11
+ end
12
+
13
+ module Rails2
14
+
15
+ # Opens a new transaction on the current database connection.
16
+ #
17
+ # If a transaction is currently open, ActiveRecord will create a new, nested transaction as
18
+ # long as the underlying database supports nested transactions or savepoints.
19
+ #
20
+ # Note that SQLite before version 3 does NOT support this.
21
+ def start_transaction
22
+ if connected?
23
+ connection.increment_open_transactions
24
+ connection.transaction_joinable = false
25
+ connection.begin_db_transaction
26
+ end
27
+ end
28
+
29
+ # Roll back the currently-open transaction.
30
+ #
31
+ # NOTE: This method does NOT check that the currently open transaction is the same as the
32
+ # one opened by #start_transaction.
33
+ def rollback_transaction
34
+ return unless connected?
35
+ if connection.open_transactions != 0
36
+ connection.rollback_db_transaction
37
+ connection.decrement_open_transactions
38
+ end
39
+ clear_active_connections!
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ ActiveRecord::Base.send(:include, ActiveRecord::ProceduralTransactions)
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{procedural_transactions}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Justin Wienckoski"]
9
+ s.cert_chain = ["/Users/jwinky/Certs/gem-public_cert.pem"]
10
+ s.date = %q{2010-10-17}
11
+ s.description = %q{Procedural interface to ActiveRecord transactions.}
12
+ s.email = %q{jwinky @nospam@ gmail.com}
13
+ s.extra_rdoc_files = ["README.txt", "lib/procedural_transactions.rb"]
14
+ s.files = ["History.txt", "README.txt", "Rakefile", "lib/procedural_transactions.rb", "Manifest", "procedural_transactions.gemspec"]
15
+ s.homepage = %q{http://github.com/jwinky/procedural_transactions}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Procedural_transactions", "--main", "README.txt"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{procedural_transactions}
19
+ s.rubygems_version = %q{1.3.7}
20
+ s.signing_key = %q{/Users/jwinky/Certs/gem-private_key.pem}
21
+ s.summary = %q{Adds methods to ActiveRecord::Base to manage transactions procedurally instead of being constrained by the transaction method's block syntax.}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: procedural_transactions
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Justin Wienckoski
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain:
17
+ - |
18
+ -----BEGIN CERTIFICATE-----
19
+ MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZqd2lu
20
+ a3kxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2NvbTAe
21
+ Fw0xMDEwMTcyMDU3MjlaFw0xMTEwMTcyMDU3MjlaMD0xDzANBgNVBAMMBmp3aW5r
22
+ eTEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29tMIIB
23
+ IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0/+rT10FDDcdEv1kMBzmrpB+
24
+ ag5IIlbA7ffNNpI9ePEb76tTinjE2QV9ZlEyri4TJL5PE8s/NXqIeKmHyhBoMhKF
25
+ EUHg0uRdHhTKybRLh4V7dX2KzrOrT2CYMtx3OV4glso+DRjZQtnTBLSivRsbTv8Y
26
+ 4bDZ3htjjiyeK+mtSQWh2AFdjHiOvb+Enle4TYTtDrxIBqEkqqHeIFYMgntCHIOd
27
+ 3sUNHrGiFQtLCO41JPK9MDHiQ0kl12mLrEvaoOh/tfBaCE8Oe3vJq1CKXsFBb0S0
28
+ p2IEac20qH9qWnaDWjrmGyaxCdtIW4VCEmE7GHsuUVJP/XTk+UC0XNPtQlyqJwID
29
+ AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUhvHzGOzh
30
+ dwaYHFYSpuczMuBv9vAwDQYJKoZIhvcNAQEFBQADggEBAJaFZEiTnF9i6ZvilD+M
31
+ kx/Wx8Q8vrDTq1fLW5G3NaSvAJ5sx9sxLR8lNfPf6REZytQ/DObtDwNNo0f6y2ou
32
+ 3O6n8zLxteMM33E2Zt4wvaLDzdgOejCheH97V+dqjAMYN8N8Ddx9vdT/HWThQO1a
33
+ s82bTgQqMtNRsr9uO39CS/sEwJ8joGsg1A023xVAY3OB62WJVebZA0gy5wQGVpxZ
34
+ WDdOfFxK3zOB5DZ0+7WGcLEnHCHXI4dwTHS/zrMSQm0amM0e+Er0NFooZcdYHSZJ
35
+ E2KlEWCS6IZyYDdY9FZUN60gQPKx9PUEe5qKZ8J7Uw17i6bne1q7BdxcV+VJA0rW
36
+ Ieo=
37
+ -----END CERTIFICATE-----
38
+
39
+ date: 2010-10-17 00:00:00 -07:00
40
+ default_executable:
41
+ dependencies: []
42
+
43
+ description: Procedural interface to ActiveRecord transactions.
44
+ email: jwinky @nospam@ gmail.com
45
+ executables: []
46
+
47
+ extensions: []
48
+
49
+ extra_rdoc_files:
50
+ - README.txt
51
+ - lib/procedural_transactions.rb
52
+ files:
53
+ - History.txt
54
+ - README.txt
55
+ - Rakefile
56
+ - lib/procedural_transactions.rb
57
+ - Manifest
58
+ - procedural_transactions.gemspec
59
+ has_rdoc: true
60
+ homepage: http://github.com/jwinky/procedural_transactions
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options:
65
+ - --line-numbers
66
+ - --inline-source
67
+ - --title
68
+ - Procedural_transactions
69
+ - --main
70
+ - README.txt
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 11
88
+ segments:
89
+ - 1
90
+ - 2
91
+ version: "1.2"
92
+ requirements: []
93
+
94
+ rubyforge_project: procedural_transactions
95
+ rubygems_version: 1.3.7
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Adds methods to ActiveRecord::Base to manage transactions procedurally instead of being constrained by the transaction method's block syntax.
99
+ test_files: []
100
+
metadata.gz.sig ADDED
Binary file