jaredt 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jaredt.rb +5 -0
  3. data/lib/tasks/jaredt.rake +28 -0
  4. metadata +65 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5349c02e3b4373447b6e721cefaff8d4dc9574af414a8643436dcd04c229f267
4
+ data.tar.gz: c3a5015f43b882a99333e82b0336f9560bc4a7b5dca0c193953cfdfed3123eb0
5
+ SHA512:
6
+ metadata.gz: 5ba6fb58cc6bbbb997ffb54438adb2d8be20f832a921f38d58d109fc1261e88d2b4355180fb9437b0527aade62ae9c267a5570b80ed1b04be0c224813194bd49
7
+ data.tar.gz: 33d2c2cabb59b8424ea89691fa09e92e3d0db54fe19710b198e277407e61554ee573c19f2d0f287dd38e5dcdda54b7f81c57bf2562f4d9e9eec809f05b8b8a1e
@@ -0,0 +1,5 @@
1
+ class JaredtTask < Rails::Railtie
2
+ rake_tasks do
3
+ load 'tasks/jaredt.rake'
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ def ping_home(base_url)
2
+ t1 = Thread.new do
3
+ Rails.logger.info "I'm awake! I'm awake."
4
+ Net::HTTP.get_response(URI.parse(base_url))
5
+ Rails.logger.info "I'm sorry for sleeping and for lying about it."
6
+ end
7
+ t1.join
8
+ end
9
+
10
+ namespace :jared do
11
+ desc 'This task can be called by the Heroku scheduler add-on'
12
+ task heroku: :environment do
13
+ if ENV['HEROKU_APP_NAME'].to_s.blank?
14
+ Rails.logger.info 'No Heroku app name to wake up'
15
+ else
16
+ ping_home("https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com")
17
+ end
18
+ end
19
+
20
+ desc 'This task can be called by a scheduler'
21
+ task custom: :environment do
22
+ if ENV['WAKE_UP_URL'].to_s.blank?
23
+ Rails.logger.info 'No url to wake up'
24
+ else
25
+ ping_home(ENV['WAKE_UP_URL'].to_s)
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jaredt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Guillaume Dt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6'
33
+ description: Tasks to wake up web app.
34
+ email: Deuteu@users.noreply.github.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - lib/jaredt.rb
40
+ - lib/tasks/jaredt.rake
41
+ homepage: https://github.com/Deuteu/jaredt
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.7.6
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Jared
65
+ test_files: []