Browse Source

Better binaries

sites
aeris 6 years ago
parent
commit
88c4151328
  1. 10
      bin/enqueue
  2. 1
      bin/enqueue
  3. 22
      bin/enqueue.rb
  4. 3
      bin/runner
  5. 20
      bin/sidekiq
  6. 1
      bin/sidekiq
  7. 20
      bin/sidekiq.rb

10
bin/enqueue

@ -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

@ -0,0 +1 @@
runner

22
bin/enqueue.rb

@ -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

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

20
bin/sidekiq

@ -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

@ -0,0 +1 @@
runner

20
bin/sidekiq.rb

@ -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
Loading…
Cancel
Save