Better binaries

sites
aeris 2017-04-11 13:01:22 +02:00
parent 4a8876214c
commit 88c4151328
5 changed files with 47 additions and 30 deletions

View File

@ -1,10 +0,0 @@
#!/usr/bin/env ruby
require 'sidekiq'
options = {
url: ENV['REDIS_URL'],
namespace: :cryptcheck
}
client = Sidekiq::Client.new Sidekiq::RedisConnection.create options
clazz, *args = ARGV
clazz += 'Worker'
client.push({ 'class' => clazz, 'args' => args })

1
bin/enqueue 120000
View File

@ -0,0 +1 @@
runner

22
bin/enqueue.rb 100755
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ruby
ENV['RAILS_ENV'] ||= 'development'
require 'dotenv'
Dotenv.load ".env.#{ENV['RAILS_ENV']}", '.env'
if ENV['RAILS_ENV'] == 'development'
DIR = File.dirname File.dirname File.expand_path __FILE__
require File.join DIR, 'config/environment'
ENV['RAILS_ENV'] = 'test'
require 'sidekiq/testing/inline'
end
require 'sidekiq'
options = {
url: ENV['REDIS_URL'],
namespace: :cryptcheck
}
client = Sidekiq::Client.new Sidekiq::RedisConnection.create options
clazz, *args = ARGV
clazz += 'Worker'
client.push({ 'class' => clazz, 'args' => args })

3
bin/runner 100755
View File

@ -0,0 +1,3 @@
#!/bin/bash
DIR="$(readlink -m "$(dirname "$0")")"
LD_LIBRARY_PATH="${DIR}/../../cryptcheck/lib" "${0}.rb" $*

View File

@ -1,20 +0,0 @@
#!/usr/bin/env ruby
$:.unshift File.expand_path File.join File.dirname(__FILE__), '../../cryptcheck/lib'
require 'rubygems'
require 'bundler/setup'
$TESTING = false
$CELLULOID_DEBUG = false
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse
cli.run
rescue => e
raise e if $DEBUG
STDERR.puts e.message
STDERR.puts e.backtrace.join("\n")
exit 1
end

1
bin/sidekiq 120000
View File

@ -0,0 +1 @@
runner

20
bin/sidekiq.rb 100755
View File

@ -0,0 +1,20 @@
#!/usr/bin/env ruby
$:.unshift File.expand_path File.join File.dirname(__FILE__), '../../cryptcheck/lib'
require 'rubygems'
require 'bundler/setup'
$TESTING = false
$CELLULOID_DEBUG = false
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse
cli.run
rescue => e
raise e if $DEBUG
STDERR.puts e.message
STDERR.puts e.backtrace.join("\n")
exit 1
end