Skip to content
Browse files

Merge pull request #30 from wanglian/master

Fixed syntax error with ruby 1.8.7
  • Loading branch information...
2 parents 66073c9 + 0b6e246 commit 26823c7945d2ee4d8d9ee66fa457241ac9ab8ac9 @akshayrawat committed Sep 23, 2012
View
4 app/controllers/dj_mon/dj_reports_controller.rb
@@ -36,15 +36,15 @@ def settings
def retry
DjMon::Backend.retry params[:id]
respond_to do |format|
- format.html { redirect_to root_url, notice: "The job has been queued for a re-run" }
+ format.html { redirect_to root_url, :notice => "The job has been queued for a re-run" }
format.json { head(:ok) }
end
end
def destroy
DjMon::Backend.destroy params[:id]
respond_to do |format|
- format.html { redirect_to root_url, notice: "The job was deleted" }
+ format.html { redirect_to root_url, :notice => "The job was deleted" }
format.json { head(:ok) }
end
end
View
46 app/models/dj_mon/dj_report.rb
@@ -10,17 +10,17 @@ def initialize delayed_job
def as_json(options={})
{
- id: delayed_job.id,
- payload: payload(delayed_job),
- priority: delayed_job.priority,
- attempts: delayed_job.attempts,
- queue: delayed_job.queue || "global",
- last_error_summary: delayed_job.last_error.to_s.truncate(30),
- last_error: delayed_job.last_error,
- failed_at: l_datetime(delayed_job.failed_at),
- run_at: l_datetime(delayed_job.run_at),
- created_at: l_datetime(delayed_job.created_at),
- failed: delayed_job.failed_at.present?
+ :id => delayed_job.id,
+ :payload => payload(delayed_job),
+ :priority => delayed_job.priority,
+ :attempts => delayed_job.attempts,
+ :queue => delayed_job.queue || "global",
+ :last_error_summary => delayed_job.last_error.to_s.truncate(30),
+ :last_error => delayed_job.last_error,
+ :failed_at => l_datetime(delayed_job.failed_at),
+ :run_at => l_datetime(delayed_job.run_at),
+ :created_at => l_datetime(delayed_job.created_at),
+ :failed => delayed_job.failed_at.present?
}
end
@@ -51,23 +51,23 @@ def queued_reports
def dj_counts
{
- all: DjMon::Backend.all.size,
- failed: DjMon::Backend.failed.size,
- active: DjMon::Backend.active.size,
- queued: DjMon::Backend.queued.size
+ :all => DjMon::Backend.all.size,
+ :failed => DjMon::Backend.failed.size,
+ :active => DjMon::Backend.active.size,
+ :queued => DjMon::Backend.queued.size
}
end
def settings
{
- destroy_failed_jobs: Delayed::Worker.destroy_failed_jobs,
- sleep_delay: Delayed::Worker.sleep_delay,
- max_attempts: Delayed::Worker.max_attempts,
- max_run_time: Delayed::Worker.max_run_time,
- read_ahead: defined?(Delayed::Worker.read_ahead) ? Delayed::Worker.read_ahead : 5,
- delay_jobs: Delayed::Worker.delay_jobs,
- delayed_job_version: Gem.loaded_specs["delayed_job"].version.version,
- dj_mon_version: DjMon::VERSION
+ :destroy_failed_jobs => Delayed::Worker.destroy_failed_jobs,
+ :sleep_delay => Delayed::Worker.sleep_delay,
+ :max_attempts => Delayed::Worker.max_attempts,
+ :max_run_time => Delayed::Worker.max_run_time,
+ :read_ahead => defined?(Delayed::Worker.read_ahead) ? Delayed::Worker.read_ahead : 5,
+ :delay_jobs => Delayed::Worker.delay_jobs,
+ :delayed_job_version => Gem.loaded_specs["delayed_job"].version.version,
+ :dj_mon_version => DjMon::VERSION
}
end
end
View
14 app/views/dj_mon/dj_reports/index.html.haml
@@ -2,7 +2,7 @@
.lead
Delayed Jobs
.pull-right
- = link_to "Get DJ Mon for iPhone", "http://itunes.apple.com/app/dj-mon/id552732872", target: '_blank', class: 'btn btn-mini'
+ = link_to "Get DJ Mon for iPhone", "http://itunes.apple.com/app/dj-mon/id552732872", :target => '_blank', :class => 'btn btn-mini'
%ul.nav.nav-tabs
%li.active
@@ -63,11 +63,11 @@
{{#failed}}
{{failed_at}}
- = form_tag CGI.unescape(retry_dj_report_url(:id => "{{id}}")), method: :post, class: 'form-inline' do
- = submit_tag 'Retry', class: 'btn btn-info btn-mini'
+ = form_tag CGI.unescape(retry_dj_report_url(:id => "{{id}}")), :method => :post, :class => 'form-inline' do
+ = submit_tag 'Retry', :class => 'btn btn-info btn-mini'
- = form_tag CGI.unescape(dj_report_url(:id => "{{id}}")), method: :delete, class: 'form-inline' do
- = submit_tag 'Delete', class: 'btn btn-danger btn-mini'
+ = form_tag CGI.unescape(dj_report_url(:id => "{{id}}")), :method => :delete, :class => 'form-inline' do
+ = submit_tag 'Delete', :class => 'btn btn-danger btn-mini'
{{/failed}}
@@ -76,12 +76,12 @@
%script#last_error_template{ :type=> "text/x-handlebars-template" }
.modal.hide
.modal-header
- %button{ type: "button", class: "close", 'data-dismiss' => "modal" }
+ %button{ :type => "button", :class => "close", 'data-dismiss' => "modal" }
×
%h3
Last Error
.modal-body
%code
{{content}}
.modal-footer
- = link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
+ = link_to "Close", '#', :class => 'btn btn-primary', 'data-dismiss'=> 'modal'
View
8 app/views/layouts/dj_mon.html.haml
@@ -11,9 +11,9 @@
.navbar-inner
.container
.pull-left
- = link_to "DJ Mon", dj_reports_url, class: "brand"
+ = link_to "DJ Mon", dj_reports_url, :class => "brand"
.pull-right
- = link_to "Settings", "#dj_settings_template", rel: 'modal', 'data-content'=> "#{DjMon::DjReport.settings.to_json}", id: 'settings', class: 'btn btn-primary btn-mini'
+ = link_to "Settings", "#dj_settings_template", :rel => 'modal', 'data-content'=> "#{DjMon::DjReport.settings.to_json}", :id => 'settings', :class => 'btn btn-primary btn-mini'
.pull-right
#dj-counts-view
@@ -44,7 +44,7 @@
%script#dj_settings_template{ :type=> "text/x-handlebars-template" }
.modal.hide
.modal-header
- %button{ type: "button", class: "close", 'data-dismiss' => "modal" }
+ %button{ :type => "button", :class => "close", 'data-dismiss' => "modal" }
×
%h3
Settings
@@ -92,5 +92,5 @@
<code>{{content.delay_jobs}}</code>
.modal-footer
- = link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
+ = link_to "Close", '#', :class => 'btn btn-primary', 'data-dismiss'=> 'modal'
View
5 lib/dj_mon/backend.rb
@@ -14,8 +14,9 @@ def used_backend
raise "DjMon has no backend for '#{delayed_job_backend}'"
end
end
-
- delegate *BACKEND_METHODS, :to => :used_backend
+
+ BACKEND_METHODS << {:to => :used_backend}
+ delegate *BACKEND_METHODS
end
end
end
View
2 lib/dj_mon/backend/activerecord.rb
@@ -25,7 +25,7 @@ def destroy id
def retry id
dj = Delayed::Job.find(id)
- dj.update_attributes({ failed_at: nil }) if dj
+ dj.update_attribute :failed_at, nil if dj
end
end
end

0 comments on commit 26823c7

Please sign in to comment.
Something went wrong with that request. Please try again.