shopapp 0.2.71 → 0.2.72
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/jobs/shopapp_monit_job.rb +6 -0
- data/app/models/concerns/panicker.rb +14 -0
- data/lib/shopapp/engine.rb +1 -0
- data/lib/shopapp/panicker_api.rb +22 -0
- data/lib/shopapp/tasks/shopapp_job_monitor.rake +20 -0
- data/lib/shopapp/templates/shopapp_rails_new.rb +2 -0
- data/shopapp.gemspec +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ae54e1c5eb7a626609491368eced9955c5c262523333f8f88522e4db83f783c
|
4
|
+
data.tar.gz: b0257160180cbbba8bffaa033521deb27294a661b6c415fbc27a92ab866ed6b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb8425b80bf13dba1d375b9d2c3cf36ed0bb786322a4897569a180e718e3eeffb5e767a59bbf1f9553b84177f7ab0e1ed74807201f44efcca8b58bcbb914392
|
7
|
+
data.tar.gz: e247a1418ef976d0201eb0890959363e4e5bc60f41a73a70e8a9645dadfeec46d7b0bb352f49baadccba506a9036c78590c7c19046081190901b990c620d5577
|
data/README.md
CHANGED
@@ -93,4 +93,4 @@ shopapp to support i18n, add two methods to your ApplicationController:
|
|
93
93
|
|
94
94
|
To build new version of this gem, change the version in shopapp.gemspec and run:
|
95
95
|
|
96
|
-
gem build shopapp.gemspec ; gem push shopapp-0.2.
|
96
|
+
gem build shopapp.gemspec ; gem push shopapp-0.2.72.gem; gem install shopapp
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'panicker_api'
|
2
|
+
|
3
|
+
module Panicker
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def message(text_to_send = '', bot: nil, target: nil, txt: nil)
|
7
|
+
txt ||= text_to_send
|
8
|
+
Rails.logger.warn "Posting for company #{code}, target: #{target}, message: #{txt}, not_markdown: true"
|
9
|
+
PanickerApi.general_message(text_to_send, bot: bot, target: target, txt: txt, company: self)
|
10
|
+
rescue
|
11
|
+
Rails.logger.error "Silently failing sending panicker a message #{txt} for company #{code}"
|
12
|
+
Rails.logger.error $!
|
13
|
+
end
|
14
|
+
end
|
data/lib/shopapp/engine.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module PanickerApi
|
4
|
+
module_function
|
5
|
+
|
6
|
+
def general_message(text_to_send = '', bot: nil, target: nil, txt: nil, company: nil)
|
7
|
+
txt ||= text_to_send
|
8
|
+
RestClient.post "https://panic.ozz.fi/shoot.json?key=#{Rails.configuration.settings['system_panic_key']}",
|
9
|
+
{
|
10
|
+
txt: txt,
|
11
|
+
target: target,
|
12
|
+
bot: bot,
|
13
|
+
not_markdown: true
|
14
|
+
}.to_json,
|
15
|
+
{
|
16
|
+
content_type: 'application/json'
|
17
|
+
}
|
18
|
+
rescue
|
19
|
+
Rails.logger.error "Silently failing sending panicker a message #{txt}."
|
20
|
+
Rails.logger.error $!
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'shopapp/panicker_api'
|
2
|
+
|
3
|
+
namespace :shopapp do
|
4
|
+
# rake shopapp:jobmonit
|
5
|
+
desc "check if jobs engine are running"
|
6
|
+
task jobmonit: :environment do
|
7
|
+
ShopappMonitJob.perform_later
|
8
|
+
sleep 15
|
9
|
+
timestamp = File.read(Rails.root.join('tmp', 'shopapp_monit_job')).to_datetime
|
10
|
+
if Time.now - timestamp > 300
|
11
|
+
PanickerApi.general_message "Background jobs delay more than 5 minutes in #{Rails.application.class.parent_name.capitalize}."
|
12
|
+
elsif Time.now - timestamp > 60
|
13
|
+
PanickerApi.general_message "Background jobs delay more than 1 minutes in #{Rails.application.class.parent_name.capitalize}."
|
14
|
+
else
|
15
|
+
puts "Jobs are executing fine."
|
16
|
+
end
|
17
|
+
rescue
|
18
|
+
PanickerApi.general_message "Background jobs error, monit file not found on #{Rails.application.class.parent_name.capitalize}."
|
19
|
+
end
|
20
|
+
end
|
@@ -71,7 +71,9 @@ generate(:model, "company", "code:string", "name:string", "info:json")
|
|
71
71
|
generate(:model, "company_state", "company:belongs_to", "code:string", "state:string")
|
72
72
|
generate('audited:install')
|
73
73
|
|
74
|
+
insert_into_file "app/models/company.rb", " has_many :application_states\n", :after => "ApplicationRecord\n"
|
74
75
|
insert_into_file "app/models/company.rb", " audited\n", :after => "ApplicationRecord\n"
|
76
|
+
insert_into_file "app/models/company.rb", " include Panicker\n", :after => "ApplicationRecord\n"
|
75
77
|
insert_into_file "app/models/company_state.rb", " audited\n", :after => "ApplicationRecord\n"
|
76
78
|
|
77
79
|
|
data/shopapp.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'shopapp'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.72'
|
4
4
|
s.date = '2019-12-14'
|
5
5
|
s.summary = 'Do a shoplift.'
|
6
6
|
s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.72
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeljko
|
@@ -422,6 +422,8 @@ files:
|
|
422
422
|
- app/helpers/shopapp3_form_helper.rb
|
423
423
|
- app/helpers/shopapp3_helper.rb
|
424
424
|
- app/helpers/shopapp_helper.rb
|
425
|
+
- app/jobs/shopapp_monit_job.rb
|
426
|
+
- app/models/concerns/panicker.rb
|
425
427
|
- app/views/layouts/_header_menu.html.haml
|
426
428
|
- app/views/shopapp/403.html.haml
|
427
429
|
- app/views/shopapp/_display_flag.haml
|
@@ -442,8 +444,10 @@ files:
|
|
442
444
|
- lib/generators/shopapp/deploy/deploy_generator.rb
|
443
445
|
- lib/shopapp.rb
|
444
446
|
- lib/shopapp/engine.rb
|
447
|
+
- lib/shopapp/panicker_api.rb
|
445
448
|
- lib/shopapp/routes.rb
|
446
449
|
- lib/shopapp/tasks/shopapp.rake
|
450
|
+
- lib/shopapp/tasks/shopapp_job_monitor.rake
|
447
451
|
- lib/shopapp/templates/shopapp_rails_new.rb
|
448
452
|
- shopapp.gemspec
|
449
453
|
homepage: http://rubygems.org/gems/shopapp
|