Skip to content

Commit 35cd89e

Browse files
committed
mailer and smtp settings
1 parent 2632c70 commit 35cd89e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+797
-66
lines changed

Gemfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ gem 'jbuilder', '~> 2.5'
3737
gem 'bootsnap', '>= 1.1.0', require: false
3838
gem 'devise'
3939

40-
# tailwind
41-
gem 'webpacker', '~> 4.0.0'
42-
gem 'tailwindcss', '~> 1.0.0'
40+
gem 'bootstrap-sass', '~> 3.4.1'
41+
gem 'sassc-rails', '>= 2.1.0'
42+
gem 'jquery-rails'
43+
44+
45+
46+
4347

4448
group :development, :test do
4549
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -53,6 +57,7 @@ group :development do
5357
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
5458
gem 'spring'
5559
gem 'spring-watcher-listen', '~> 2.0.0'
60+
gem 'mailcatcher'
5661
end
5762

5863
group :test do

Gemfile.lock

+54-9
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ GEM
4747
archive-zip (0.12.0)
4848
io-like (~> 0.3.0)
4949
arel (9.0.0)
50+
autoprefixer-rails (9.6.1.1)
51+
execjs
5052
bcrypt (3.1.13)
5153
bindex (0.8.1)
5254
bootsnap (1.4.4)
5355
msgpack (~> 1.0)
56+
bootstrap-sass (3.4.1)
57+
autoprefixer-rails (>= 5.2.1)
58+
sassc (>= 2.0.0)
5459
builder (3.2.3)
5560
byebug (11.0.1)
5661
capybara (3.28.0)
@@ -75,22 +80,32 @@ GEM
7580
coffee-script-source (1.12.2)
7681
concurrent-ruby (1.1.5)
7782
crass (1.0.4)
83+
daemons (1.3.1)
7884
devise (4.6.2)
7985
bcrypt (~> 3.0)
8086
orm_adapter (~> 0.1)
8187
railties (>= 4.1.0, < 6.0)
8288
responders
8389
warden (~> 1.2.3)
8490
erubi (1.8.0)
91+
eventmachine (1.2.7)
8592
execjs (2.7.0)
8693
ffi (1.11.1)
8794
globalid (0.4.2)
8895
activesupport (>= 4.2.0)
96+
haml (5.1.2)
97+
temple (>= 0.8.0)
98+
tilt
8999
i18n (1.6.0)
90100
concurrent-ruby (~> 1.0)
91101
io-like (0.3.0)
92102
jbuilder (2.9.1)
93103
activesupport (>= 4.2.0)
104+
jquery-rails (4.3.5)
105+
rails-dom-testing (>= 1, < 3)
106+
railties (>= 4.2.0)
107+
thor (>= 0.14, < 2.0)
108+
json (2.2.0)
94109
listen (3.1.5)
95110
rb-fsevent (~> 0.9, >= 0.9.4)
96111
rb-inotify (~> 0.9, >= 0.9.7)
@@ -100,6 +115,16 @@ GEM
100115
nokogiri (>= 1.5.9)
101116
mail (2.7.1)
102117
mini_mime (>= 0.1.1)
118+
mailcatcher (0.2.4)
119+
eventmachine
120+
haml
121+
i18n
122+
json
123+
mail
124+
sinatra
125+
skinny (>= 0.1.2)
126+
sqlite3-ruby
127+
thin
103128
marcel (0.3.3)
104129
mimemagic (~> 0.3.2)
105130
method_source (0.9.2)
@@ -108,14 +133,15 @@ GEM
108133
mini_portile2 (2.4.0)
109134
minitest (5.11.3)
110135
msgpack (1.3.1)
136+
mustermann (1.0.3)
111137
nio4r (2.4.0)
112138
nokogiri (1.10.4)
113139
mini_portile2 (~> 2.4.0)
114140
orm_adapter (0.5.0)
115141
public_suffix (3.1.1)
116142
puma (3.12.1)
117143
rack (2.0.7)
118-
rack-proxy (0.6.5)
144+
rack-protection (2.0.7)
119145
rack
120146
rack-test (1.1.0)
121147
rack (>= 1.0, < 3)
@@ -164,9 +190,25 @@ GEM
164190
sprockets (>= 2.8, < 4.0)
165191
sprockets-rails (>= 2.0, < 4.0)
166192
tilt (>= 1.1, < 3)
193+
sassc (2.1.0)
194+
ffi (~> 1.9)
195+
sassc-rails (2.1.2)
196+
railties (>= 4.0.0)
197+
sassc (>= 2.0)
198+
sprockets (> 3.0)
199+
sprockets-rails
200+
tilt
167201
selenium-webdriver (3.142.3)
168202
childprocess (>= 0.5, < 2.0)
169203
rubyzip (~> 1.2, >= 1.2.2)
204+
sinatra (2.0.7)
205+
mustermann (~> 1.0)
206+
rack (~> 2.0)
207+
rack-protection (= 2.0.7)
208+
tilt (~> 2.0)
209+
skinny (0.2.2)
210+
eventmachine (~> 1.0)
211+
thin
170212
spring (2.1.0)
171213
spring-watcher-listen (2.0.1)
172214
listen (>= 2.7, < 4.0)
@@ -179,8 +221,13 @@ GEM
179221
activesupport (>= 4.0)
180222
sprockets (>= 3.0.0)
181223
sqlite3 (1.4.1)
182-
tailwindcss (1.0.1)
183-
railties (>= 4.1.0, < 6.0)
224+
sqlite3-ruby (1.3.3)
225+
sqlite3 (>= 1.3.3)
226+
temple (0.8.1)
227+
thin (1.7.2)
228+
daemons (~> 1.0, >= 1.0.9)
229+
eventmachine (~> 1.0, >= 1.0.4)
230+
rack (>= 1, < 3)
184231
thor (0.20.3)
185232
thread_safe (0.3.6)
186233
tilt (2.0.9)
@@ -198,10 +245,6 @@ GEM
198245
activemodel (>= 5.0)
199246
bindex (>= 0.4.0)
200247
railties (>= 5.0)
201-
webpacker (4.0.7)
202-
activesupport (>= 4.2)
203-
rack-proxy (>= 0.6.1)
204-
railties (>= 4.2)
205248
websocket-driver (0.7.1)
206249
websocket-extensions (>= 0.1.0)
207250
websocket-extensions (0.1.4)
@@ -213,26 +256,28 @@ PLATFORMS
213256

214257
DEPENDENCIES
215258
bootsnap (>= 1.1.0)
259+
bootstrap-sass (~> 3.4.1)
216260
byebug
217261
capybara (>= 2.15)
218262
chromedriver-helper
219263
coffee-rails (~> 4.2)
220264
devise
221265
jbuilder (~> 2.5)
266+
jquery-rails
222267
listen (>= 3.0.5, < 3.2)
268+
mailcatcher
223269
puma (~> 3.11)
224270
rails (~> 5.2.3)
225271
sass-rails (~> 5.0)
272+
sassc-rails (>= 2.1.0)
226273
selenium-webdriver
227274
spring
228275
spring-watcher-listen (~> 2.0.0)
229276
sqlite3
230-
tailwindcss (~> 1.0.0)
231277
turbolinks (~> 5)
232278
tzinfo-data
233279
uglifier (>= 1.3.0)
234280
web-console (>= 3.3.0)
235-
webpacker (~> 4.0.0)
236281

237282
RUBY VERSION
238283
ruby 2.6.3p62

app/assets/javascripts/active_admin.js

Whitespace-only changes.

app/assets/javascripts/application.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
//= require activestorage
1515
//= require turbolinks
1616
//= require_tree .
17+
//= require jquery
18+
//= require bootstrap-sprockets
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SASS variable overrides must be declared before loading up Active Admin's styles.
2+
//
3+
// To view the variables that Active Admin provides, take a look at
4+
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
5+
// Active Admin source.
6+
//
7+
// For example, to change the sidebar width:
8+
// $sidebar-width: 242px;
9+
10+
// Active Admin's got SASS!
11+
12+
// Overriding any non-variable SASS must be done after the fact.
13+
// For example, to change the default status-tag color:
14+
//
15+
// .status_tag { background: #6090DB; }

app/assets/stylesheets/application.css

-15
This file was deleted.
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import "bootstrap-sprockets";
2+
@import "bootstrap";

app/controllers/homes_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ class HomesController < ApplicationController
44
def index
55
@projects = Project.where(user_id: current_user.id)
66
end
7-
87
end

app/controllers/projects_controller.rb

+6
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ def update
2020

2121
def destroy
2222
end
23+
24+
private
25+
26+
def project_params
27+
params.require(:projecs).permit(:name, :description, :contact_person_details)
28+
end
2329
end

app/controllers/sites_controller.rb

+6
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ def update
2020

2121
def destroy
2222
end
23+
24+
private
25+
26+
def sites_params
27+
params.require(:sites).permit(:title, :link)
28+
end
2329
end

app/controllers/users_controller.rb

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
class UsersController < ApplicationController
22
before_action :authenticate_user!
3-
def index
4-
end
5-
6-
def show
7-
end
8-
9-
def new
10-
end
11-
12-
def create
13-
end
143

15-
def edit
4+
def edit
165
end
176

187
def update
198
end
209

21-
def destroy
10+
private
11+
12+
def user_params
13+
params.require(:user).permit(:first_name, :last_name, :email, :company_name)
2214
end
2315
end

app/javascript/css/application.css

+1-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/javascript/css/tailwind.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
theme: {
3+
extend: {}
4+
},
5+
variants: {},
6+
plugins: []
7+
}

app/javascript/packs/application.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
// const imagePath = (name) => images(name, true)
1717

1818
console.log('Hello World from Webpacker')
19+
import '../css/application.css'

app/jobs/check_site_status_job.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class CheckSiteStatusJob < ApplicationJob
2+
require 'active_support/duration'
3+
queue_as :default
4+
5+
after_perform :run_again
6+
7+
def perform(*args)
8+
SitesStatusCheckService.check
9+
end
10+
11+
def run_again
12+
self.class.set(wait: 1.hour).perform_later
13+
end
14+
15+
end

app/mailers/application_mailer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class ApplicationMailer < ActionMailer::Base
2-
default from: 'from@example.com'
2+
default from: 'dipper@example.com'
33
layout 'mailer'
44
end

app/mailers/error_mailer.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class ErrorMailer < ApplicationMailer
2+
default form: '[email protected]'
3+
4+
def report
5+
@user = params[:user]
6+
@data = params[:data]
7+
mail(to: @user.email, subject: 'Error Report')
8+
end
9+
end

app/models/project.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Project < ApplicationRecord
2+
23
belongs_to :user
34
has_many :sites
45
end
+16-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
require 'nokogiri'
1+
require 'open-uri'
2+
require 'net/http'
3+
require 'uri'
24

35
class SitesStatusCheckService
4-
5-
def initialize(sites)
6-
@sites = sites
7-
end
8-
9-
def site_status_check
10-
@sites.each do |site|
11-
site.url #status check
12-
end
6+
def self.check
7+
Project.all.each do |project|
8+
project.sites.each do |site|
9+
uri = URI.parse(site.link)
10+
site_res = open(uri)
11+
puts site_res.status.first
12+
site.update_attributes(status: site_res.status.first, last_checked: Time.now)
13+
unless site_res.status.first.eql?('400')
14+
puts "Something is wrong with #{site.title}"
15+
ErrorMailer.with(user: site.user, data: site).report.deliver
16+
end
17+
end
18+
end
1319
end
1420
end

0 commit comments

Comments
 (0)