mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-10-29 23:32:35 +01:00
Use Rubocop
This commit is contained in:
parent
671cba3c73
commit
bb60fa8eba
2
.rubocop.yml
Normal file
2
.rubocop.yml
Normal file
@ -0,0 +1,2 @@
|
||||
Documentation:
|
||||
Enabled: false
|
@ -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 |_, _|
|
||||
|
@ -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?
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user