activeasync 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.
Files changed (64) hide show
  1. data/.gitignore +10 -0
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +4 -0
  4. data/MIT-LICENSE +20 -0
  5. data/Rakefile +21 -0
  6. data/activeasync.gemspec +31 -0
  7. data/lib/active_async.rb +23 -0
  8. data/lib/active_async/active_record.rb +13 -0
  9. data/lib/active_async/async.rb +38 -0
  10. data/lib/active_async/callbacks.rb +45 -0
  11. data/lib/active_async/fake_resque.rb +9 -0
  12. data/lib/active_async/version.rb +3 -0
  13. data/spec/active_async/active_record_spec.rb +28 -0
  14. data/spec/active_async/async_spec.rb +62 -0
  15. data/spec/active_async/callbacks_spec.rb +117 -0
  16. data/spec/active_async/fake_resque_spec.rb +9 -0
  17. data/spec/active_async_spec.rb +19 -0
  18. data/spec/dummy/.gitignore +15 -0
  19. data/spec/dummy/Rakefile +7 -0
  20. data/spec/dummy/app/assets/images/rails.png +0 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/mailers/.gitkeep +0 -0
  26. data/spec/dummy/app/models/.gitkeep +0 -0
  27. data/spec/dummy/app/models/blog.rb +10 -0
  28. data/spec/dummy/app/models/post.rb +4 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +60 -0
  32. data/spec/dummy/config/boot.rb +6 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +32 -0
  36. data/spec/dummy/config/environments/production.rb +54 -0
  37. data/spec/dummy/config/environments/test.rb +37 -0
  38. data/spec/dummy/config/initializers/async.rb +2 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/inflections.rb +15 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  43. data/spec/dummy/config/initializers/session_store.rb +8 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +58 -0
  47. data/spec/dummy/db/migrate/20120126234735_create_posts.rb +10 -0
  48. data/spec/dummy/db/migrate/20120127010859_create_blogs.rb +8 -0
  49. data/spec/dummy/db/schema.rb +28 -0
  50. data/spec/dummy/db/seeds.rb +7 -0
  51. data/spec/dummy/lib/assets/.gitkeep +0 -0
  52. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  53. data/spec/dummy/log/.gitkeep +0 -0
  54. data/spec/dummy/public/404.html +26 -0
  55. data/spec/dummy/public/422.html +26 -0
  56. data/spec/dummy/public/500.html +25 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/dummy/script/rails +6 -0
  59. data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
  60. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  61. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  62. data/spec/spec_helper.rb +31 -0
  63. data/spec/support/stub_resque.rb +12 -0
  64. metadata +232 -0
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,58 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id))(.:format)'
58
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class CreateBlogs < ActiveRecord::Migration
2
+ def change
3
+ create_table :blogs do |t|
4
+ t.string :title
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20120127010859) do
14
+
15
+ create_table "blogs", :force => true do |t|
16
+ t.string "title"
17
+ t.datetime "created_at", :null => false
18
+ t.datetime "updated_at", :null => false
19
+ end
20
+
21
+ create_table "posts", :force => true do |t|
22
+ t.string "title"
23
+ t.text "body"
24
+ t.datetime "created_at", :null => false
25
+ t.datetime "updated_at", :null => false
26
+ end
27
+
28
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Mayor.create(:name => 'Emanuel', :city => cities.first)
File without changes
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
File without changes
File without changes
File without changes
@@ -0,0 +1,31 @@
1
+ dir = File.dirname(File.expand_path(__FILE__))
2
+ $LOAD_PATH.unshift dir + '/../lib'
3
+
4
+ # Configure Rails Environment
5
+ ENV["RAILS_ENV"] ||= 'test'
6
+
7
+ require 'rspec/autorun'
8
+ require 'database_cleaner'
9
+ require 'active_async'
10
+
11
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
12
+
13
+ # Load support files
14
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
+
16
+ RSpec.configure do |config|
17
+ config.mock_with :rspec
18
+
19
+ config.before(:suite) do
20
+ DatabaseCleaner.strategy = :transaction
21
+ DatabaseCleaner.clean_with(:truncation)
22
+ end
23
+
24
+ config.before(:each) do
25
+ DatabaseCleaner.start
26
+ end
27
+
28
+ config.after(:each) do
29
+ DatabaseCleaner.clean
30
+ end
31
+ end
@@ -0,0 +1,12 @@
1
+ require 'active_async/fake_resque'
2
+
3
+ RSpec.configure do |c|
4
+ c.treat_symbols_as_metadata_keys_with_true_values = true
5
+ c.before(:each, :stub_resque) do |example|
6
+ ActiveAsync.background = ActiveAsync::FakeResque
7
+ end
8
+
9
+ c.after(:each, :stub_resque) do |example|
10
+ ActiveAsync.background = Resque
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeasync
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Ross Kaffenberger
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 27
27
+ segments:
28
+ - 1
29
+ - 10
30
+ version: "1.10"
31
+ requirement: *id001
32
+ prerelease: false
33
+ name: resque
34
+ type: :runtime
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ hash: 7
42
+ segments:
43
+ - 3
44
+ - 0
45
+ version: "3.0"
46
+ requirement: *id002
47
+ prerelease: false
48
+ name: activesupport
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 7
57
+ segments:
58
+ - 3
59
+ - 0
60
+ version: "3.0"
61
+ requirement: *id003
62
+ prerelease: false
63
+ name: rails
64
+ type: :development
65
+ - !ruby/object:Gem::Dependency
66
+ version_requirements: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ hash: 47
72
+ segments:
73
+ - 2
74
+ - 8
75
+ - 0
76
+ version: 2.8.0
77
+ requirement: *id004
78
+ prerelease: false
79
+ name: rspec
80
+ type: :development
81
+ - !ruby/object:Gem::Dependency
82
+ version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ - 7
91
+ - 0
92
+ version: 0.7.0
93
+ requirement: *id005
94
+ prerelease: false
95
+ name: database_cleaner
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ version_requirements: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirement: *id006
108
+ prerelease: false
109
+ name: ruby-debug
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ version_requirements: &id007 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirement: *id007
122
+ prerelease: false
123
+ name: sqlite3
124
+ type: :development
125
+ description: "Provides async methods ruby objects for queuing background jobs. Currently supports Resque. Bonus: callback hooks for ActiveRecord objects"
126
+ email:
127
+ - rosskaff@gmail.com
128
+ executables: []
129
+
130
+ extensions: []
131
+
132
+ extra_rdoc_files: []
133
+
134
+ files:
135
+ - .gitignore
136
+ - CHANGELOG.md
137
+ - Gemfile
138
+ - MIT-LICENSE
139
+ - Rakefile
140
+ - activeasync.gemspec
141
+ - lib/active_async.rb
142
+ - lib/active_async/active_record.rb
143
+ - lib/active_async/async.rb
144
+ - lib/active_async/callbacks.rb
145
+ - lib/active_async/fake_resque.rb
146
+ - lib/active_async/version.rb
147
+ - spec/active_async/active_record_spec.rb
148
+ - spec/active_async/async_spec.rb
149
+ - spec/active_async/callbacks_spec.rb
150
+ - spec/active_async/fake_resque_spec.rb
151
+ - spec/active_async_spec.rb
152
+ - spec/dummy/.gitignore
153
+ - spec/dummy/Rakefile
154
+ - spec/dummy/app/assets/images/rails.png
155
+ - spec/dummy/app/assets/javascripts/application.js
156
+ - spec/dummy/app/assets/stylesheets/application.css
157
+ - spec/dummy/app/controllers/application_controller.rb
158
+ - spec/dummy/app/helpers/application_helper.rb
159
+ - spec/dummy/app/mailers/.gitkeep
160
+ - spec/dummy/app/models/.gitkeep
161
+ - spec/dummy/app/models/blog.rb
162
+ - spec/dummy/app/models/post.rb
163
+ - spec/dummy/app/views/layouts/application.html.erb
164
+ - spec/dummy/config.ru
165
+ - spec/dummy/config/application.rb
166
+ - spec/dummy/config/boot.rb
167
+ - spec/dummy/config/database.yml
168
+ - spec/dummy/config/environment.rb
169
+ - spec/dummy/config/environments/development.rb
170
+ - spec/dummy/config/environments/production.rb
171
+ - spec/dummy/config/environments/test.rb
172
+ - spec/dummy/config/initializers/async.rb
173
+ - spec/dummy/config/initializers/backtrace_silencers.rb
174
+ - spec/dummy/config/initializers/inflections.rb
175
+ - spec/dummy/config/initializers/mime_types.rb
176
+ - spec/dummy/config/initializers/secret_token.rb
177
+ - spec/dummy/config/initializers/session_store.rb
178
+ - spec/dummy/config/initializers/wrap_parameters.rb
179
+ - spec/dummy/config/locales/en.yml
180
+ - spec/dummy/config/routes.rb
181
+ - spec/dummy/db/migrate/20120126234735_create_posts.rb
182
+ - spec/dummy/db/migrate/20120127010859_create_blogs.rb
183
+ - spec/dummy/db/schema.rb
184
+ - spec/dummy/db/seeds.rb
185
+ - spec/dummy/lib/assets/.gitkeep
186
+ - spec/dummy/lib/tasks/.gitkeep
187
+ - spec/dummy/log/.gitkeep
188
+ - spec/dummy/public/404.html
189
+ - spec/dummy/public/422.html
190
+ - spec/dummy/public/500.html
191
+ - spec/dummy/public/favicon.ico
192
+ - spec/dummy/script/rails
193
+ - spec/dummy/vendor/assets/javascripts/.gitkeep
194
+ - spec/dummy/vendor/assets/stylesheets/.gitkeep
195
+ - spec/dummy/vendor/plugins/.gitkeep
196
+ - spec/spec_helper.rb
197
+ - spec/support/stub_resque.rb
198
+ homepage: ""
199
+ licenses: []
200
+
201
+ post_install_message:
202
+ rdoc_options: []
203
+
204
+ require_paths:
205
+ - lib
206
+ required_ruby_version: !ruby/object:Gem::Requirement
207
+ none: false
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ hash: 3
212
+ segments:
213
+ - 0
214
+ version: "0"
215
+ required_rubygems_version: !ruby/object:Gem::Requirement
216
+ none: false
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ hash: 3
221
+ segments:
222
+ - 0
223
+ version: "0"
224
+ requirements: []
225
+
226
+ rubyforge_project: activeasync
227
+ rubygems_version: 1.8.10
228
+ signing_key:
229
+ specification_version: 3
230
+ summary: Add async support to ruby objects
231
+ test_files: []
232
+