Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -69,9 +69,11 @@ namespace :foodsoft do
|
|||
BankAccount.find_each do |ba|
|
||||
importer = ba.find_connector
|
||||
next unless importer
|
||||
|
||||
importer.load nil
|
||||
ok = importer.import nil
|
||||
next unless ok
|
||||
|
||||
importer.finish
|
||||
assign_count = ba.assign_unlinked_transactions
|
||||
rake_say "#{ba.name}: imported #{importer.count}, assigned #{assign_count}"
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ module Colors
|
|||
def colorize(text, color_code)
|
||||
"\033[#{color_code}m#{text}\033[0m"
|
||||
end
|
||||
|
||||
|
||||
{
|
||||
:black => 30,
|
||||
:red => 31,
|
||||
:green => 32,
|
||||
:yellow => 33,
|
||||
:blue => 34,
|
||||
:magenta => 35,
|
||||
:cyan => 36,
|
||||
:white => 37
|
||||
:black => 30,
|
||||
:red => 31,
|
||||
:green => 32,
|
||||
:yellow => 33,
|
||||
:blue => 34,
|
||||
:magenta => 35,
|
||||
:cyan => 36,
|
||||
:white => 37
|
||||
}.each do |key, color_code|
|
||||
define_method key do |text|
|
||||
colorize(text, color_code)
|
||||
|
|
@ -49,9 +49,9 @@ end
|
|||
|
||||
def setup_bundler
|
||||
puts yellow "Installing bundler if not installed..."
|
||||
%x( if [ -z `which bundle` ]; then gem install bundler --no-rdoc --no-ri; fi )
|
||||
%x(if [ -z `which bundle` ]; then gem install bundler --no-rdoc --no-ri; fi)
|
||||
puts yellow "Executing bundle install..."
|
||||
%x( bundle install )
|
||||
%x(bundle install)
|
||||
end
|
||||
|
||||
def setup_database
|
||||
|
|
@ -61,18 +61,18 @@ def setup_database
|
|||
return nil
|
||||
end
|
||||
return nil if skip?(file)
|
||||
|
||||
database = ask("What kind of database do you use?\nOptions:\n(1) MySQL\n(2) SQLite", ["1","2"])
|
||||
|
||||
database = ask("What kind of database do you use?\nOptions:\n(1) MySQL\n(2) SQLite", ["1", "2"])
|
||||
if database == "1"
|
||||
puts yellow "Using MySQL..."
|
||||
%x( cp #{Rails.root.join("#{file}.MySQL_SAMPLE")} #{Rails.root.join(file)} )
|
||||
%x(cp #{Rails.root.join("#{file}.MySQL_SAMPLE")} #{Rails.root.join(file)})
|
||||
elsif database == "2"
|
||||
puts yellow "Using SQLite..."
|
||||
%x( cp #{Rails.root.join("#{file}.SQLite_SAMPLE")} #{Rails.root.join(file)} )
|
||||
%x(cp #{Rails.root.join("#{file}.SQLite_SAMPLE")} #{Rails.root.join(file)})
|
||||
end
|
||||
|
||||
|
||||
reminder(file)
|
||||
|
||||
|
||||
puts blue "IMPORTANT: Edit (rake-generated) config/database.yml with valid username and password for EACH env before continuing!"
|
||||
finished = ask("Finished?\nOptions:\n(y) Yes", ["y"])
|
||||
if finished
|
||||
|
|
@ -86,27 +86,28 @@ def setup_app_config
|
|||
file = 'config/app_config.yml'
|
||||
sample = Rails.root.join("#{file}.SAMPLE")
|
||||
return nil if skip?(file)
|
||||
|
||||
|
||||
puts yellow "Copying #{file}..."
|
||||
%x( cp #{sample} #{Rails.root.join(file)} )
|
||||
%x(cp #{sample} #{Rails.root.join(file)})
|
||||
reminder(file)
|
||||
end
|
||||
|
||||
def setup_development
|
||||
file = 'config/environments/development.rb'
|
||||
return nil if skip?(file)
|
||||
|
||||
|
||||
puts yellow "Copying #{file}..."
|
||||
%x( cp #{Rails.root.join("#{file}.SAMPLE")} #{Rails.root.join(file)} )
|
||||
%x(cp #{Rails.root.join("#{file}.SAMPLE")} #{Rails.root.join(file)})
|
||||
reminder(file)
|
||||
end
|
||||
|
||||
def start_mailcatcher
|
||||
return nil if ENV['MAILCATCHER_PORT'] # skip when it has an existing Docker container
|
||||
mailcatcher = ask("Do you want to start mailcatcher?\nOptions:\n(y) Yes\n(n) No", ["y","n"])
|
||||
|
||||
mailcatcher = ask("Do you want to start mailcatcher?\nOptions:\n(y) Yes\n(n) No", ["y", "n"])
|
||||
if mailcatcher === "y"
|
||||
puts yellow "Starting mailcatcher at http://localhost:1080..."
|
||||
%x( mailcatcher )
|
||||
%x(mailcatcher)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ end
|
|||
|
||||
def skip?(file)
|
||||
output = false
|
||||
skip = ask(cyan("We found #{file}!\nOptions:\n(1) Skip step\n(2) Force rewrite"), ["1","2"]) if File.exists?(Rails.root.join(file))
|
||||
skip = ask(cyan("We found #{file}!\nOptions:\n(1) Skip step\n(2) Force rewrite"), ["1", "2"]) if File.exists?(Rails.root.join(file))
|
||||
output = true if skip == "1"
|
||||
output
|
||||
end
|
||||
|
|
@ -145,4 +146,3 @@ def capture_stdout
|
|||
ensure
|
||||
$stdout = STDOUT
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# for each foodcoop is used.
|
||||
|
||||
namespace :multicoops do
|
||||
|
||||
desc 'Runs a specific rake task for each registered foodcoop, use rake multicoops:run TASK=db:migrate'
|
||||
task :run => :environment do
|
||||
task_to_run = ENV['TASK']
|
||||
|
|
@ -14,7 +13,7 @@ namespace :multicoops do
|
|||
Rake::Task[task_to_run].execute
|
||||
rescue => error
|
||||
last_error = error
|
||||
ExceptionNotifier.notify_exception(error, data: {foodcoop: coop})
|
||||
ExceptionNotifier.notify_exception(error, data: { foodcoop: coop })
|
||||
end
|
||||
end
|
||||
raise last_error if last_error
|
||||
|
|
@ -27,11 +26,9 @@ namespace :multicoops do
|
|||
rake_say "Run '#{task_to_run}' for #{ENV['FOODCOOP']}"
|
||||
Rake::Task[task_to_run].execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# Helper
|
||||
def rake_say(message)
|
||||
puts message unless Rake.application.options.silent
|
||||
puts message unless Rake.application.options.silent
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ require "resque/tasks"
|
|||
|
||||
def run_worker(queue, count = 1)
|
||||
puts "Starting #{count} worker(s) with QUEUE: #{queue}"
|
||||
ops = {:pgroup => true, :err => ["log/resque_worker_foodsoft_notifier.log", "a"],
|
||||
:out => ["log/resque_worker_foodsoft_notifier.log", "a"]}
|
||||
env_vars = {"QUEUE" => queue.to_s, "PIDFILE" => "tmp/pids/resque_worker_foodsoft_notifier.pid"}
|
||||
ops = { :pgroup => true, :err => ["log/resque_worker_foodsoft_notifier.log", "a"],
|
||||
:out => ["log/resque_worker_foodsoft_notifier.log", "a"] }
|
||||
env_vars = { "QUEUE" => queue.to_s, "PIDFILE" => "tmp/pids/resque_worker_foodsoft_notifier.pid" }
|
||||
count.times {
|
||||
## Using Kernel.spawn and Process.detach because regular system() call would
|
||||
## cause the processes to quit when capistrano finishes
|
||||
|
|
@ -21,7 +21,7 @@ namespace :resque do
|
|||
Rake::Task['resque:stop_workers'].invoke
|
||||
Rake::Task['resque:start_workers'].invoke
|
||||
end
|
||||
|
||||
|
||||
desc "Quit running workers"
|
||||
task :stop_workers do
|
||||
pids = File.read('tmp/pids/resque_worker_foodsoft_notifier.pid').split("\n")
|
||||
|
|
@ -33,9 +33,9 @@ namespace :resque do
|
|||
system(syscmd)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
desc "Start workers"
|
||||
task :start_workers do
|
||||
run_worker("foodsoft_notifier")
|
||||
run_worker("foodsoft_notifier")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ begin
|
|||
|
||||
# Use `rspec` to run a single test. When a test fails in rake but not
|
||||
# with rspec, you can use the following to run a single test using rake:
|
||||
#RSpec::Core::RakeTask.new('spec:foo') do |t|
|
||||
# t.pattern = "spec/integration/foo_spec.rb"
|
||||
#end
|
||||
# RSpec::Core::RakeTask.new('spec:foo') do |t|
|
||||
# t.pattern = "spec/integration/foo_spec.rb"
|
||||
# end
|
||||
rescue LoadError
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue