Skip to content

Commit

Permalink
Add Sidekiq
Browse files Browse the repository at this point in the history
  • Loading branch information
manhcuongdtbk committed Nov 16, 2018
1 parent 32caaa6 commit 9ae369c
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 13 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gem "rails_admin", "~> 1.3"
gem "ransack", github: "activerecord-hackery/ransack"
gem "rolify"
gem "sass-rails", "~> 5.0"
gem "sidekiq"
gem "social-share-button"
gem "turbolinks", "~> 5"
gem "uglifier", ">= 1.3.0"
Expand Down
33 changes: 21 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/activerecord-hackery/ransack.git
revision: b411fcf699cc13a4e15c91227a51f482c32ee694
revision: 457a371dc23de078ae6fd8931d158ed6ce59397f
specs:
ransack (2.1.0)
actionpack (>= 5.0)
Expand All @@ -10,7 +10,7 @@ GIT

GIT
remote: https://github.com/stympy/faker.git
revision: f1532219a9ebc492bfdf4d0696252a6ed890f9c1
revision: f73721163f6e96e5c8078b0de6100db4ca4581f6
branch: master
specs:
faker (1.9.1)
Expand Down Expand Up @@ -85,7 +85,7 @@ GEM
builder (3.2.3)
byebug (10.0.2)
cancancan (2.3.0)
capybara (3.10.1)
capybara (3.11.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand Down Expand Up @@ -117,6 +117,7 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.3)
connection_pool (2.2.2)
crass (1.0.4)
debug_inspector (0.0.3)
devise (4.5.0)
Expand All @@ -125,8 +126,8 @@ GEM
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
devise-i18n (1.6.5)
devise (>= 4.4)
devise-i18n (1.7.0)
devise (>= 4.5)
diff-lcs (1.3)
erubi (1.7.1)
execjs (2.7.0)
Expand Down Expand Up @@ -189,7 +190,7 @@ GEM
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.1)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
Expand Down Expand Up @@ -222,13 +223,13 @@ GEM
oauth2 (~> 1.1)
omniauth (~> 1.2)
orm_adapter (0.5.0)
pagy (0.22.0)
pagy (0.23.1)
parallel (1.12.1)
paranoia (2.4.1)
activerecord (>= 4.0, < 5.3)
parser (2.5.3.0)
ast (~> 2.4.0)
popper_js (1.14.3)
popper_js (1.14.5)
powerpack (0.1.2)
public_activity (1.6.2)
actionpack (>= 3.0.0)
Expand All @@ -241,6 +242,8 @@ GEM
rack-pjax (1.0.0)
nokogiri (~> 1.5)
rack (>= 1.1)
rack-protection (2.0.4)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.1)
Expand Down Expand Up @@ -292,7 +295,8 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
regexp_parser (1.2.0)
redis (4.0.3)
regexp_parser (1.3.0)
remotipart (1.4.2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
Expand Down Expand Up @@ -341,6 +345,10 @@ GEM
rubyzip (~> 1.2, >= 1.2.2)
shoulda-matchers (4.0.0.rc1)
activesupport (>= 4.2.0)
sidekiq (5.2.3)
connection_pool (~> 2.2, >= 2.2.2)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
social-share-button (1.1.0)
coffee-rails
spring (2.0.2)
Expand All @@ -358,7 +366,7 @@ GEM
temple (0.8.0)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
thor (0.20.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.2.0)
Expand All @@ -369,8 +377,8 @@ GEM
uglifier (4.1.19)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.0)
warden (1.2.7)
rack (>= 1.0)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
Expand Down Expand Up @@ -424,6 +432,7 @@ DEPENDENCIES
sass-rails (~> 5.0)
selenium-webdriver
shoulda-matchers (= 4.0.0.rc1)
sidekiq
social-share-button
spring
spring-watcher-listen (~> 2.0.0)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/speeches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def update
def destroy
@speech.destroy
@speech.create_activity :destroy, owner: current_user
SpeechDestroyNotification.warn_user(current_user).deliver_later
flash[:success] = t ".success"
redirect_to root_url
end
Expand Down
6 changes: 6 additions & 0 deletions app/mailers/speech_destroy_notification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class SpeechDestroyNotification < ApplicationMailer
def warn_user user
@user = user
mail to: user.email, subject: t(".subject")
end
end
1 change: 1 addition & 0 deletions app/views/speech_destroy_notification/warn_user.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1><%= t ".warning_message" %></h1>
20 changes: 20 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ class Application < Rails::Application
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.

# Mailer configuration
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = {host: "localhost", port: 3000}
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "google.com",
user_name: Rails.application.credentials.mail_username,
password: Rails.application.credentials.mail_password,
authentication: "plain",
enable_starttls_auto: true
}

# Include the authenticity token in remote forms.
config.action_view.embed_authenticity_token_in_remote_forms = true

# Sidekiq adapter for Active Job
config.active_job.queue_adapter = :sidekiq
end
end
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dBhIRg2BSolPze9FA8Otomhh9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6zLqlBX/bjgAyWTCoIZYw9TQEPAz7Jl7t7mNStlYNCjNmm+IvCgtejLjUwq5l7thiQt66uYYmM4xJML5DzgEr/hu5T/8uq2IPBUtb2JMS2j9HHO0xPnG1MsXVegm0UEjhHSNo9Ml2snLgK2y3unEZUzfBpURaCXHhqdxRe+yIY4wiXHVO0r9P/ufc7qtmBic9K0HgCzf7ainWHL9xwVrIHFi4KZoi4bwMKoVvcfcco7YVXDNPkGERSjUO8--mj7K6ZZw+H3+QKcA--E7gDfYD77GWOuqHMfnb1aw==
4 changes: 4 additions & 0 deletions config/locales/controller_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ en:
relationship:
create:
info: That user doesn't exist!

speech_destroy_notification:
warn_user:
subject: Speech Destroy Warning
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ en:
author_description: Don't be scared of the truth because we need to restart the human foundation in truth...
post_date: "%{time_ago} ago"

speech_destroy_notification:
warn_user:
warning_message: "One of your speech has just been deleted. If you think this is a mistake, please contact us!"

speeches:
form:
title: Insert new title
Expand Down Expand Up @@ -116,6 +120,7 @@ en:
follow: Follow
share_friends: Share to your friends
staff: Framgia Staff
sure: "Are you sure?"

devise:
registrations:
Expand Down

0 comments on commit 9ae369c

Please sign in to comment.