From 8060f415664ad75b08a2bf69ed6ddc4710c7e9e6 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Tue, 11 Sep 2018 17:59:12 +0100 Subject: [PATCH] Minor tweaks --- Gemfile | 5 ++++- bin/schedule | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 628ed2f..6b179a7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,10 +15,13 @@ gem 'sequel_pg' gem 'sinatra' group :development do - gem 'pry' gem 'shotgun' end +group :development, :test do + gem 'pry' +end + group :test do gem 'minitest' gem 'minitest-around' diff --git a/bin/schedule b/bin/schedule index 0a7f33d..910413f 100755 --- a/bin/schedule +++ b/bin/schedule @@ -1,12 +1,18 @@ #!/usr/bin/env ruby # frozen_string_literal: true -system 'rake db:setup' +`rake db:setup` require 'rufus-scheduler' scheduler = Rufus::Scheduler.new -scheduler.cron '*/15 15,16,17 * * 1-5', timeout: '1m' do - system 'rake rates:current' + +trap 'INT' do + scheduler.shutdown end + +scheduler.cron '*/15 15,16,17 * * 1-5' do + `rake rates:current` +end + scheduler.join