governor_background 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +28 -0
- data/Gemfile.lock +163 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +91 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/app/helpers/governor_background_helper.rb +11 -0
- data/governor_background.gemspec +206 -0
- data/lib/governor_background/controllers/methods.rb +18 -0
- data/lib/governor_background/delayed/job.rb +70 -0
- data/lib/governor_background/delayed/performer.rb +13 -0
- data/lib/governor_background/handler.rb +34 -0
- data/lib/governor_background/job_manager.rb +22 -0
- data/lib/governor_background/rails.rb +8 -0
- data/lib/governor_background/resque/job.rb +51 -0
- data/lib/governor_background/resque/performer.rb +12 -0
- data/lib/governor_background/resque/performer_with_state.rb +17 -0
- data/lib/governor_background.rb +22 -0
- data/spec/governor_background/delayed/job_spec.rb +47 -0
- data/spec/governor_background/handler_spec.rb +46 -0
- data/spec/governor_background/job_manager_spec.rb +44 -0
- data/spec/governor_background/resque/performer_spec.rb +17 -0
- data/spec/governor_background/resque/performer_with_state_spec.rb +18 -0
- data/spec/governor_background_spec.rb +7 -0
- data/spec/rails_app/.gitignore +4 -0
- data/spec/rails_app/Gemfile +43 -0
- data/spec/rails_app/Gemfile.lock +128 -0
- data/spec/rails_app/README +256 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/app/controllers/home_controller.rb +2 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/helpers/home_helper.rb +2 -0
- data/spec/rails_app/app/models/article.rb +5 -0
- data/spec/rails_app/app/models/user.rb +9 -0
- data/spec/rails_app/app/views/governor/articles/index.xml.builder +5 -0
- data/spec/rails_app/app/views/home/index.html.erb +0 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +22 -0
- data/spec/rails_app/config/application.rb +42 -0
- data/spec/rails_app/config/boot.rb +14 -0
- data/spec/rails_app/config/database.yml +19 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +26 -0
- data/spec/rails_app/config/environments/production.rb +49 -0
- data/spec/rails_app/config/environments/test.rb +35 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/devise.rb +142 -0
- data/spec/rails_app/config/initializers/governor.rb +36 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/resque.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/locales/devise.en.yml +39 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/redis.yml +15 -0
- data/spec/rails_app/config/routes.rb +64 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/db/migrate/20110329032256_devise_create_users.rb +26 -0
- data/spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb +15 -0
- data/spec/rails_app/db/migrate/20110421014910_create_delayed_jobs.rb +21 -0
- data/spec/rails_app/db/schema.rb +59 -0
- data/spec/rails_app/db/seeds.rb +7 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/lib/tasks/resque.rake +2 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +26 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/javascripts/application.js +2 -0
- data/spec/rails_app/public/javascripts/controls.js +965 -0
- data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
- data/spec/rails_app/public/javascripts/effects.js +1123 -0
- data/spec/rails_app/public/javascripts/prototype.js +6001 -0
- data/spec/rails_app/public/javascripts/rails.js +191 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/script/delayed_job +5 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/spec/factories.rb +12 -0
- data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
- data/spec/spec_helper.rb +36 -0
- metadata +417 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
2
|
+
# four configuration values can also be set straight in your models.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
5
|
+
# Configure the e-mail address which will be shown in DeviseMailer.
|
6
|
+
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
7
|
+
|
8
|
+
# Configure the class responsible to send e-mails.
|
9
|
+
# config.mailer = "Devise::Mailer"
|
10
|
+
|
11
|
+
# ==> ORM configuration
|
12
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
13
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
14
|
+
# available as additional gems.
|
15
|
+
require 'devise/orm/active_record'
|
16
|
+
|
17
|
+
# ==> Configuration for any authentication mechanism
|
18
|
+
# Configure which keys are used when authenticating an user. By default is
|
19
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
20
|
+
# authenticating an user, both parameters are required. Remember that those
|
21
|
+
# parameters are used only when authenticating and not when retrieving from
|
22
|
+
# session. If you need permissions, you should implement that in a before filter.
|
23
|
+
# config.authentication_keys = [ :email ]
|
24
|
+
|
25
|
+
# Tell if authentication through request.params is enabled. True by default.
|
26
|
+
# config.params_authenticatable = true
|
27
|
+
|
28
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
29
|
+
# config.http_authenticatable = false
|
30
|
+
|
31
|
+
# Set this to true to use Basic Auth for AJAX requests. True by default.
|
32
|
+
# config.http_authenticatable_on_xhr = true
|
33
|
+
|
34
|
+
# The realm used in Http Basic Authentication
|
35
|
+
# config.http_authentication_realm = "Application"
|
36
|
+
|
37
|
+
# ==> Configuration for :database_authenticatable
|
38
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
39
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
40
|
+
config.stretches = 10
|
41
|
+
|
42
|
+
# Define which will be the encryption algorithm. Devise also supports encryptors
|
43
|
+
# from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
|
44
|
+
# you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
|
45
|
+
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
|
46
|
+
# config.encryptor = :bcrypt
|
47
|
+
|
48
|
+
# Setup a pepper to generate the encrypted password.
|
49
|
+
config.pepper = "7b3cfdcabaaa7f7270db25386499b49732a5ede1cc5f2b412d6857908aa63b7fb3ae9a993157a586cdc3edc2be8c10e661b340906268aae844be8e5037229bbf"
|
50
|
+
|
51
|
+
# ==> Configuration for :confirmable
|
52
|
+
# The time you want to give your user to confirm his account. During this time
|
53
|
+
# he will be able to access your application without confirming. Default is nil.
|
54
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
55
|
+
# You can use this to let your user access some features of your application
|
56
|
+
# without confirming the account, but blocking it after a certain period
|
57
|
+
# (ie 2 days).
|
58
|
+
# config.confirm_within = 2.days
|
59
|
+
|
60
|
+
# ==> Configuration for :rememberable
|
61
|
+
# The time the user will be remembered without asking for credentials again.
|
62
|
+
# config.remember_for = 2.weeks
|
63
|
+
|
64
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
65
|
+
# config.remember_across_browsers = true
|
66
|
+
|
67
|
+
# If true, extends the user's remember period when remembered via cookie.
|
68
|
+
# config.extend_remember_period = false
|
69
|
+
|
70
|
+
# ==> Configuration for :validatable
|
71
|
+
# Range for password length
|
72
|
+
# config.password_length = 6..20
|
73
|
+
|
74
|
+
# Regex to use to validate the email address
|
75
|
+
# config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
|
76
|
+
|
77
|
+
# ==> Configuration for :timeoutable
|
78
|
+
# The time you want to timeout the user session without activity. After this
|
79
|
+
# time the user will be asked for credentials again.
|
80
|
+
# config.timeout_in = 10.minutes
|
81
|
+
|
82
|
+
# ==> Configuration for :lockable
|
83
|
+
# Defines which strategy will be used to lock an account.
|
84
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
85
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
86
|
+
# config.lock_strategy = :failed_attempts
|
87
|
+
|
88
|
+
# Defines which strategy will be used to unlock an account.
|
89
|
+
# :email = Sends an unlock link to the user email
|
90
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
91
|
+
# :both = Enables both strategies
|
92
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
93
|
+
# config.unlock_strategy = :both
|
94
|
+
|
95
|
+
# Number of authentication tries before locking an account if lock_strategy
|
96
|
+
# is failed attempts.
|
97
|
+
# config.maximum_attempts = 20
|
98
|
+
|
99
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
100
|
+
# config.unlock_in = 1.hour
|
101
|
+
|
102
|
+
# ==> Configuration for :token_authenticatable
|
103
|
+
# Defines name of the authentication token params key
|
104
|
+
# config.token_authentication_key = :auth_token
|
105
|
+
|
106
|
+
# ==> Scopes configuration
|
107
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
108
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
109
|
+
# are using only default views.
|
110
|
+
# config.scoped_views = true
|
111
|
+
|
112
|
+
# Configure the default scope given to Warden. By default it's the first
|
113
|
+
# devise role declared in your routes.
|
114
|
+
# config.default_scope = :user
|
115
|
+
|
116
|
+
# Configure sign_out behavior.
|
117
|
+
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
|
118
|
+
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
|
119
|
+
# config.sign_out_all_scopes = false
|
120
|
+
|
121
|
+
# ==> Navigation configuration
|
122
|
+
# Lists the formats that should be treated as navigational. Formats like
|
123
|
+
# :html, should redirect to the sign in page when the user does not have
|
124
|
+
# access, but formats like :xml or :json, should return 401.
|
125
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
126
|
+
# should add them to the navigational formats lists. Default is [:html]
|
127
|
+
# config.navigational_formats = [:html, :iphone]
|
128
|
+
|
129
|
+
# ==> Warden configuration
|
130
|
+
# If you want to use other strategies, that are not (yet) supported by Devise,
|
131
|
+
# you can configure them inside the config.warden block. The example below
|
132
|
+
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
133
|
+
#
|
134
|
+
# config.warden do |manager|
|
135
|
+
# manager.oauth(:twitter) do |twitter|
|
136
|
+
# twitter.consumer_secret = <YOUR CONSUMER SECRET>
|
137
|
+
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
138
|
+
# twitter.options :site => 'http://twitter.com'
|
139
|
+
# end
|
140
|
+
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
141
|
+
# end
|
142
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Any code below will be evaluated/executed within the scope of the caller.
|
2
|
+
|
3
|
+
# How to reference the author of an article
|
4
|
+
Governor.author = Proc.new do
|
5
|
+
if respond_to?(:current_user)
|
6
|
+
current_user
|
7
|
+
else
|
8
|
+
raise "Set up Governor.author in #{File.expand_path(__FILE__)}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Rules for authorizing a particular action on a particular article
|
13
|
+
Governor.authorize_if do |action, article|
|
14
|
+
case action.to_sym
|
15
|
+
when :new, :create
|
16
|
+
if respond_to?(:user_signed_in?)
|
17
|
+
user_signed_in?
|
18
|
+
else
|
19
|
+
raise "Set up Governor.authorize_if in #{File.expand_path(__FILE__)}"
|
20
|
+
end
|
21
|
+
when :edit, :update, :destroy
|
22
|
+
article.author == instance_eval(&Governor.author)
|
23
|
+
else
|
24
|
+
raise ArgumentError.new('action must be new, create, edit, update, or destroy')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# What should Governor do if someone tries to do something they weren't
|
29
|
+
# authorized to do?
|
30
|
+
Governor.if_not_allowed do
|
31
|
+
if respond_to?(Devise)
|
32
|
+
send("authenticate_#{Devise.default_scope}!")
|
33
|
+
else
|
34
|
+
raise ArgumentError.new("Set up Governor.if_not_allowed in #{File.expand_path(__FILE__)}")
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
require 'resque/job_with_status'
|
2
|
+
Dir[File.join(Rails.root, 'app', 'jobs', '*.rb')].each { |file| require file }
|
3
|
+
config = YAML::load(File.open("#{Rails.root}/config/redis.yml"))[Rails.env]
|
4
|
+
Resque.redis = Redis.new(:host => config['host'], :port => config['port'])
|
5
|
+
Resque::Status.expire_in = (24 * 60 * 60) # 24hrs in seconds
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
RailsApp::Application.config.secret_token = 'd6de084996df9e83fe604585b22c6c574b248ab2f8396b789d01781ed9a7a249db0a4c5c88587f1c0e1b4670972a90c9e463a4510148654d33248a632c750351'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
RailsApp::Application.config.session_store :cookie_store, :key => '_rails_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# RailsApp::Application.config.session_store :active_record_store
|
@@ -0,0 +1,39 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
not_found: "not found"
|
5
|
+
already_confirmed: "was already confirmed"
|
6
|
+
not_locked: "was not locked"
|
7
|
+
|
8
|
+
devise:
|
9
|
+
failure:
|
10
|
+
unauthenticated: 'You need to sign in or sign up before continuing.'
|
11
|
+
unconfirmed: 'You have to confirm your account before continuing.'
|
12
|
+
locked: 'Your account is locked.'
|
13
|
+
invalid: 'Invalid email or password.'
|
14
|
+
invalid_token: 'Invalid authentication token.'
|
15
|
+
timeout: 'Your session expired, please sign in again to continue.'
|
16
|
+
inactive: 'Your account was not activated yet.'
|
17
|
+
sessions:
|
18
|
+
signed_in: 'Signed in successfully.'
|
19
|
+
signed_out: 'Signed out successfully.'
|
20
|
+
passwords:
|
21
|
+
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
22
|
+
updated: 'Your password was changed successfully. You are now signed in.'
|
23
|
+
confirmations:
|
24
|
+
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
25
|
+
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
26
|
+
registrations:
|
27
|
+
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
28
|
+
updated: 'You updated your account successfully.'
|
29
|
+
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
30
|
+
unlocks:
|
31
|
+
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
32
|
+
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
33
|
+
mailer:
|
34
|
+
confirmation_instructions:
|
35
|
+
subject: 'Confirmation instructions'
|
36
|
+
reset_password_instructions:
|
37
|
+
subject: 'Reset password instructions'
|
38
|
+
unlock_instructions:
|
39
|
+
subject: 'Unlock Instructions'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
RailsApp::Application.routes.draw do
|
2
|
+
root :to => 'home#index'
|
3
|
+
|
4
|
+
devise_for :users
|
5
|
+
|
6
|
+
governate :articles
|
7
|
+
|
8
|
+
# The priority is based upon order of creation:
|
9
|
+
# first created -> highest priority.
|
10
|
+
|
11
|
+
# Sample of regular route:
|
12
|
+
# match 'products/:id' => 'catalog#view'
|
13
|
+
# Keep in mind you can assign values other than :controller and :action
|
14
|
+
|
15
|
+
# Sample of named route:
|
16
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
17
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
18
|
+
|
19
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
20
|
+
# resources :products
|
21
|
+
|
22
|
+
# Sample resource route with options:
|
23
|
+
# resources :products do
|
24
|
+
# member do
|
25
|
+
# get 'short'
|
26
|
+
# post 'toggle'
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# collection do
|
30
|
+
# get 'sold'
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with sub-resources:
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments, :sales
|
37
|
+
# resource :seller
|
38
|
+
# end
|
39
|
+
|
40
|
+
# Sample resource route with more complex sub-resources
|
41
|
+
# resources :products do
|
42
|
+
# resources :comments
|
43
|
+
# resources :sales do
|
44
|
+
# get 'recent', :on => :collection
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
|
48
|
+
# Sample resource route within a namespace:
|
49
|
+
# namespace :admin do
|
50
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
51
|
+
# # (app/controllers/admin/products_controller.rb)
|
52
|
+
# resources :products
|
53
|
+
# end
|
54
|
+
|
55
|
+
# You can have the root of your site routed with "root"
|
56
|
+
# just remember to delete public/index.html.
|
57
|
+
# root :to => "welcome#index"
|
58
|
+
|
59
|
+
# See how all your routes lay out with "rake routes"
|
60
|
+
|
61
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
62
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
63
|
+
# match ':controller(/:action(/:id(.:format)))'
|
64
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:users) do |t|
|
4
|
+
t.database_authenticatable :null => false
|
5
|
+
t.recoverable
|
6
|
+
t.rememberable
|
7
|
+
t.trackable
|
8
|
+
|
9
|
+
# t.confirmable
|
10
|
+
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
11
|
+
# t.token_authenticatable
|
12
|
+
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :users, :email, :unique => true
|
18
|
+
add_index :users, :reset_password_token, :unique => true
|
19
|
+
# add_index :users, :confirmation_token, :unique => true
|
20
|
+
# add_index :users, :unlock_token, :unique => true
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.down
|
24
|
+
drop_table :users
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class GovernorCreateArticles < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :articles do |t|
|
4
|
+
t.string :title, :description
|
5
|
+
t.string :format, :default => 'default'
|
6
|
+
t.text :post
|
7
|
+
t.references :author, :polymorphic => true
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :articles
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDelayedJobs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :delayed_jobs, :force => true do |table|
|
4
|
+
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
|
5
|
+
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
|
6
|
+
table.text :handler # YAML-encoded string of the object that will do work
|
7
|
+
table.text :last_error # reason for last failure (See Note below)
|
8
|
+
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
9
|
+
table.datetime :locked_at # Set when a client is working on this object
|
10
|
+
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
11
|
+
table.string :locked_by # Who is working on this object (if locked)
|
12
|
+
table.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :delayed_jobs
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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 => 20110421014910) do
|
14
|
+
|
15
|
+
create_table "articles", :force => true do |t|
|
16
|
+
t.string "title"
|
17
|
+
t.string "description"
|
18
|
+
t.string "format", :default => "default"
|
19
|
+
t.text "post"
|
20
|
+
t.integer "author_id"
|
21
|
+
t.string "author_type"
|
22
|
+
t.datetime "created_at"
|
23
|
+
t.datetime "updated_at"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "delayed_jobs", :force => true do |t|
|
27
|
+
t.integer "priority", :default => 0
|
28
|
+
t.integer "attempts", :default => 0
|
29
|
+
t.text "handler"
|
30
|
+
t.text "last_error"
|
31
|
+
t.datetime "run_at"
|
32
|
+
t.datetime "locked_at"
|
33
|
+
t.datetime "failed_at"
|
34
|
+
t.string "locked_by"
|
35
|
+
t.datetime "created_at"
|
36
|
+
t.datetime "updated_at"
|
37
|
+
end
|
38
|
+
|
39
|
+
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
40
|
+
|
41
|
+
create_table "users", :force => true do |t|
|
42
|
+
t.string "email", :default => "", :null => false
|
43
|
+
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
44
|
+
t.string "reset_password_token"
|
45
|
+
t.string "remember_token"
|
46
|
+
t.datetime "remember_created_at"
|
47
|
+
t.integer "sign_in_count", :default => 0
|
48
|
+
t.datetime "current_sign_in_at"
|
49
|
+
t.datetime "last_sign_in_at"
|
50
|
+
t.string "current_sign_in_ip"
|
51
|
+
t.string "last_sign_in_ip"
|
52
|
+
t.datetime "created_at"
|
53
|
+
t.datetime "updated_at"
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
57
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
58
|
+
|
59
|
+
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 => 'Daley', :city => cities.first)
|
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,26 @@
|
|
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
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
Binary file
|