From 1af691ef241cc7402b7cae69e84cbecf2617b12d Mon Sep 17 00:00:00 2001 From: Dzmitry Plashchynski Date: Sat, 14 Mar 2015 03:26:32 +0200 Subject: [PATCH] Lint web --- lib/crono/performer_proxy.rb | 2 +- .../crono/install/install_generator.rb | 4 +++- spec/web_spec.rb | 3 ++- web/views/dashboard.haml | 8 ++++---- web/views/job.haml | 7 ++++--- web/views/layout.haml | 18 +++++++++--------- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/lib/crono/performer_proxy.rb b/lib/crono/performer_proxy.rb index 2aacab2..ba370da 100644 --- a/lib/crono/performer_proxy.rb +++ b/lib/crono/performer_proxy.rb @@ -1,5 +1,5 @@ module Crono - # PerformerProxy is a proxy used in cronotab.rb semantic + # Crono::PerformerProxy is a proxy used in cronotab.rb semantic class PerformerProxy def initialize(performer, scheduler) @performer = performer diff --git a/lib/generators/crono/install/install_generator.rb b/lib/generators/crono/install/install_generator.rb index df4ff4c..75d0149 100644 --- a/lib/generators/crono/install/install_generator.rb +++ b/lib/generators/crono/install/install_generator.rb @@ -4,6 +4,7 @@ require 'rails/generators/active_record' module Crono module Generators + # rails generate crono:install class InstallGenerator < ::Rails::Generators::Base include Rails::Generators::Migration @@ -19,7 +20,8 @@ module Crono end def create_migrations - migration_template 'migrations/create_crono_jobs.rb', 'db/migrate/create_crono_jobs.rb' + migration_template 'migrations/create_crono_jobs.rb', + 'db/migrate/create_crono_jobs.rb' end end end diff --git a/spec/web_spec.rb b/spec/web_spec.rb index 46ffd89..7a5faec 100644 --- a/spec/web_spec.rb +++ b/spec/web_spec.rb @@ -39,9 +39,10 @@ describe Crono::Web do end it 'should show a message about the unhealthy job' do + message = 'An error occurs during the last execution of this job' @test_job.update(healthy: false) get "/job/#{@test_job.id}" - expect(last_response.body).to include 'An error occurs during the last execution of this job' + expect(last_response.body).to include message end end end diff --git a/web/views/dashboard.haml b/web/views/dashboard.haml index f5fb303..69f0f5e 100644 --- a/web/views/dashboard.haml +++ b/web/views/dashboard.haml @@ -8,15 +8,15 @@ %th Last performed at %th %th - - for job in @jobs + - @jobs.each do |job| %tr %td= job.job_id - %td= job.last_performed_at || "—" + %td= job.last_performed_at || '-' %td - if job.healthy == false - %a{href: url("/job/#{job.id}")} + %a{ href: url("/job/#{job.id}") } %span.label.label-danger Error %td - %a{href: url("/job/#{job.id}")} + %a{ href: url("/job/#{job.id}") } Log %span.glyphicon.glyphicon-menu-right diff --git a/web/views/job.haml b/web/views/job.haml index 9dc8fcd..1b70c68 100644 --- a/web/views/job.haml +++ b/web/views/job.haml @@ -1,13 +1,14 @@ %ol.breadcrumb %li - %a{href: url("/")} Home + %a{ href: url('/') } Home %li.active= @job.job_id %h2 "#{@job.job_id}" Log: - if @job.healthy == false - .alert.alert-danger{role: "alert"} - An error occurs during the last execution of this job. Check the log below for details. + .alert.alert-danger{ role: 'alert' } + An error occurs during the last execution of this job. + Check the log below for details. %pre= @job.log diff --git a/web/views/layout.haml b/web/views/layout.haml index e262f3e..8d092eb 100644 --- a/web/views/layout.haml +++ b/web/views/layout.haml @@ -1,15 +1,15 @@ !!! 5 -%html{lang: "en"} +%html{ lang: 'en' } %head - %meta{charset: "utf-8"} - %meta{"http-equiv" => "X-UA-Compatible", content: "IE=edge"} - %meta{name: "viewport", content: "width=device-width, initial-scale=1"} + %meta{ charset: 'utf-8' } + %meta{ 'http-equiv' => 'X-UA-Compatible', content: 'IE=edge' } + %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' } %title Crono Dashboard - %link{href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css", rel: "stylesheet"} - %link{href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css", rel: "stylesheet"} - %link{href: "#{env['SCRIPT_NAME']}/custom.css", rel: "stylesheet"} + %link{ href: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css', rel: 'stylesheet' } + %link{ href: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css', rel: 'stylesheet' } + %link{ href: "#{env['SCRIPT_NAME']}/custom.css", rel: 'stylesheet' } %body %br @@ -21,5 +21,5 @@ %small Dashboard = yield - %script{src: "https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"} - %script{src: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"} + %script{ src: 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js' } + %script{ src: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js' }