-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
44 lines (37 loc) · 957 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
desc "Start Shoryuken worker"
task :worker do
sh 'bundle exec shoryuken -r ./workers/worker.rb -C ./workers/shoryuken.yml'
end
desc "default config task"
task :config do
require 'config_env'
ConfigEnv.path_to_config("#{__dir__}/config/config_env.rb")
end
namespace :queue do
require 'aws-sdk'
desc "Create Shoryuken queue"
task :create => [:config] do
sqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])
begin
queue = sqs.create_queue(queue_name: 'worker_bee')
puts "Queue created"
rescue => e
puts "Error creating queue: #{e}"
end
end
end
namespace :db do
require_relative 'models/word'
desc "Create words table"
task :migrate => [:config] do
begin
Word.create_table
puts 'Word table created'
rescue Aws::DynamoDB::Errors::ResourceInUseException => e
puts 'Word table already exists'
end
end
task :wipe => [:config] do
Word.all.each(&:delete)
end
end