Sha256: c4580b84810a2676d5b5e993bb4a0786d9d79920ec0f1aedb11c5d9b0aa0a407
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module ClockworkWeb class HomeController < ActionController::Base layout false helper ClockworkWeb::HomeHelper http_basic_authenticate_with name: ENV["CLOCKWORK_USERNAME"], password: ENV["CLOCKWORK_PASSWORD"] if ENV["CLOCKWORK_PASSWORD"] def index @events = Clockwork.manager.instance_variable_get(:@events).sort_by do |e| at = e.instance_variable_get(:@at) [ e.instance_variable_get(:@period), (at && at.instance_variable_get(:@hour)) || -1, (at && at.instance_variable_get(:@min)) || -1, e.job.to_s ] end @last_run = {} @disabled = {} if ClockworkWeb.redis keys = @events.flat_map{|e| ["clockwork:last_run:#{e.job}", "clockwork:disabled:#{e.job}"] } values = ClockworkWeb.redis.mget(keys) @events.each_with_index do |event, i| @last_run[event.job] = values[i * 2] @disabled[event.job] = values[i * 2 + 1] end end end def job job = params[:job] if params[:enable] == "true" ClockworkWeb.enable(job) else ClockworkWeb.disable(job) end redirect_to root_path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clockwork_web-0.0.2 | app/controllers/clockwork_web/home_controller.rb |