Use Rubocop

This commit is contained in:
Hakan Ensari 2016-04-11 14:14:10 +01:00
parent 671cba3c73
commit bb60fa8eba
4 changed files with 11 additions and 9 deletions

2
.rubocop.yml Normal file
View File

@ -0,0 +1,2 @@
Documentation:
Enabled: false

View File

@ -1,5 +1,5 @@
preload_app true
worker_processes (ENV['WORKER_PROCESSES'] || 4).to_i
worker_processes((ENV['WORKER_PROCESSES'] || 4).to_i)
timeout 10
before_fork do |_, _|

View File

@ -2,15 +2,15 @@
oldrev, newrev = ARGV
def run(cmd)
exit($?.exitstatus) unless system "umask 002 && #{cmd}"
exit($CHILD_STATUS.exitstatus) unless system "umask 002 && #{cmd}"
end
run "foreman run bundle install --deployment --without development:test"
run "whenever --update-crontab"
run 'foreman run bundle install --deployment --without development:test'
run 'whenever --update-crontab'
tasks = []
num_migrations = `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`.split("\0").size
tasks << "db:migrate" if num_migrations > 0
tasks << "rates:update"
tasks << 'db:migrate' if num_migrations > 0
tasks << 'rates:update'
run "foreman run bundle exec rake #{tasks.join(" ")}" if tasks.any?

View File

@ -6,7 +6,7 @@ require 'currency'
class Quote
include Virtus.value_object
DEFAULT_BASE = 'EUR'
DEFAULT_BASE = 'EUR'.freeze
values do
attribute :base, String, default: DEFAULT_BASE
@ -53,8 +53,8 @@ class Quote
rates
end
# I'm mimicking the apparent convention of the ECB here.
# I'm mimicking the apparent convention of the ECB here.
def round_rate(rate)
Float("%.#{5}g" % rate)
Float(format('%.5g', rate))
end
end