active-record-transactioner 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -1
  3. data/Gemfile.lock +100 -12
  4. data/README.md +86 -0
  5. data/VERSION +1 -1
  6. data/active-record-transactioner.gemspec +68 -9
  7. data/lib/active-record-transactioner.rb +143 -106
  8. data/shippable.yml +16 -0
  9. data/spec/active-record-transactioner_spec.rb +21 -21
  10. data/spec/dummy/README.rdoc +28 -0
  11. data/spec/dummy/Rakefile +6 -0
  12. data/spec/dummy/app/assets/images/.keep +0 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  16. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  17. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  18. data/spec/dummy/app/mailers/.keep +0 -0
  19. data/spec/dummy/app/models/concerns/.keep +0 -0
  20. data/spec/dummy/app/models/user.rb +2 -0
  21. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/spec/dummy/bin/bundle +3 -0
  23. data/spec/dummy/bin/rails +4 -0
  24. data/spec/dummy/bin/rake +4 -0
  25. data/spec/dummy/config.ru +4 -0
  26. data/spec/dummy/config/application.rb +28 -0
  27. data/spec/dummy/config/boot.rb +5 -0
  28. data/spec/dummy/config/database.example.yml +7 -0
  29. data/spec/dummy/config/database.shippable.yml +7 -0
  30. data/spec/dummy/config/database.yml +7 -0
  31. data/spec/dummy/config/environment.rb +5 -0
  32. data/spec/dummy/config/environments/development.rb +32 -0
  33. data/spec/dummy/config/environments/production.rb +80 -0
  34. data/spec/dummy/config/environments/test.rb +39 -0
  35. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  37. data/spec/dummy/config/initializers/inflections.rb +16 -0
  38. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  39. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  40. data/spec/dummy/config/initializers/session_store.rb +3 -0
  41. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  42. data/spec/dummy/config/locales/en.yml +23 -0
  43. data/spec/dummy/config/routes.rb +56 -0
  44. data/spec/dummy/db/migrate/20141203180942_create_users.rb +13 -0
  45. data/spec/dummy/db/schema.rb +27 -0
  46. data/spec/dummy/lib/assets/.keep +0 -0
  47. data/spec/dummy/log/.keep +0 -0
  48. data/spec/dummy/public/404.html +58 -0
  49. data/spec/dummy/public/422.html +58 -0
  50. data/spec/dummy/public/500.html +57 -0
  51. data/spec/dummy/public/favicon.ico +0 -0
  52. data/spec/models/user_spec.rb +11 -0
  53. data/spec/models/user_threadded_spec.rb +11 -0
  54. data/spec/spec_helper.rb +17 -2
  55. data/spec/support/basic_user_operations.rb +44 -0
  56. data/spec/test_classes/active-record-transactioner-test-class.rb +12 -14
  57. metadata +124 -22
  58. data/README.rdoc +0 -36
@@ -1,30 +1,28 @@
1
1
  class ActiveRecordTransactionerTestClass
2
2
  attr_reader :save_called, :args
3
-
4
- ARGS = {:nilraise => false}
5
-
3
+
4
+ ARGS = {nilraise: false}
5
+
6
6
  def initialize
7
7
  @save_called = false
8
8
  end
9
-
9
+
10
10
  def self.transaction
11
- if ActiveRecordTransactionerTestClass::ARGS[:nilraise]
12
- nilobj = nil
13
- ActiveRecordTransactionerTestClass::ARGS[:nilraise] = false
14
- nilobj.reverse
15
- end
16
-
17
11
  Thread.current[:trans] = self.name
18
-
12
+
19
13
  begin
20
14
  yield
21
15
  ensure
22
16
  Thread.current[:trans] = nil
23
17
  end
24
18
  end
25
-
26
- def save!
19
+
20
+ def save!(args = {})
27
21
  raise "Failure - no transaction: #{Thread.current[:trans]}, #{self.class.name}" if Thread.current[:trans] != self.class.name
28
22
  @save_called = true
29
23
  end
30
- end
24
+
25
+ def valid?
26
+ true
27
+ end
28
+ end
metadata CHANGED
@@ -1,83 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-record-transactioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-18 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: 4.0.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.0
26
+ version: 4.0.10
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rdoc
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ~>
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
47
  version: '3.12'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ~>
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: '3.12'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: 1.0.0
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: 1.0.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: jeweler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: 1.8.4
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 1.8.4
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: builder
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activerecord
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mysql2
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
74
130
  - !ruby/object:Gem::Version
75
131
  version: '0'
76
132
  type: :development
77
133
  prerelease: false
78
134
  version_requirements: !ruby/object:Gem::Requirement
79
135
  requirements:
80
- - - '>='
136
+ - - ">="
81
137
  - !ruby/object:Gem::Version
82
138
  version: '0'
83
139
  description: Queue up calls to specific models and execute them in transactions, after
@@ -87,20 +143,66 @@ executables: []
87
143
  extensions: []
88
144
  extra_rdoc_files:
89
145
  - LICENSE.txt
90
- - README.rdoc
146
+ - README.md
91
147
  files:
92
- - .document
93
- - .rspec
148
+ - ".document"
149
+ - ".rspec"
94
150
  - Gemfile
95
151
  - Gemfile.lock
96
152
  - LICENSE.txt
97
- - README.rdoc
153
+ - README.md
98
154
  - Rakefile
99
155
  - VERSION
100
156
  - active-record-transactioner.gemspec
101
157
  - lib/active-record-transactioner.rb
158
+ - shippable.yml
102
159
  - spec/active-record-transactioner_spec.rb
160
+ - spec/dummy/README.rdoc
161
+ - spec/dummy/Rakefile
162
+ - spec/dummy/app/assets/images/.keep
163
+ - spec/dummy/app/assets/javascripts/application.js
164
+ - spec/dummy/app/assets/stylesheets/application.css
165
+ - spec/dummy/app/controllers/application_controller.rb
166
+ - spec/dummy/app/controllers/concerns/.keep
167
+ - spec/dummy/app/helpers/application_helper.rb
168
+ - spec/dummy/app/mailers/.keep
169
+ - spec/dummy/app/models/concerns/.keep
170
+ - spec/dummy/app/models/user.rb
171
+ - spec/dummy/app/views/layouts/application.html.erb
172
+ - spec/dummy/bin/bundle
173
+ - spec/dummy/bin/rails
174
+ - spec/dummy/bin/rake
175
+ - spec/dummy/config.ru
176
+ - spec/dummy/config/application.rb
177
+ - spec/dummy/config/boot.rb
178
+ - spec/dummy/config/database.example.yml
179
+ - spec/dummy/config/database.shippable.yml
180
+ - spec/dummy/config/database.yml
181
+ - spec/dummy/config/environment.rb
182
+ - spec/dummy/config/environments/development.rb
183
+ - spec/dummy/config/environments/production.rb
184
+ - spec/dummy/config/environments/test.rb
185
+ - spec/dummy/config/initializers/backtrace_silencers.rb
186
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
187
+ - spec/dummy/config/initializers/inflections.rb
188
+ - spec/dummy/config/initializers/mime_types.rb
189
+ - spec/dummy/config/initializers/secret_token.rb
190
+ - spec/dummy/config/initializers/session_store.rb
191
+ - spec/dummy/config/initializers/wrap_parameters.rb
192
+ - spec/dummy/config/locales/en.yml
193
+ - spec/dummy/config/routes.rb
194
+ - spec/dummy/db/migrate/20141203180942_create_users.rb
195
+ - spec/dummy/db/schema.rb
196
+ - spec/dummy/lib/assets/.keep
197
+ - spec/dummy/log/.keep
198
+ - spec/dummy/public/404.html
199
+ - spec/dummy/public/422.html
200
+ - spec/dummy/public/500.html
201
+ - spec/dummy/public/favicon.ico
202
+ - spec/models/user_spec.rb
203
+ - spec/models/user_threadded_spec.rb
103
204
  - spec/spec_helper.rb
205
+ - spec/support/basic_user_operations.rb
104
206
  - spec/test_classes/active-record-transactioner-test-class.rb
105
207
  homepage: http://github.com/kaspernj/active-record-transactioner
106
208
  licenses:
@@ -112,17 +214,17 @@ require_paths:
112
214
  - lib
113
215
  required_ruby_version: !ruby/object:Gem::Requirement
114
216
  requirements:
115
- - - '>='
217
+ - - ">="
116
218
  - !ruby/object:Gem::Version
117
219
  version: '0'
118
220
  required_rubygems_version: !ruby/object:Gem::Requirement
119
221
  requirements:
120
- - - '>='
222
+ - - ">="
121
223
  - !ruby/object:Gem::Version
122
224
  version: '0'
123
225
  requirements: []
124
226
  rubyforge_project:
125
- rubygems_version: 2.0.7
227
+ rubygems_version: 2.4.0
126
228
  signing_key:
127
229
  specification_version: 4
128
230
  summary: Queue up calls to specific models and execute them in transactions, after
@@ -1,36 +0,0 @@
1
- = active-record-transactioner
2
-
3
- #Iterate a million times - will save each 1000 in a transaction with "save!".
4
- ActiveRecordTransactioner.new do |trans|
5
- models.each do |model|
6
- trans.queue(model)
7
- end
8
- end
9
-
10
- #You can also do it a bit more complicated.
11
- ActiveRecordTransactioner.new(
12
- :call_args => ["Hello world!"],
13
- :call_method => :save!,
14
- :transaction_method => :transaction,
15
- :transaction_size => 1000
16
- ) do |trans|
17
- models.each do |model|
18
- trans.queue(model)
19
- end
20
- end
21
-
22
- == Contributing to active-record-transactioner
23
-
24
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
25
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
26
- * Fork the project.
27
- * Start a feature/bugfix branch.
28
- * Commit and push until you are happy with your contribution.
29
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
30
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
31
-
32
- == Copyright
33
-
34
- Copyright (c) 2013 Kasper Johansen. See LICENSE.txt for
35
- further details.
36
-